Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
ola::Flag< T > Class Template Reference

Detailed Description

template<typename T>
class ola::Flag< T >

A templated Flag class.

Template Parameters
Tthe type of the flag.
Inheritance diagram for ola::Flag< T >:
ola::BaseFlag ola::FlagInterface

Public Member Functions

 Flag (const char *name, const char *arg_type, const char *short_opt, T default_value, const char *help, const bool has_arg)
 Create a new Flag.
 
const char * name () const
 Get the flag name.
 
bool has_arg () const
 Whether the flag requires an argument.
 
bool default_value () const
 
 operator T () const
 
Flagoperator= (T v)
 
bool SetValue (const std::string &input)
 Used to set the value of a flag.
 
- Public Member Functions inherited from ola::BaseFlag
 BaseFlag (const char *arg_type, const char *short_opt, const char *help)
 Create a new BaseFlag.
 
char short_opt () const
 Get the flag short option.
 
const char * arg_type () const
 Get the flag argument type.
 
std::string help () const
 Get the flag help string.
 
bool present () const
 Check if the flag was present on the command line. Good for switching behaviour when a flag is used.
 
void MarkAsPresent ()
 Set that the flag was present on the command line.
 
- Public Member Functions inherited from ola::FlagInterface

Additional Inherited Members

- Protected Member Functions inherited from ola::BaseFlag
void ReplaceUnderscoreWithHyphen (char *input)
 
const char * NewCanonicalName (const char *name)
 

Constructor & Destructor Documentation

◆ Flag()

template<typename T >
ola::Flag< T >::Flag ( const char * name,
const char * arg_type,
const char * short_opt,
T default_value,
const char * help,
const bool has_arg )
inline

Create a new Flag.

Parameters
namethe name of the flag
arg_typethe type of flag argument
short_optthe short option for the flag
default_valuethe flag's default value
helpthe help string for the flag
has_argif the flag should use an argument, only overrides Flag<bool>

Member Function Documentation

◆ has_arg()

template<typename T >
bool ola::Flag< T >::has_arg ( ) const
inlinevirtual

Whether the flag requires an argument.

Implements ola::FlagInterface.

◆ name()

template<typename T >
const char * ola::Flag< T >::name ( ) const
inlinevirtual

Get the flag name.

Implements ola::FlagInterface.


The documentation for this class was generated from the following file: