/usr/include/pbcopper/cli/Option.h is in libpbcopper-dev 0.0.1+20161202-2.
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 | #ifndef PBCOPPER_CLI_OPTION_H
#define PBCOPPER_CLI_OPTION_H
#include "pbcopper/Config.h"
#include "pbcopper/json/JSON.h"
#include <initializer_list>
#include <string>
#include <memory>
#include <vector>
namespace PacBio {
namespace CLI {
namespace internal { class OptionPrivate; }
/// \brief The Option class defines a possible command-line option.
///
/// This class is used to describe an option on the command line. It allows
/// different ways of defining the same option with multiple aliases possible.
/// It is also used to describe how the option is used - it may be a flag
/// (e.g. -v) or take a value (e.g. -o file).
///
class Option
{
public:
using BoolType = JSON::Json::boolean_t;
using IntType = JSON::Json::number_integer_t;
using UIntType = JSON::Json::number_unsigned_t;
using FloatType = JSON::Json::number_float_t;
using StringType = JSON::Json::string_t;
public:
/// \name Default Options
/// \{
///
/// \brief DefaultHelpOption
/// \return
///
static const Option& DefaultHelpOption(void);
///
/// \brief DefaultLogLevelOption
/// \return
///
static const Option& DefaultLogLevelOption(void);
///
/// \brief DefaultVerboseOption
/// \return
///
static const Option& DefaultVerboseOption(void);
///
/// \brief DefaultVersionOption
/// \return
///
static const Option& DefaultVersionOption(void);
/// \}
public:
/// \name Constructors & Related Methods
/// \{
/// \brief Constructs a command line option object with the given arguments.
///
/// The name of the option are set to \p name. Option names can be either
/// short or long. If a name is one character in length, it is considered a
/// short name. %Option names must not be empty, must not start with a dash
/// or a slash character, must not contain a '=' and cannot be repeated.
///
/// The description is set to \p description. In addition, the \p valueName
/// can be set if the option expects a value. The default value for the
/// option is set to \p defaultValue.
///
/// If \p defaultValue is not provided, the option is considered to be a
/// switch.
///
/// This class can participate in C++11-style uniform initialization:
///
/// \code
/// PacBio::CLI::Interface cl;
/// cl.addOption({"verbose_arg", "verbose", "Verbose mode."});
/// \endcode
///
/// \param[in] name option name
/// \param[in] description option description
/// \param[in] valueName value name (used in help display)
/// \param[in] defaultValue default value for option if not specified
///
Option(const std::string& id,
const std::string& name,
const std::string& description,
const JSON::Json& defaultValue = JSON::Json(nullptr));
/// \brief Constructs a command line option object with the given arguments.
///
/// This overload allows to set multiple names for the option, for instance
/// "o" and "output".
///
/// The names of the option are set to \p names. Option names can be either
/// short or long. If a name is one character in length, it is considered a
/// short name. %Option names must not be empty, must not start with a dash
/// or a slash character, must not contain a '=' and cannot be repeated.
///
/// The description is set to \p description. In addition, the \p valueName
/// can be set if the option expects a value. The default value for the
/// option is set to \p defaultValue.
///
/// If \p defaultValue is not provided, the option is considered to be a
/// switch.
///
/// This class can participate in C++11-style uniform initialization:
///
/// \code
/// PacBio::CLI::Interface cl;
/// cl.addOption({"output_file", {"o", "output"}, "Write results to <file>."});
/// \endcode
///
/// \param[in] name option name
/// \param[in] description option description
/// \param[in] valueName value name (used in help display)
/// \param[in] defaultValue default value for option if not specified
///
Option(const std::string& id,
const std::vector<std::string>& names,
const std::string& description,
const JSON::Json& defaultValue = JSON::Json(nullptr));
/// \brief Constructs a command line option object with the given arguments.
///
/// This overload allows to set multiple names for the option, for instance
/// "o" and "output".
///
/// The names of the option are set to \p names. Option names can be either
/// short or long. If a name is one character in length, it is considered a
/// short name. %Option names must not be empty, must not start with a dash
/// or a slash character, must not contain a '=' and cannot be repeated.
///
/// The description is set to \p description. In addition, the \p valueName
/// can be set if the option expects a value. The default value for the
/// option is set to \p defaultValue.
///
/// If \p defaultValue is not provided, the option is considered to be a
/// switch.
///
/// This class can participate in C++11-style uniform initialization:
///
/// \code
/// PacBio::CLI::Interface cl;
/// cl.addOption({"output_file", {"o", "output"}, "Write results to <file>."});
/// \endcode
///
/// \param[in] name option name
/// \param[in] description option description
/// \param[in] valueName value name (used in help display)
/// \param[in] defaultValue default value for option if not specified
///
Option(const std::string& id,
const std::initializer_list<std::string>& names,
const std::string& description,
const JSON::Json& defaultValue = JSON::Json(nullptr));
Option(const Option& other);
Option(Option&& other);
Option& operator=(const Option& other);
Option& operator=(Option&& other);
~Option(void);
/// \}
public:
/// \name Attributes
/// \{
///
/// \brief DefaultValue
/// \return
///
JSON::Json DefaultValue(void) const;
///
/// \brief Description
/// \return
///
std::string Description(void) const;
///
/// \brief Id
/// \return
///
std::string Id(void) const;
///
/// \brief IsHidden
/// \return
///
bool IsHidden(void) const;
///
/// \brief Names
/// \return
///
std::vector<std::string> Names(void) const;
///
/// \brief ValueName
/// \return
///
std::string ValueName(void) const;
/// \}
private:
std::shared_ptr<internal::OptionPrivate> d_;
};
} // namespace CLI
} // namespace PacBio
#include "internal/Option-inl.h"
#endif // PBCOPPER_CLI_OPTION_H
|