31#ifndef ARGS__GROUP_IFACE_HPP__INCLUDED
32#define ARGS__GROUP_IFACE_HPP__INCLUDED
64 using ArgPtr = std::unique_ptr< ArgIface, details::Deleter< ArgIface > >;
68 template<
typename T >
70 bool required =
false )
71 : m_name( std::forward< T > (
name ) )
72 , m_required( required )
174 [ & ] (
const auto & ch ) { ch->clear(); } );
230 arg->checkCorrectnessBeforeParsing( flags, names );
237 arg->checkCorrectnessAfterParsing();
241 String(
SL(
"Not defined required argument \"" ) ) +
264 [ & ] (
const auto & ch )
266 if( ch->isMisspelledName(
name, possibleNames ) )
virtual ArgIface * findArgument(const String &name)=0
virtual void setCmdLine(CmdLine *cmdLine)
Set command line parser.
CmdLine * cmdLine() const
virtual bool isDefined() const =0
Base exception of the library.
CmdLine is class that holds all rguments and parse command line arguments in the correspondence with ...
Context is a list of words in the command line that user presented with interface for interacting wit...
Interface for the groups.
const String & description() const override
void setCmdLine(CmdLine *cmdLine) override
Set command line parser.
String name() const override
bool isRequired() const override
std::unique_ptr< ArgIface, details::Deleter< ArgIface > > ArgPtr
Smart pointer to the argument.
virtual void addArg(ArgPtr arg)
Add argument.
const String & flag() const override
const String & valueSpecifier() const override
virtual void setRequired(bool on=true)
Set required flag.
bool isWithValue() const override
void process(Context &) override
Process argument's staff, for example take values from context.
void clear() override
Clear state of the argument.
Arguments m_children
List of children.
const Arguments & children() const
bool isMisspelledName(const String &name, StringList &possibleNames) const override
void addArg(ArgIface &arg)
Add argument.
const String & argumentName() const override
std::vector< ArgPtr > Arguments
List of child arguments.
const String & longDescription() const override
void checkCorrectnessBeforeParsing(StringList &flags, StringList &names) const override
Check correctness of the argument before parsing.
GroupIface(T &&name, bool required=false)
ArgIface * findArgument(const String &name) override
void checkCorrectnessAfterParsing() const override
Check correctness of the argument after parsing.
void addArg(ArgIface *arg)
Add argument.
constexpr std::add_const< T >::type & asConst(T &t) noexcept
Adds const to non-const objects.
std::string String
String type.
std::vector< String > StringList
List of strings.
#define DISABLE_COPY(Class)
Macro for disabling copy.