Class CArgumentDefBase#
Defined in File cmdlnparser.h
Nested Relationships#
Nested Types#
Inheritance Relationships#
Derived Types#
public CArgumentDefT< TEnum, typename std::enable_if_t< std::is_enum< TEnum >::value > >
(Template Class CArgumentDefT< TEnum, typename std::enable_if_t< std::is_enum< TEnum >::value > >)public CArgumentDefT< TVar, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >
(Template Class CArgumentDefT< TVar, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >)public CArgumentDefT< sdv::sequence< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >
(Template Class CArgumentDefT< sdv::sequence< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >)public CArgumentDefT< sdv::sequence< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >
(Template Class CArgumentDefT< sdv::sequence< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >)public CArgumentDefT< sdv::sequence< sdv::u8string >, void >
(Template Class CArgumentDefT< sdv::sequence< sdv::u8string >, void >)public CArgumentDefT< sdv::sequence< std::filesystem::path >, void >
(Template Class CArgumentDefT< sdv::sequence< std::filesystem::path >, void >)public CArgumentDefT< sdv::sequence< std::string >, void >
(Template Class CArgumentDefT< sdv::sequence< std::string >, void >)public CArgumentDefT< sdv::u8string, void >
(Template Class CArgumentDefT< sdv::u8string, void >)public CArgumentDefT< std::filesystem::path, void >
(Template Class CArgumentDefT< std::filesystem::path, void >)public CArgumentDefT< std::list< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >
(Template Class CArgumentDefT< std::list< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >)public CArgumentDefT< std::list< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >
(Template Class CArgumentDefT< std::list< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >)public CArgumentDefT< std::list< sdv::u8string >, void >
(Template Class CArgumentDefT< std::list< sdv::u8string >, void >)public CArgumentDefT< std::list< std::filesystem::path >, void >
(Template Class CArgumentDefT< std::list< std::filesystem::path >, void >)public CArgumentDefT< std::list< std::string >, void >
(Template Class CArgumentDefT< std::list< std::string >, void >)public CArgumentDefT< std::string, void >
(Template Class CArgumentDefT< std::string, void >)public CArgumentDefT< std::vector< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >
(Template Class CArgumentDefT< std::vector< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >)public CArgumentDefT< std::vector< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >
(Template Class CArgumentDefT< std::vector< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >)public CArgumentDefT< std::vector< sdv::u8string >, void >
(Template Class CArgumentDefT< std::vector< sdv::u8string >, void >)public CArgumentDefT< std::vector< std::filesystem::path >, void >
(Template Class CArgumentDefT< std::vector< std::filesystem::path >, void >)public CArgumentDefT< std::vector< std::string >, void >
(Template Class CArgumentDefT< std::vector< std::string >, void >)
Class Documentation#
-
class CArgumentDefBase#
Command line argument containing the name of the argument, the default value and the reference to the variable receiving the target value.
Subclassed by CArgumentDefT< TEnum, typename std::enable_if_t< std::is_enum< TEnum >::value > >, CArgumentDefT< TVar, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >, CArgumentDefT< sdv::sequence< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >, CArgumentDefT< sdv::sequence< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >, CArgumentDefT< sdv::sequence< sdv::u8string >, void >, CArgumentDefT< sdv::sequence< std::filesystem::path >, void >, CArgumentDefT< sdv::sequence< std::string >, void >, CArgumentDefT< sdv::u8string, void >, CArgumentDefT< std::filesystem::path, void >, CArgumentDefT< std::list< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >, CArgumentDefT< std::list< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >, CArgumentDefT< std::list< sdv::u8string >, void >, CArgumentDefT< std::list< std::filesystem::path >, void >, CArgumentDefT< std::list< std::string >, void >, CArgumentDefT< std::string, void >, CArgumentDefT< std::vector< TEnum >, typename std::enable_if_t< std::is_enum< TEnum >::value > >, CArgumentDefT< std::vector< TVar >, typename std::enable_if_t< std::is_arithmetic< TVar >::value > >, CArgumentDefT< std::vector< sdv::u8string >, void >, CArgumentDefT< std::vector< std::filesystem::path >, void >, CArgumentDefT< std::vector< std::string >, void >
Public Functions
-
inline const CCommandLine &GetCLParser() const#
Get access to the command line parser.
- Returns:
Reference to the parser.
-
bool CompareNameAndAssign(CArgumentIterator &rargit, const std::string &rssArgument, const std::string &rssOptionName, bool bPartial) const#
Compare the argument name and assign the argument value when the name corresponds.
Remark
The comparison occurs either case sensitive or case insensitive (lower case) dependable on the argument configuration.
- Parameters:
rargit – [in] Reference to the argument iterator, allowing additional arguments to be retrieved during the assignment. This will only be the case when the command line parser was initiated with the EParseFlags::assignment_next_arg parser flag.
rssArgument – [in] Reference to the string containing the argument.
rssOptionName – [in] The name to compare the argument with (must be one of the registered names of the option or no name if the argument is a default value).
bPartial – [in] When set, the argument definition name could be part of the supplied argument string (in case assignment characters are not used).
- Returns:
bool Returns true when the comparison was successful and the variable was updated; other returns false.
-
void AddExample(const std::string &rssExample)#
Add the examples to be printed in the help text.
- Parameters:
rssExample – [in] Zero terminated string containing the example assignment.
-
inline const std::vector<SOptionName> &GetOptionNames() const#
Get the argument option names.
- Returns:
Reference to a vector with argument option names.
-
inline const std::string &GetHelpText() const#
Get the help text.
- Returns:
Reference to a string containing the help text.
-
inline const std::shared_ptr<IArgumentProvide> &GetArgumentVar() const#
Get the argument variable access interface.
- Returns:
Reference to the pointer containing the object exposing the argument variable access interface.
-
inline const std::list<std::string> &GetExamples() const#
Get the examples.
- Returns:
Reference to a list with the examples.
-
inline bool CheckFlag(EArgumentFlags eFlag) const#
Check for flag to have been set.
- Parameters:
eFlag – [in] The flag to check.
- Returns:
Returns the result.
-
inline void AddOptionName(const std::string &rssOption)#
Add additional option name.
- Parameters:
rssOption – [in] The name to add for this option.
-
inline void AddSubOptionName(const std::string &rssSubOption)#
Add additional sub-option name.
- Parameters:
rssSubOption – [in] The name to add for this option.
-
inline std::shared_ptr<SGroupDef> GetGroup() const#
Get the current logical group if existing.
- Returns:
Shared pointer to the group this argument is assigned to. Or NULL when no group assignment is available.
-
inline bool PartOfArgumentGroup(size_t nGroup) const#
Is the option compatible to the argument specific group? Options assigned argument group #0 are always compatible.
- Parameters:
nGroup – [in] The argument specific group to show arguments for.
- Returns:
Returns whether the argument is part of the argument group.
-
inline bool OptionAvailableOnCommandLine() const#
Is the option available on the command line?
In case an option is provided, but zhe string assignment is empty. This might be valid for several options where the presence of a string following the option can be optional. To detect whether the option is provided, this function can be used.
- Returns:
Returns whether the option was available at the command line.
Protected Functions
Constructor for singular arguments.
- Template Parameters:
TVar – The type of the argument variable.
TArgumentGroup – Types of argument groups for showing argument specific help.
- Parameters:
rCLParser – [in] Reference to the command line parser.
rssArgument – [in] Pointer to the zero terminated string containing the name of the argument.
rptrGroup – [in] Reference to the group this argument is assigned to.
rssHelpText – [in] Pointer to the zero terminated string containing the help text of the argument.
uiFlags – [in] The argument flags.
rtVar – [inout] Reference to the argument to be changed. This variable will be updated during the parse operation.
nArgumentGroup – [in] One or more argument group to assign the argument to.
-
virtual ~CArgumentDefBase()#
Destructor.
- Attention
Since the structure is inherited by many derived classes and it is used with polymorphism to delete the derived class, the destructor has to be virtual.
-
struct SOptionName#
Argument entry (multiple argument names are possible for one argument).
-
inline const CCommandLine &GetCLParser() const#