summaryrefslogtreecommitdiff
path: root/cli/runtime-source.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-11-19 10:12:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-11-19 10:12:22 +0200
commit0b4fcbeae101f2a5171217f65bab9c6545e853ba (patch)
treed4a80d33799ba874c8ab4ff26185a9bccce9b6ce /cli/runtime-source.cxx
parent89ce153311d9163bbc356927346c0b30e158a75f (diff)
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.cxx19
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