diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-19 10:12:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-19 10:12:22 +0200 |
commit | 0b4fcbeae101f2a5171217f65bab9c6545e853ba (patch) | |
tree | d4a80d33799ba874c8ab4ff26185a9bccce9b6ce /cli/runtime-source.cxx | |
parent | 89ce153311d9163bbc356927346c0b30e158a75f (diff) | |
download | cli-0b4fcbeae101f2a5171217f65bab9c6545e853ba.tar.gz cli-0b4fcbeae101f2a5171217f65bab9c6545e853ba.tar.xz cli-0b4fcbeae101f2a5171217f65bab9c6545e853ba.zip |
Add option description that can be examined at runtime.
New option: --generate-description.
Diffstat (limited to 'cli/runtime-source.cxx')
-rw-r--r-- | cli/runtime-source.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
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 |