summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-03-19 12:44:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-03-19 12:44:04 +0200
commit1dea398d6f864c99b9e1c34e4a718239cfd3d8ac (patch)
tree0515378ce75266616760ff41d979357c56d2a087 /cli
parent29e274022a8c88dd1a48c1b591635bb044fe808f (diff)
Add support for exclude-base value in --class-doc option
Diffstat (limited to 'cli')
-rw-r--r--cli/context.cxx2
-rw-r--r--cli/context.hxx1
-rw-r--r--cli/html.cxx15
-rw-r--r--cli/man.cxx18
-rw-r--r--cli/options.cli20
-rw-r--r--cli/source.cxx4
-rw-r--r--cli/txt.cxx18
7 files changed, 61 insertions, 17 deletions
diff --git a/cli/context.cxx b/cli/context.cxx
index fa63dd1..b7181fd 100644
--- a/cli/context.cxx
+++ b/cli/context.cxx
@@ -2586,6 +2586,8 @@ class_doc (semantics::class_& c)
if (k == "exclude")
return cd_exclude;
+ if (k == "exclude-base")
+ return cd_exclude_base;
else if (k == "short")
return cd_short;
else if (k == "long")
diff --git a/cli/context.hxx b/cli/context.hxx
index 3e0019b..5b8d3fd 100644
--- a/cli/context.hxx
+++ b/cli/context.hxx
@@ -37,6 +37,7 @@ enum class_doc
{
cd_default,
cd_exclude,
+ cd_exclude_base,
cd_short,
cd_long
};
diff --git a/cli/html.cxx b/cli/html.cxx
index e8a43db..ccb023d 100644
--- a/cli/html.cxx
+++ b/cli/html.cxx
@@ -254,7 +254,7 @@ namespace
//
struct class_: traversal::class_, context
{
- class_ (context& c, bool& l): context (c), list_ (l)
+ class_ (context& c, bool& l): context (c), list_ (l), base_ (false)
{
*this >> inherits_ >> *this;
}
@@ -264,11 +264,16 @@ namespace
{
class_doc_type cd (class_doc (c));
- if (cd == cd_exclude)
+ if (cd == cd_exclude || (base_ && cd == cd_exclude_base))
return;
if (!options.exclude_base () && !options.include_base_last ())
+ {
+ bool ob (base_);
+ base_ = true;
inherits (c);
+ base_ = ob;
+ }
doc dc (*this, cd, list_);
option op (*this, cd, list_);
@@ -278,11 +283,17 @@ namespace
names (c, n);
if (!options.exclude_base () && options.include_base_last ())
+ {
+ bool ob (base_);
+ base_ = true;
inherits (c);
+ base_ = ob;
+ }
}
private:
bool& list_;
+ bool base_;
traversal::inherits inherits_;
};
}
diff --git a/cli/man.cxx b/cli/man.cxx
index 54fd975..ccd5374 100644
--- a/cli/man.cxx
+++ b/cli/man.cxx
@@ -182,18 +182,26 @@ namespace
//
struct class_: traversal::class_, context
{
- class_ (context& c): context (c) {*this >> inherits_ >> *this;}
+ class_ (context& c): context (c), base_ (false)
+ {
+ *this >> inherits_ >> *this;
+ }
virtual void
traverse (type& c)
{
class_doc_type cd (class_doc (c));
- if (cd == cd_exclude)
+ if (cd == cd_exclude || (base_ && cd == cd_exclude_base))
return;
if (!options.exclude_base () && !options.include_base_last ())
+ {
+ bool ob (base_);
+ base_ = true;
inherits (c);
+ base_ = ob;
+ }
doc dc (*this, cd);
option op (*this, cd);
@@ -203,10 +211,16 @@ namespace
names (c, n);
if (!options.exclude_base () && options.include_base_last ())
+ {
+ bool ob (base_);
+ base_ = true;
inherits (c);
+ base_ = ob;
+ }
}
private:
+ bool base_;
traversal::inherits inherits_;
};
}
diff --git a/cli/options.cli b/cli/options.cli
index cd644f3..ffa0e5d 100644
--- a/cli/options.cli
+++ b/cli/options.cli
@@ -213,15 +213,17 @@ class options
std::map<std::string, std::string> --class-doc
{
"<name>=<kind>",
- "Specify the documentation <kind> that should be used for the options
- class <name>. The <name> value should be a fully-qualified class name,
- for example, \cb{app::options}. The <kind> value can be \cb{short},
- \cb{long}, or \cb{exclude}. If the value is \cb{exclude}, then the
- class documentation is excluded from usage and man/HTML/text output. For
- usage, the \cb{short} and \cb{long} values determine which usage
- function will be called when the class is used as base or as part of
- the page usage (see \cb{--page-usage}). For man/HTML/text, these values
- determine which documentation strings are used in the output."
+ "Specify the documentation <kind> that should be used for the options class
+ <name>. The <name> value should be a fully-qualified class name, for
+ example, \cb{app::options}. The <kind> value can be \cb{short},
+ \cb{long}, \cb{exclude}, or \cb{exclude-base}. If the value is
+ \cb{exclude}, then the class documentation is excluded from usage and
+ man/HTML/text output. If it is \cb{exclude-base}, then it is only
+ excluded when used as a base. For usage, the \cb{short} and \cb{long}
+ values determine which usage function will be called when the class is
+ used as base or as part of the page usage (see \cb{--page-usage}). For
+ man/HTML/text, these values determine which documentation strings are
+ used in the output."
};
std::vector<std::string> --class
diff --git a/cli/source.cxx b/cli/source.cxx
index 44bf93e..180cea8 100644
--- a/cli/source.cxx
+++ b/cli/source.cxx
@@ -519,7 +519,7 @@ namespace
{
class_doc_type cd (class_doc (c));
- if (cd == cd_exclude)
+ if (cd == cd_exclude || cd == cd_exclude_base)
return;
const char* t (
@@ -1040,7 +1040,7 @@ namespace
return;
const char* t (
- (cd == cd_default
+ (cd == cd_default || cd == cd_exclude_base
? usage != ut_both || usage_ == ut_short
: cd == cd_short) ? "" : "long_");
diff --git a/cli/txt.cxx b/cli/txt.cxx
index bf01718..c44e4ff 100644
--- a/cli/txt.cxx
+++ b/cli/txt.cxx
@@ -194,18 +194,26 @@ namespace
//
struct class_: traversal::class_, context
{
- class_ (context& c): context (c) {*this >> inherits_ >> *this;}
+ class_ (context& c): context (c), base_ (false)
+ {
+ *this >> inherits_ >> *this;
+ }
virtual void
traverse (type& c)
{
class_doc_type cd (class_doc (c));
- if (cd == cd_exclude)
+ if (cd == cd_exclude || (base_ && cd == cd_exclude_base))
return;
if (!options.exclude_base () && !options.include_base_last ())
+ {
+ bool ob (base_);
+ base_ = true;
inherits (c);
+ base_ = ob;
+ }
doc dc (*this, cd);
option op (*this, cd);
@@ -215,10 +223,16 @@ namespace
names (c, n);
if (!options.exclude_base () && options.include_base_last ())
+ {
+ bool ob (base_);
+ base_ = true;
inherits (c);
+ base_ = ob;
+ }
}
private:
+ bool base_;
traversal::inherits inherits_;
};
}