2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-25 18:52:30 +00:00
Files
website/common/code/boost_libraries.php

67 lines
2.0 KiB
PHP

<?php
/*
Copyright 2006 Redshift Software, Inc.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
*/
require_once(dirname(__FILE__) . '/boost.php');
class boost_libraries
{
var $db = array();
function boost_libraries($xml_file)
{
$xml = implode("",file($xml_file));
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $xml, $values);
xml_parser_free($parser);
##print '<!-- '; print_r($values); print ' -->';
$lib = NULL;
foreach ( $values as $key => $val )
{
if ($val['tag'] == 'library' && $val['type'] == 'open')
{
$lib = array();
}
else if ($val['type'] == 'complete')
{
switch ($val['tag'])
{
case 'key':
case 'boost-version':
case 'name':
case 'authors':
case 'description':
case 'documentation':
case 'std-proposal':
case 'std-tr1':
case 'header-only':
case 'autolink':
{
if (isset($val['value'])) { $lib[$val['tag']] = trim($val['value']); }
else { $lib[$val['tag']] = ''; }
}
break;
}
}
else if ($val['tag'] == 'library' && $val['type'] == 'close' && $lib)
{
$this->db[$lib['key']] = $lib;
$lib = NULL;
}
}
}
function sort_by($field)
{
$f = '_field_cmp_'.strtolower(str_replace('-','_',$field)).'_';
uasort($this->db,$f);
}
}
?>