2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-24 18:32:38 +00:00

Generate xml from boost_libraries.

Run it on libraries.xml to "normalize" it.
This commit is contained in:
Daniel James
2014-01-12 13:30:44 +00:00
parent 427808b5e0
commit 696dfdb11a
3 changed files with 88 additions and 25 deletions

View File

@@ -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();

View File

@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="US-ASCII"?>
<boost xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<categories>
<category name="String">
@@ -254,8 +255,7 @@
<boost-version>1.35.0</boost-version>
<name>Circular Buffer</name>
<authors>Jan Gaspar</authors>
<description>A STL compliant container also known as ring or cyclic buffer.
</description>
<description>A STL compliant container also known as ring or cyclic buffer.</description>
<documentation>libs/circular_buffer/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
@@ -279,8 +279,7 @@
<name>Concept Check</name>
<authors>Jeremy Siek</authors>
<description>Tools for generic programming.</description>
<documentation>
libs/concept_check/</documentation>
<documentation>libs/concept_check/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Generic</category>
@@ -384,8 +383,7 @@
operator&lt;&lt;. The number of bits in the set is specified at
runtime via a parameter to the constructor of the
dynamic_bitset.</description>
<documentation>
libs/dynamic_bitset/dynamic_bitset.html</documentation>
<documentation>libs/dynamic_bitset/dynamic_bitset.html</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Containers</category>
@@ -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 &quot;foreach&quot;
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 @@
<name>Lexical Cast</name>
<authors>Kevlin Henney</authors>
<description>General literal text conversions, such as an int
represented a string, or vice-versa, from Kevlin Henney.
</description>
represented a string, or vice-versa, from Kevlin Henney.</description>
<documentation>libs/conversion/lexical_cast.htm</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
@@ -1054,8 +1051,7 @@
<authors>Fernando Cacciola</authors>
<description>Optimized Policy-based Numeric
Conversions.</description>
<documentation>
libs/numeric/conversion/</documentation>
<documentation>libs/numeric/conversion/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Math</category>
@@ -1069,8 +1065,7 @@
Sylvain Pion</authors>
<description>Extends the usual arithmetic functions to
mathematical intervals.</description>
<documentation>
libs/numeric/interval/doc/interval.htm</documentation>
<documentation>libs/numeric/interval/doc/interval.htm</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Math</category>
@@ -1118,8 +1113,7 @@
<authors>David Abrahams and Daniel Wallin</authors>
<description>Boost.Parameter Library - Write functions that
accept arguments by name.</description>
<documentation>
libs/parameter/</documentation>
<documentation>libs/parameter/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Programming</category>
@@ -1258,8 +1252,7 @@
<authors>Thorsten Ottosen</authors>
<description>Containers for storing heap-allocated polymorphic
objects to ease OO-programming.</description>
<documentation>
libs/ptr_container/</documentation>
<documentation>libs/ptr_container/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Containers</category>
@@ -1355,8 +1348,7 @@
<authors>Robert Ramey</authors>
<description>Serialization for persistence and
marshalling.</description>
<documentation>
libs/serialization/</documentation>
<documentation>libs/serialization/</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>IO</category>
@@ -1378,6 +1370,7 @@
<key>signals</key>
<boost-version>1.29.0</boost-version>
<update-version>1.54.0</update-version>
<status>deprecated</status>
<name>Signals</name>
<authors>Doug Gregor</authors>
<description>Managed signals &amp; slots callback
@@ -1387,7 +1380,6 @@
<std-tr1>false</std-tr1>
<category>Function-objects</category>
<category>Patterns</category>
<status>deprecated</status>
</library>
<library>
<key>signals2</key>
@@ -1699,8 +1691,7 @@
<authors>Fernando Cacciola</authors>
<description>Generic in-place construction of contained objects
with a variadic argument-list.</description>
<documentation>
libs/utility/in_place_factories.html</documentation>
<documentation>libs/utility/in_place_factories.html</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>
<category>Generic</category>
@@ -1724,8 +1715,7 @@
<boost-version>1.32.0</boost-version>
<name>Result Of</name>
<authors></authors>
<description>Determines the type of a function call expression.
</description>
<description>Determines the type of a function call expression.</description>
<documentation>libs/utility/utility.htm#result_of</documentation>
<std-proposal>false</std-proposal>
<std-tr1>false</std-tr1>

View File

@@ -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());