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/man.cxx | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'cli/man.cxx') diff --git a/cli/man.cxx b/cli/man.cxx index ac5d9b1..576ee04 100644 --- a/cli/man.cxx +++ b/cli/man.cxx @@ -3,8 +3,13 @@ // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file +#include +#include + #include "man.hxx" +using namespace std; + namespace { struct option: traversal::option, context @@ -129,17 +134,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_); @@ -171,5 +165,27 @@ generate_man (context& ctx) ns >> ns_names >> ns; ns_names >> cl; - 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 (); + } + } + } } -- cgit v1.1