223 template<
typename TEnum>
241 if ( (*it)->Element() == parameter ) {
245 ALIB_ERROR(
"CLI",
"Parameter '{}' not defined!", parameter)
253 template<
typename TEnum>
272 if ( (*it)->Element() == command ) {
276 ALIB_ERROR(
"CLI",
"Command '{}' not defined!", command)
284 template<
typename TEnum>
302 if ( (*it)->Element() == option ) {
306 ALIB_ERROR(
"CLI",
"Option '{}' not defined!", option)
314 template<
typename TEnum>
321 allocator().New<ExitCodeDecl>(recordIt.Enum()) );
461 "CLI",
"Argument index out of bounds" )
506,
Args ( cmdLine->stringListRecycler ) {}
510,
Args ( cmdLine->stringListRecycler ) {}
512template<
typename TEnum>
#define ALIB_ERROR(domain,...)
#define ALIB_ASSERT_ERROR(cond, domain,...)
ERCommandDecl record
A copy (!) of the enum record.
ListMA< ParameterDecl * > Parameters
Command parameters.
CommandLine & CmdLine
The command-line instance we belong to.
CommandDecl(TEnum element, CommandLine &cmdLine)
ResourceInfo resourceInfo
The resource information of the enumeration type given with construction.
Enum declElement
The enumeration element given with construction.
void RemoveArg(integer argNo)
const String & TryResource(const NString &name)
virtual void ReadOptions()
virtual void ReadNextCommands()
StdVectorMA< integer > ArgsLeft
Option * GetOption(Enum element)
void UndefineCommand(Enum command)
ListMA< String, Recycling::Shared > OptionArgsIgnored
StdVectorMA< String > ArgStrings
void Init(camp::Camp *resModule)
ListMA< CommandDecl * > CommandDecls
Commands defined.
ListMA< Parameter *, Recycling::Shared >::SharedRecyclerType paramListRecycler
MonoAllocator & GetAllocator() noexcept
ListMA< Command * > CommandsParsed
A list of commands actually parsed. Filled with method #"ReadNextCommands".
const String & GetResource(const NString &name)
void UndefineExitCode(Enum exitCode)
CommandLine()
Constructor.
ListMA< String, Recycling::Shared >::SharedRecyclerType stringListRecycler
The element recycler shared between lists of strings.
ListMA< Option * > Options
The options parsed in the order of their appearance.
ListMA< ParameterDecl * > ParameterDecls
Possible Parameters.
NCString ResourceCategory
The resource category to fetch CLI resources within field #"Resources".
virtual ~CommandLine()
Virtual empty destructor.
ListMA< Command * >::iterator NextCommandIt
The next command in #"CommandsParsed" to be processed. Used with method #"NextCommand".
void UndefineOption(Enum option)
ListMA< OptionDecl * > OptionDecls
Possible Options.
void UndefineParameter(Enum parameter)
HashMap< MonoAllocator, Enum, ExitCodeDecl * > ExitCodeDecls
Possible Errors.
resources::ResourcePool * Resources
virtual Command * NextCommand()
virtual String GetArg(integer idx)
typename detail::RecyclingSelector< TRecycling > ::template HookType< MonoAllocator, detail::ListElement< T > > SharedRecyclerType
NCString ResourceCategory
ResourcePool & GetResourcePool()
DryRunModes
Dry run modes.
const RecordsTraits< TEnum >::Type & GetRecord(TEnum element)
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< nchar > NString
Type alias in namespace alib.
strings::TCString< nchar > NCString
Type alias in namespace alib.
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace alib.
cli::CommandLine CommandLine
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
enumrecords::EnumRecords< TEnum > EnumRecords
Type alias in namespace alib.
containers::HashMap< TAllocator, TKey, TMapped, THash, TEqual, THashCaching, TRecycling > HashMap
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
std::vector< T, StdMA< T > > StdVectorMA
Type alias in namespace alib.
boxing::Enum Enum
Type alias in namespace alib.
A command of a ALib CLI command-line.
Command(CommandLine *cmdLine)
ListMA< Parameter *, Recycling::Shared > ParametersMandatory
Mandatory parameters parsed.
ListMA< Parameter *, Recycling::Shared > ParametersOptional
Optional parameters parsed.
ListMA< String, Recycling::Shared > Args
Arguments belonging to this option.
Option(CommandLine *cmdLine)
A declaration for a #"cli::Parameter".
Parameter(CommandLine *cmdLine)
ListMA< String, Recycling::Shared > Args
Arguments belonging to us.
Parsed(CommandLine *cmdLine)
static ForwardIterator begin()
static constexpr ForwardIterator end()