'all', // all/categorized // filtered_std-proposal, filtered_std-tr1 // category_* 'sort' => 'name', // Field to sort libraries by. 'filter' => null, // Filter by whether an attribute is present. // Not used for a long time, could probably be // dropped. ); static $view_fields = Array( 'all' => 'All', 'categorized' => 'Categorized', 'condensed' => 'Condensed', ); static $filter_fields = Array( 'header-only' => '[old]', 'autolink' => '[old]' ); static $sort_fields = Array( 'name' => 'Name', 'boost-version' => 'First Release', 'key' => 'Key', 'cxxstd' => 'C++ Minimum' ); static $display_sort_fields = Array( 'name' => 'Name', 'boost-version' => 'First Release', 'cxxstd' => 'C++ Minimum' ); var $params; // Normalised URL parameters var $libs; var $documentation_page; var $categories; var $page_url_path; // URL path for this page var $view_value; var $sort_value; var $attribute_filter; var $category_value; var $filter_value; function __construct($params, $libs) { $this->libs = $libs; $this->categories = $libs->get_categories(); $this->documentation_page = BoostDocumentation::library_documentation_page(); $page_url_path = $_SERVER['REQUEST_URI']; $page_url_path = preg_replace('@[#?].*@', '', $page_url_path); $page_url_path = preg_replace('@//+@', '/', $page_url_path); $this->page_url_path = $page_url_path; $this->params = array(); foreach (self::$param_defaults as $key => $default) { // Note: Using default for empty values as well as missing values. $this->params[$key] = strtolower(trim( BoostWebsite::array_get($params, $key))) ?: $default; } $this->view_value = $this->params['view']; if (strpos($this->view_value, 'filtered_') === 0) { $this->filter_value = substr($this->view_value, strlen('filtered_')) ?: ''; if (!array_key_exists($this->filter_value, self::$filter_fields)) { BoostWeb::throw_http_error(400, "Malformed request", "Invalid filter field: {$this->filter_value}"); } if (self::$filter_fields[$this->filter_value] == '[old]') { BoostWeb::throw_http_error(410, 'Filter field no longer supported.', "Filter field {$this->filter_value} is no longer supported"); } $this->view_value = 'all'; } else if (strpos($this->view_value, 'category_') === 0) { $this->category_value = substr($this->view_value, strlen('category_')) ?: ''; if(!array_key_exists($this->category_value, $this->categories)) { BoostWeb::throw_http_error(400, "Invalid category", "Invalid category: {$this->category_value}"); } $this->view_value = 'all'; } else { if (!array_key_exists($this->view_value, self::$view_fields)) { BoostWeb::throw_http_error(400, 'Invalid view value', "Invalid view value: {$this->view_value}"); } } $this->sort_value = $this->params['sort']; if (!array_key_exists($this->sort_value, self::$sort_fields)) { BoostWeb::throw_http_error(400, 'Invalid sort field', "Invalid sort value: {$this->sort_value}"); } $this->attribute_filter = $this->params['filter']; if ($this->attribute_filter) { if (!preg_match('@^[-_a-zA-Z0-9]+$@', $this->attribute_filter)) { BoostWeb::throw_http_error(400, 'Invalid attribute filter', "Invalid attribute filter: {$this->attribute_filter}"); } } if ($this->documentation_page->version->is_numbered_release() && $this->libs->latest_version && $this->documentation_page->version->compare($this->libs->latest_version) > 0) { BoostWeb::throw_error_404($_SERVER['REQUEST_URI']); } } function filter($lib) { if (!BoostLibraries::filter_visible($lib)) { return false; } if ($this->filter_value && empty($lib[$this->filter_value])) { return false; } if ($this->attribute_filter && empty($lib[$this->attribute_filter])) { return false; } if ($this->category_value && (empty($lib['category']) || !in_array($this->category_value, $lib['category']))) { return false; } return true; } function title() { $page_title = "Boost"; if ($this->documentation_page->version_title) { $page_title .= " {$this->documentation_page->version_title}"; } $page_title .= " Library Documentation"; if ($this->category_value) { $page_title.= ' - '. $this->categories[$this->category_value]['title']; } return $page_title; } function category_subtitle() { if($this->category_value) { echo '

', html_encode($this->categories[$this->category_value]['title']), '

