From 0b4fcbeae101f2a5171217f65bab9c6545e853ba Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 19 Nov 2010 10:12:22 +0200 Subject: Add option description that can be examined at runtime. New option: --generate-description. --- cli/runtime-source.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cli/runtime-source.cxx') diff --git a/cli/runtime-source.cxx b/cli/runtime-source.cxx index c76b745..7ccf404 100644 --- a/cli/runtime-source.cxx +++ b/cli/runtime-source.cxx @@ -412,6 +412,25 @@ generate_runtime_source (context& ctx) << "}"; } + // Option description. + // + if (ctx.options.generate_description ()) + { + // options + // + os << "void options::" << endl + << "push_back (const option& o)" + << "{" + << "container_type::size_type n (size ());" + << "container_type::push_back (o);" + << "map_[o.name ()] = n;" + << endl + << "for (option_names::const_iterator i (o.aliases ().begin ());" << endl + << "i != o.aliases ().end (); ++i)" << endl + << "map_[*i] = n;" + << "}"; + } + bool sp (ctx.specifier); // parser class template & its specializations -- cgit v1.1