31#ifndef ARGS__MULTI_ARG_HPP__INCLUDED
32#define ARGS__MULTI_ARG_HPP__INCLUDED
62 template<
typename T >
83 template<
typename T >
113 size_t count()
const;
118 if( !m_defaultValues.empty() )
119 return m_defaultValues.front();
128 m_defaultValues.push_back( v );
134 return m_defaultValues;
177template<
typename T >
179 bool isWithValue,
bool isRequired )
180 :
Arg( flag, std::forward< T > ( name ), isWithValue, isRequired )
187 bool isWithValue,
bool isRequired )
188 :
Arg( flag, isWithValue, isRequired )
193template<
typename T >
195 bool isWithValue,
bool isRequired )
196 :
Arg( std::forward< T > ( name ), isWithValue, isRequired )
209 if( !m_values.empty() )
210 return m_values.front();
211 else if( !m_defaultValues.empty() )
212 return m_defaultValues.front();
220 m_values.push_back( v );
226 if( !m_values.empty() )
229 return m_defaultValues;
237 else if( !m_values.empty() )
238 return m_values.size();
240 return m_defaultValues.size();
250 name() +
SL(
"\" requires value that wasn't presented." ),
Argument with one value that can be present only once in the command line.
const String & flag() const override
String name() const override
bool isRequired() const override
bool isWithValue() const override
void setDefined(bool on=true)
Set defined.
CmdLine * cmdLine() const
Context is a list of words in the command line that user presented with interface for interacting wit...
MultiArg is a class that presents argument in the command line taht can be presented more than once o...
void setDefaultValue(const String &v) override
const String & defaultValue() const override
ArgType type() const override
const String & value() const override
void setValue(const String &v) override
Set value.
void setDefaultValues(const StringList &v)
Set default values.
void clear() override
Clear state of the argument.
virtual const StringList & values() const
void process(Context &context) override
Process argument's staff, for example take values from context.
const StringList & defaultValues() const
MultiArg(Char flag, T &&name, bool isWithValue=false, bool isRequired=false)
Construct argument with flag and name.
std::string String
String type.
std::vector< String > StringList
List of strings.
ArgType
Type of the argument.
@ MultiArg
Multi argument.
bool eatValues(Ctx &context, Container &container, const String &errorDescription, Cmd *cmdLine)
Eat values in context.
String::value_type Char
Char type.
#define DISABLE_COPY(Class)
Macro for disabling copy.