/usr/include/bobcat/arg is in libbobcat-dev 3.19.01-1ubuntu1.
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 | #ifndef INCLUDED_BOBCAT_ARG_
#define INCLUDED_BOBCAT_ARG_
/*
Singleton Class built around getopt() and getopt_long() (3)
*/
#include <string>
#include <vector>
#include <getopt.h>
namespace FBB
{
class ArgTypes__
{
protected:
typedef struct option OptStruct;
typedef std::vector<std::string> StringVector;
public:
enum Type
{
None = 0,
Required = 1,
Optional = 2,
AsCharOption,
};
};
class LongOption__: public ArgTypes__
{
friend class Arg__;
friend class ArgConfig;
std::string d_name;
Type d_type;
int d_optionChar;
public:
explicit LongOption__(char const *name);
LongOption__(char const *name, Type type);
LongOption__(char const *name, int optionChar);
std::string const &getName() const; // .f
int optionChar() const; // .f
};
class Arg__;
class Arg: public ArgTypes__
{
friend class ArgConfig; // accesses the constructors and
// longOption()
Arg__ *d_ptr; // pointer to the implementation
static Arg *s_arg; // points to Singleton Arg
public:
typedef FBB::LongOption__ LongOption;
static Arg &initialize(char const *optstring, int argc, char **argv);
static Arg &initialize(char const *optstring,
LongOption const * const begin,
LongOption const * const end,
int argc, char **argv);
static Arg &instance();
int beyondDashes() const;
std::string const &basename() const;
size_t nArgs() const;
// total number of specified short (and combined long) options
size_t nOptions() const;
// total numer of long-only options specified
size_t nLongOptions() const;
size_t option(int option) const; // 1
size_t option(std::string const &optchars) const; // 2
size_t option(size_t idx,
std::string *value, int option) const; // 3
size_t option(size_t *idx,
std::string *value, int option) const; // 4
size_t option(size_t idx, std::string *value,
char const *longOption) const; // 5
size_t option(size_t *idx, std::string *value,
char const *longOption) const; // 6
size_t option(std::string *value, int optChar) const; // 1.f
// 2.f
size_t option(std::string *value, char const *longOption) const;
char const *operator[](size_t idx) const;
void versionHelp(void (*usage)(std::string const &progname),
char const *version, size_t minArgs, int helpFlag = 'h',
int versionFlag = 'v') const;
char const **argPointers();
private:
Arg(Arg const &other) = delete;
Arg &operator=(Arg const &other) = delete;
Arg(char const *optstring, int argc, char **argv); // 1
Arg(char const *optstring, // 2
LongOption const * const begin,
LongOption const * const end,
int argc, char **argv);
};
inline std::string const &LongOption__::getName() const
{
return d_name;
}
inline int LongOption__::optionChar() const
{
return d_optionChar;
}
inline size_t Arg::option(std::string *value, int optChar) const
{
return option(static_cast<size_t>(0), value, optChar);
}
inline size_t Arg::option(std::string *value, char const *longOption) const
{
return option(static_cast<size_t>(0), value, longOption);
}
} // FBB
#endif
|