From 696dfdb11a2c3e2394de25060dfba527324a6d5a Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 12 Jan 2014 13:30:44 +0000 Subject: [PATCH] Generate xml from boost_libraries. Run it on libraries.xml to "normalize" it. --- common/code/boost_libraries.php | 74 ++++++++++++++++++++++++++++++++- doc/libraries.xml | 38 +++++++---------- site-tools/update-doc-list.php | 1 + 3 files changed, 88 insertions(+), 25 deletions(-) diff --git a/common/code/boost_libraries.php b/common/code/boost_libraries.php index ccf6bf01..9943ca25 100644 --- a/common/code/boost_libraries.php +++ b/common/code/boost_libraries.php @@ -94,8 +94,10 @@ class boost_libraries } else if ($val['tag'] == 'library' && $val['type'] == 'close' && $lib) { + assert(isset($lib['boost-version'])); + assert(isset($lib['key'])); + if (!isset($lib['update-version'])) { - assert(isset($lib['boost-version'])); $lib['update-version'] = $lib['boost-version']; } @@ -111,6 +113,76 @@ class boost_libraries } } + /** + * Generate an xml representation of the library data. + * + * @return string + */ + function to_xml() { + $writer = new XMLWriter(); + $writer->openMemory(); + $writer->setIndent(true); + $writer->setIndentString(' '); + + $writer->startDocument('1.0', 'US-ASCII'); + $writer->startElement('boost'); + $writer->writeAttribute('xmlns:xsi', + 'http://www.w3.org/2001/XMLSchema-instance'); + + $writer->startElement('categories'); + foreach ($this->categories as $name => $category) { + $writer->startElement('category'); + $writer->writeAttribute('name', $name); + $writer->writeElement('title', $category['title']); + $writer->endElement(); + } + $writer->endElement(); // categories + + foreach ($this->db as $key => $libs) { + foreach($libs as $lib) { + $writer->startElement('library'); + $writer->writeElement('key', $lib['key']); + $writer->writeElement('boost-version', $lib['boost-version']); + if ($lib['update-version'] != $lib['boost-version']) { + $writer->writeElement('update-version', $lib['update-version']); + } + $this->write_optional_element($writer, $lib, 'status'); + $this->write_optional_element($writer, $lib, 'name'); + $this->write_optional_element($writer, $lib, 'authors'); + $this->write_optional_element($writer, $lib, 'description'); + $this->write_optional_element($writer, $lib, 'documentation'); + $this->write_optional_element($writer, $lib, 'std-proposal'); + $this->write_optional_element($writer, $lib, 'std-tr1'); + foreach($lib['category'] as $category) { + $writer->writeElement('category', $category); + } + $writer->endElement(); + } + } + + $writer->endElement(); // boost + $writer->endDocument(); + return $writer->outputMemory(); + } + + /** + * Write a library element. + * + * @param XMLWriter $writer + * @param string $lib + * @param string $name + */ + private function write_optional_element($writer, $lib, $name) { + if (isset($lib[$name])) { + $value = $lib[$name]; + $value = is_bool($value) ? + ($value ? "true" : "false") : + (string) $value; + + $writer->writeElement($name, $value); + } + } + function get_for_version($version, $sort = null, $filter = null) { $libs = array(); diff --git a/doc/libraries.xml b/doc/libraries.xml index 4fc7d53a..76497ffd 100644 --- a/doc/libraries.xml +++ b/doc/libraries.xml @@ -1,3 +1,4 @@ + @@ -254,8 +255,7 @@ 1.35.0 Circular Buffer Jan Gaspar - A STL compliant container also known as ring or cyclic buffer. - + A STL compliant container also known as ring or cyclic buffer. libs/circular_buffer/ false false @@ -279,8 +279,7 @@ Concept Check Jeremy Siek Tools for generic programming. - - libs/concept_check/ + libs/concept_check/ false false Generic @@ -384,8 +383,7 @@ operator<<. The number of bits in the set is specified at runtime via a parameter to the constructor of the dynamic_bitset. - - libs/dynamic_bitset/dynamic_bitset.html + libs/dynamic_bitset/dynamic_bitset.html false false Containers @@ -439,7 +437,7 @@ the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, - some other languages, like Perl, provide a dedicated "foreach" + some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write @@ -750,8 +748,7 @@ Lexical Cast Kevlin Henney General literal text conversions, such as an int - represented a string, or vice-versa, from Kevlin Henney. - + represented a string, or vice-versa, from Kevlin Henney. libs/conversion/lexical_cast.htm false false @@ -1054,8 +1051,7 @@ Fernando Cacciola Optimized Policy-based Numeric Conversions. - - libs/numeric/conversion/ + libs/numeric/conversion/ false false Math @@ -1069,8 +1065,7 @@ Sylvain Pion Extends the usual arithmetic functions to mathematical intervals. - - libs/numeric/interval/doc/interval.htm + libs/numeric/interval/doc/interval.htm false false Math @@ -1118,8 +1113,7 @@ David Abrahams and Daniel Wallin Boost.Parameter Library - Write functions that accept arguments by name. - - libs/parameter/ + libs/parameter/ false false Programming @@ -1258,8 +1252,7 @@ Thorsten Ottosen Containers for storing heap-allocated polymorphic objects to ease OO-programming. - - libs/ptr_container/ + libs/ptr_container/ false false Containers @@ -1355,8 +1348,7 @@ Robert Ramey Serialization for persistence and marshalling. - - libs/serialization/ + libs/serialization/ false false IO @@ -1378,6 +1370,7 @@ signals 1.29.0 1.54.0 + deprecated Signals Doug Gregor Managed signals & slots callback @@ -1387,7 +1380,6 @@ false Function-objects Patterns - deprecated signals2 @@ -1699,8 +1691,7 @@ Fernando Cacciola Generic in-place construction of contained objects with a variadic argument-list. - - libs/utility/in_place_factories.html + libs/utility/in_place_factories.html false false Generic @@ -1724,8 +1715,7 @@ 1.32.0 Result Of - Determines the type of a function call expression. - + Determines the type of a function call expression. libs/utility/utility.htm#result_of false false diff --git a/site-tools/update-doc-list.php b/site-tools/update-doc-list.php index c7c447db..bf1bcd23 100644 --- a/site-tools/update-doc-list.php +++ b/site-tools/update-doc-list.php @@ -6,3 +6,4 @@ require_once(dirname(__FILE__) . '/../common/code/boost_libraries.php'); $libs = new boost_libraries(dirname(__FILE__) . '/../doc/libraries.xml'); file_put_contents(dirname(__FILE__) . '/../generated/libraries.txt', serialize($libs)); +file_put_contents(dirname(__FILE__) . '/../doc/libraries.xml.new', $libs->to_xml());