summaryrefslogtreecommitdiff
path: root/cli/header.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-11-19 14:53:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-11-19 14:53:52 +0200
commit813e4744038ec3a1ca8095111074c1cb2a824d83 (patch)
treec4cda65a3280c09c50c0a3e227cdff5b43240247 /cli/header.cxx
parent3e34f8ac2ba3b719f13a8f9ef7422cbee8b02192 (diff)
Implement entire page usage generation
Diffstat (limited to 'cli/header.cxx')
-rw-r--r--cli/header.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/cli/header.cxx b/cli/header.cxx
index 6ff1f6b..76e2626 100644
--- a/cli/header.cxx
+++ b/cli/header.cxx
@@ -5,6 +5,8 @@
#include "header.hxx"
+using namespace std;
+
namespace
{
//
@@ -308,6 +310,8 @@ namespace
void
generate_header (context& ctx)
{
+ ostream& os (ctx.os);
+
traversal::cli_unit unit;
includes includes (ctx);
traversal::names unit_names;
@@ -324,4 +328,31 @@ generate_header (context& ctx)
ns_names >> cl;
unit.dispatch (ctx.unit);
+
+ // Entire page usage.
+ //
+ if (ctx.usage != ut_none && ctx.options.page_usage_specified ())
+ {
+ os << "// Print page usage information." << endl
+ << "//" << endl;
+
+ const string& qn (ctx.options.page_usage ());
+ string n (ctx.escape (ctx.substitute (ctx.ns_open (qn, false))));
+
+ string const& ost (ctx.options.ostream_type ());
+
+ if (ctx.usage != ut_both)
+ os << "void" << endl
+ << n << "usage (" << ost << "&);"
+ << endl;
+ else
+ os << "void" << endl
+ << n << "short_usage (" << ost << "&);"
+ << endl
+ << "void" << endl
+ << n << "long_usage (" << ost << "&);"
+ << endl;
+
+ ctx.ns_close (qn, false);
+ }
}