7#ifndef ARGS__MULTI_ARG_HPP__INCLUDED
8#define ARGS__MULTI_ARG_HPP__INCLUDED
93 if (!m_defaultValues.empty()) {
94 return m_defaultValues.front();
104 m_defaultValues.push_back(v);
111 return m_defaultValues;
160 std::forward<T>(
name),
194 if (!m_values.empty()) {
195 return m_values.front();
196 }
else if (!m_defaultValues.empty()) {
197 return m_defaultValues.front();
205 m_values.push_back(v);
211 if (!m_values.empty()) {
214 return m_defaultValues;
222 }
else if (!m_values.empty()) {
223 return m_values.size();
225 return m_defaultValues.size();
234 String(
SL(
"Argument \"")) +
name() +
SL(
"\" requires value that wasn't presented."),
const String & flag() const override
String name() const override
bool isRequired() const override
Arg & setDefined(bool on=true)
Set defined.
bool isWithValue() const override
Arg(Char flag, T &&name, bool isWithValue=false, bool isRequired=false)
Construct argument with flag and name.
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...
const String & defaultValue() const override
ArgType type() const override
const String & value() const override
MultiArg & setValue(const String &v) override
Set value.
void clear() override
Clear state of the argument.
MultiArg & setDefaultValue(const String &v) override
Set default value.
virtual const StringList & values() const
MultiArg & setDefaultValues(const StringList &v)
Set default values.
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.
ArgType
Type of the argument.
@ MultiArg
Multi argument.
String::value_type Char
Char type.
bool eatValues(Ctx &context, Container &container, const String &errorDescription, Cmd *cmdLine)
Eat values in context.
std::vector< String > StringList
List of strings.
static const String c_string
#define DISABLE_COPY(Class)
Macro for disabling copy.