From aa33636c20b65dbf87e2189dc3d8759b883e7909 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 11 May 2012 12:25:53 +0200 Subject: Add support for specifying multiple classes with --class option --- cli/html.cxx | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'cli/html.cxx') 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 +#include + #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 << "
" << endl; - unit.dispatch (ctx.unit); + if (ctx.options.class_ ().empty ()) + unit.dispatch (ctx.unit); + else + { + for (vector::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 ("", n)) + cl.traverse (*c); + else + { + cerr << "error: class '" << *i << "' not found" << endl; + throw generation_failed (); + } + } + } ctx.os << "
" << endl; } -- cgit v1.1