diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-11 12:25:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-11 12:25:53 +0200 |
commit | aa33636c20b65dbf87e2189dc3d8759b883e7909 (patch) | |
tree | 8b57ff0e570429dae4266a0204b7d4ab4f73a744 /cli/html.cxx | |
parent | 5a2e172ce1f2d823bf0957602662bbab0c0dcd0b (diff) |
Add support for specifying multiple classes with --class option
Diffstat (limited to 'cli/html.cxx')
-rw-r--r-- | cli/html.cxx | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/cli/html.cxx b/cli/html.cxx index 1f0c328..8897f4e 100644 --- a/cli/html.cxx +++ b/cli/html.cxx @@ -3,8 +3,13 @@ // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file +#include <vector> +#include <iostream> + #include "html.hxx" +using namespace std; + namespace { struct option: traversal::option, context @@ -169,17 +174,6 @@ namespace virtual void traverse (type& c) { - string const& n (options.class_ ()); - - if (!n.empty ()) - { - string fqn (fq_name (c, false)); - fqn = string (fqn, 2, fqn.size () - 2); // Get rid of leading ::. - - if (n != fqn) - return; - } - if (!options.exclude_base ()) inherits (c, inherits_base_); @@ -213,7 +207,29 @@ generate_html (context& ctx) ctx.os << "<dl class=\"options\">" << endl; - unit.dispatch (ctx.unit); + if (ctx.options.class_ ().empty ()) + unit.dispatch (ctx.unit); + else + { + for (vector<string>::const_iterator i (ctx.options.class_ ().begin ()); + i != ctx.options.class_ ().end (); ++i) + { + string n (*i); + + // Strip leading :: if present. + // + if (n.size () > 2 && n[0] == ':' && n[1] == ':') + n = string (n, 2, string::npos); + + if (semantics::class_* c = ctx.unit.lookup<semantics::class_> ("", n)) + cl.traverse (*c); + else + { + cerr << "error: class '" << *i << "' not found" << endl; + throw generation_failed (); + } + } + } ctx.os << "</dl>" << endl; } |