/usr/share/doc/libbobcat4-dev/man/argconfig.3.html is in libbobcat-dev 4.08.02-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::ArgConfig(3bobcat)</title>
<style type="text/css">
    figure {text-align: center;}
    img {vertical-align: center;}
    .XXfc {margin-left:auto;margin-right:auto;}
    .XXtc {text-align: center;}
    .XXtl {text-align: left;}
    .XXtr {text-align: right;}
    .XXvt {vertical-align: top;}
    .XXvb {vertical-align: bottom;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title">FBB::ArgConfig(3bobcat)</h1>
<h2 id="author">Program Arguments<br/>(libbobcat-dev_4.08.02-x.tar.gz)</h2>
<h2 id="date">2005-2017</h2>
<p>
<h2 >NAME</h2>FBB::ArgConfig - A singleton class processing program arguments
<p>
<h2 >SYNOPSIS</h2>
    <strong >#include <bobcat/argconfig></strong><br/>
    Linking option: <em >-lbobcat</em> 
<p>
<h2 >DESCRIPTION</h2>
    Singleton class (see Gamma <em >et al.</em>, 1995) built around <strong >getopt</strong>(3)
and <strong >getopt_long</strong>(3). The class handles short- and long command-line
options as well as configuration files.
<p>
In addition to the standard command-line options, configuration files
containing long options as their keys, optionally followed by a colon are also
recognized by the various <em >option</em> members. E.g., an option <em >--input
filename</em> can be specified in the configuration file like 
    <pre>
input: filename
    
</pre>
or
    <pre>
input filename
    
</pre>
    Options without arguments should probably not use the colon, although it
is accepted by <em >ConfigArg</em>. E.g., for the option <em >--verbose</em> both forms 
are OK:
    <pre>
verbose
verbose:
    
</pre>
<p>
<h2 >NAMESPACE</h2>
    <strong >FBB</strong><br/>
    All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace <strong >FBB</strong>.
<p>
<h2 >INHERITS FROM</h2>
    <strong >FBB::Arg</strong>,<br/>
    <strong >FBB::ConfigFile</strong>
<p>
<h2 >CONSTRUCTORS</h2>
    Since the class is a <em >Singleton</em>, no public constructors are
available. Instead, static members are offered to initialize and access the
single <strong >ArgConfig</strong> object. See below.
<p>
<h2 >STATIC MEMBERS</h2>
    <ul>
    <li> <strong >FBB::ArgConfig &initialize(char const *optstring, 
        int argc, char **argv, [std::string const &fname,]
            Comment cType = KeepComment, 
            SearchCasing sType = SearchCaseSensitive,
            Indices iType = IgnoreIndices)</strong>:<br/>
        Initializes the <strong >FBB::ArgConfig</strong> singleton. Must be called only
once.  Throws an <strong >FBB::Exception</strong> exception if called repeatedly or if called
with <em >argv</em> not containing a defined option (which is shown by the
<strong >FBB::Exception</strong>'s <em >what</em> member). The <em >fname</em> argument is optional. If
provided, a configuration file by the specified name is opened (and must
exist); if omitted the <em >ArgConfig</em> is created without using a configuration
file. In the latter case a configuration file may be specified later using the
<em >open</em> member inherited from <em >ConfigFile</em>. The final three parameters are
<em >ConfigFile</em> parameters, receiving the shown default values. This
constructor returns a reference to the singleton object, allowing code
initializing <strong >ArgConfig</strong> to use the initialized object immediately.
<p>
<li> <strong >FBB::ArgConfig &initialize(char const *optstring,
                                LongOption const * const begin,
                                LongOption const * const end,
                                int argc, char **argv,    
             [std::string const &fname,]
            Comment cType = KeepComment, 
            SearchCasing sType = SearchCaseSensitive,
            Indices iType = IgnoreIndices)</strong>:<br/>
       Initializes the <strong >FBB::ArgConfig</strong> singleton. Accepts two iterators of
        an array of <strong >Arg::LongOption</strong> objects, holding long-options. Must be
        called only once. Throws an <strong >FBB::Exception</strong> exception if called
        repeatedly or if called with <em >argv</em> not containing a defined option
        (which is shown by the <strong >FBB::Exception</strong>'s <em >what</em> member).  Refer to
        <strong >arg</strong>(3bobcat) for the description of <strong >Arg::LongOption</strong>.  The
        constructor's final six parameters are identical to the previous
        constructor's final six arguments. This constructor returns a
        reference to the singleton object, allowing code initializing
        <strong >ArgConfig</strong> to use the initialized object immediately.
<p>
The argument
        <em >optstring</em> should consist of letters, possibly postfixed by:
        <ul>
        <li> a colon (<em >:</em>), indicating that the option has a required
            argument;
        <li> a double colon (<em >::</em>), indicating that the option itself 
            has an optional argument (in that case, the option's value 
            will be empty, unless specified).
        </ul>
    <li> <strong >FBB::ArgConfig &instance()</strong>:<br/> 
       Returns the instance of the <strong >ArgConfig</strong> object, available after
        calling one of the <strong >ArgConfig::initialize</strong> members.  If called
        before initialization, an <em >FBB::Exception</em> exception is thrown.
    </ul>
<p>
<h2 >NON-STATIC MEMBER FUNCTIONS</h2>
    All public members of the <em >Arg</em> and <em >ConfigFile</em> classes are also
offered by the <em >ArgConfig</em> class. As several  <em >option</em> members were
reimplemented by this class all <em >option</em> members are discussed below. All
other members inherit straight from the classes <em >Arg</em> and
<em >ConfigFile</em>. Consult their man pages for details.
    <ul>
    <li> <strong >size_t option(int option) const</strong>:<br/>
       Returns the number of times `option' (or its long option synonym, if
        defined) was specified as command line option or as as a configuration
        file option.
    <li> <strong >size_t option(std::string const &options) const</strong>:<br/>
       Returns the total number of times any of the characters specified in
        the `options' string (or their long option synonyms) was specified as
        command line option or as as a configuration file option.
    <li> <strong >size_t option(string *value, int option) const</strong>:<br/>
       Returns the number of times the provided option (or its long option
        synonym) was present as either a command line option or as a
        configuration file option. If the return value is non-zero then the
        value of the first occurrence of this option (first checking the
        command line options; then checking the configuration file) is stored
        in <em >*value</em>, which is left untouched if `option' was not present. 0
        may be specified for <strong >value</strong> if the option does not have a value or
        if the value should not be stored.
    <li> <strong >size_t option(size_t idx, string *value, int option) const</strong>:<br/>
       This member acts identically to the <em >Arg::option</em> member having the
        identical prototype. It does not consider the configuration file but
        merely returns the number of times the provided option (or its long
        option synonym) was present. If the return value is non-zero then the
        value of the <em >idx</em>th occurrence (0-based offset) of this option is
        stored in <em >*value</em>, which is left untouched if `option' was not
        present or if <em >idx</em> is or exceeds the number of specifications of
        the provided option. 0 may be specified for <strong >value</strong> if the option
        does not have a value or if the value should not be stored.
    <li> <strong >size_t option(size_t *idx, string *value, int option) const</strong>:<br/>
       This member acts identically to the <em >Arg::option</em> member having the
        identical prototype. It does not consider the configuration file but
        merely returns the number of times the provided option (or its long
        option synonym) was present. If the return value is non-zero then the
        offset (within the series of <em >option</em> specifications) of the first
        option having a non-empty option value is returned in <em >*idx</em>, while
        its option value is stored in <em >*value</em>. Both <em >*value</em> and <em >*idx</em>
        are left untouched if `option' was not present. 0 may be specified for
        <strong >value</strong> if the option does not have a value or if the value should
        not be stored.
    <li> <strong >size_t option(string *value, char const *longOption) const</strong>:<br/>
       Returns the number of times the specified long option (not having a
        single-character synonym) was present as either a command line option
        or in the configuration file. If found, then the value found at the
        first occurrence of the option (first considering the command line
        options, then the configuration file) is stored in <em >*value</em>. The
        string pointed to by <em >value</em> is left untouched if the long option
        was not present. 0 may be specified for <strong >value</strong> if the option does
        not have a value or if the value should not be stored.
    <li> <strong >size_t option(size_t idx, string *value, 
                                        char const * longOption) const</strong>:<br/>
       This member acts identically to the <em >Arg::option</em> member having the
        identical prototype. It does not consider the configuration file but
        merely returns the number of times the provided long option (not
        having a single-character synonym) was present. If the return value is
        non-zero then the value of the <em >idx</em>th occurrence (0-based offset)
        of this long option is stored in <em >*value</em>, which is left untouched
        if the long option was not present or if <em >idx</em> is or exceeds the
        number of specifications of the provided long option. 0 may be
        specified for <strong >value</strong> if the long option does not have a value or if
        the value should not be stored.
    <li> <strong >size_t option(size_t *idx, string *value, int longOption) const</strong>:<br/>
       This member acts identically to the <em >Arg::option</em> member having the
        identical prototype. It does not consider the configuration file but
        merely returns the number of times the provided long option (not
        having a single-character synonym) was present. If the return value is
        non-zero then the offset (within the series of this long option
        specifications) of the first long option having a non-empty option
        value is returned in <em >*idx</em>, while its option value is stored in
        <em >*value</em>. Both <em >*value</em> and <em >*idx</em> are left untouched if long
        option was not present. 0 may be specified for <strong >value</strong> if the long
        option does not have a value or if the value should not be stored.
    </ul>
<p>
<h2 >EXAMPLE</h2>
<p>
<pre>
#include <iostream>
#include <string>
#include <bobcat/argconfig>
#include <bobcat/exception>
using namespace std;
using namespace FBB;
ArgConfig::LongOption lo[] =
{
    ArgConfig::LongOption{"option", 'o'},
    ArgConfig::LongOption{"value-option", 'v'}
};
class X
{
    ArgConfig &d_arg;
    public:
        X();
        void function();
};
X::X()
:
    d_arg(ArgConfig::instance())
{}
void X::function()
{
    if (d_arg.nArgs() == 0)
        throw Exception() << "Provide the name of a config file as 1st arg";
    cout << "Counting " << d_arg.option('o') << " instances of -o or "
                                                            "--option\n";
    d_arg.open(d_arg[0]);       // Now open the config file explicitly
                            // (alternatively: use a constructor expecting 
                            // a file name)
    cout << "Counting " << d_arg.option('o') << " instances of -o or "
                                                            "--option\n";
    string optval;
    size_t count = d_arg.option(&optval, 'v');
    cout << "Counting " << count << 
                        " instances of -v or --value-option\n";
    if (count)
        cout << "Option value = " << optval << endl;
}
int main(int argc, char **argv)
try
{
    ArgConfig::initialize("ov:", lo, lo + 2, argc, argv);
    X x;
    x.function();
    return 0;
}
catch (Exception const &err)
{
    cout << "Terminating " << err.what() << endl;
    return 1;
}
    
</pre>
<p>
<h2 >FILES</h2>
    <em >bobcat/argconfig</em> - defines the class interface
<p>
<h2 >SEE ALSO</h2>
    <strong >arg</strong>(3bobcat), <strong >configfile</strong>(3obcat), <strong >bobcat</strong>(7)
<p>
<h2 >BUGS</h2>
    None Reported.
<p>
<h2 >DISTRIBUTION FILES</h2>
    <ul>
    <li> <em >bobcat_4.08.02-x.dsc</em>: detached signature;
    <li> <em >bobcat_4.08.02-x.tar.gz</em>: source archive;
    <li> <em >bobcat_4.08.02-x_i386.changes</em>: change log;
    <li> <em >libbobcat1_4.08.02-x_*.deb</em>: debian package holding the
            libraries;
    <li> <em >libbobcat1-dev_4.08.02-x_*.deb</em>: debian package holding the
            libraries, headers and manual pages;
    <li> <em >http://sourceforge.net/projects/bobcat</em>: public archive location;
    </ul>
<p>
<h2 >BOBCAT</h2>
    Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
<p>
<h2 >COPYRIGHT</h2>
    This is free software, distributed under the terms of the 
    GNU General Public License (GPL).
<p>
<h2 >AUTHOR</h2>
    Frank B. Brokken (<strong >f.b.brokken@rug.nl</strong>).
<p>
</body>
</html>
 |