'; } } function view_menu_items() { foreach (self::$view_fields as $key => $description) { echo '
  • '; $this->option_link($description, 'view', $key); echo '
  • '; } } function filter_menu_items() { foreach (self::$filter_fields as $key => $description) { if (!preg_match('@^\[.*\]$@', $description)) { echo '
  • '; $this->option_link($description, 'view', 'filtered_'.$key); echo '
  • '; } } } function sort_menu_items() { foreach (self::$display_sort_fields as $key => $description) { echo '
  • '; $this->option_link($description, 'sort', $key); echo '
  • '; } } function filtered_libraries() { return $this->libs->get_for_version( $this->documentation_page->version, $this->sort_value, array($this, 'filter')); } function categorized_libraries() { return $this->libs->get_categorized_for_version( $this->documentation_page->version, $this->sort_value, array($this, 'filter')); } // Library display functions: function libid($lib) { $id = trim(preg_replace('@[^a-zA-Z0-9]+@', '-', $lib['key']), '-'); echo "lib-{$id}"; } function libref($lib) { if (!empty($lib['documentation'])) { $docref = "/doc/libs/{$this->documentation_page->url_doc_dir}/{$lib['documentation']}"; print '' . html_encode(!empty($lib['name']) ? $lib['name'] : $lib['key']) . ''; } else { print html_encode(!empty($lib['name']) ? $lib['name'] : $lib['key']); } if (!empty($lib['status'])) { print ' (' . html_encode($lib['status']) . ')'; } } function libdescription($lib) { echo !empty($lib['description']) ? html_encode($lib['description'],ENT_NOQUOTES,'UTF-8') : ' '; } function libauthors($lib) { print !empty($lib['authors']) ? html_encode($lib['authors']) : ' '; } function libavailable($lib) { print $lib['boost-version']->is_update_version() ? html_encode($lib['boost-version']) : ''.html_encode($lib['boost-version']).''; } function libstandard_min_level($lib) { print !empty($lib['cxxstd']) ? html_encode($lib['cxxstd']) : ' '; } function libcategories($lib) { $first = true; if ($lib['category']) { foreach ($lib['category'] as $category_name) { if (!$first) echo ', '; $first = false; $this->category_link($category_name); } } if ($first) echo ' '; } function option_link($description, $field, $value) { $value = strtolower($value); $current_value = $this->params[$field]; if ($current_value == $value) { echo '', html_encode($description), ''; } else { $params = $this->params; $params[$field] = $value; $url_params = ''; foreach ($params as $k => $v) { if ($v && $v !== self::$param_defaults[$k]) { $url_params .= $url_params ? '&' : '?'; $url_params .= urlencode($k) . '=' . urlencode($v); } } echo '', html_encode($description), ''; } } function category_link($name) { $category = $this->categories[$name]; $this->option_link( isset($category['title']) ? $category['title'] : $name, 'view', 'category_' . $name); } } $library_page = new LibraryPage($_GET, BoostLibraries::load()); if ($library_page->documentation_page->redirect_if_appropriate()) { return; } // To avoid confusion, only show this page when there is actual documentation. if (!is_dir($library_page->documentation_page->documentation_dir())) { BoostWeb::throw_error_404($_SERVER['REQUEST_URI']); } ?> <?php echo html_encode($library_page->title()); ?>
    documentation_page); ?>

    title()); ?>

    Sort by:
    view_value == 'all'): ?> category_subtitle(); ?>
    filtered_libraries() as $lib): ?>
    libref($lib); ?>

    libdescription($lib); ?>

    Author(s)
    libauthors($lib); ?>
    First Release
    libavailable($lib); ?>
    C++ Standard Minimum Level
    libstandard_min_level($lib); ?>
    Categories
    libcategories($lib); ?>
    view_value == 'condensed'): ?> category_subtitle(); ?>
      filtered_libraries() as $lib): ?>
    • libref($lib); echo ': '; $library_page->libdescription($lib); ?>

    By Category

    categorized_libraries() as $name => $category) { if(count($category['libraries'])) { echo '

    '; echo "\n"; $library_page->category_link($name); echo '

    '; echo '
      '; foreach ($category['libraries'] as $lib) { echo '
    • '; $library_page->libref($lib); echo ': '; $library_page->libdescription($lib); echo '
    • '; echo "\n"; } echo '
    '; echo "\n"; } } ?>