8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
43 #if !ALIB_CHARACTERS_WIDE
46 for (
int i= 1; i <
ARG_C ; ++i )
58 for (
int i= 1; i <
ARG_C ; ++i )
66 #if ALIB_CHARACTERS_NATIVE_WCHAR
69 for (
int i= 1; i <
ARG_C ; ++i )
82 for (
int i= 1; i <
ARG_C ; ++i )
103 auto argNo=
ArgsLeft[size_t(argIdx)];
124 if( option->
Read( **optionDeclIt, arg, argNo ) )
132 (*optionDeclIt)->HelpUsageLine() );
169 for(
auto optionIt=
Options.rbegin() ; optionIt !=
Options.rend() ; optionIt ++ )
170 if( (*optionIt)->Declaration->Element() == element )
179 bool lastCommandFullyParsed=
true;
180 while( lastCommandFullyParsed &&
ArgsLeft.size() > 0 )
189 lastCommandFullyParsed= command->
Read( *commandDecl );
195 commandDecl->HelpTextShort() );
252 ALIB_ERROR(
"CLI",
"Argument number {} already removed.", argNo )
static ALIB_DLL AString GetCommandUsageFormat(CommandLine &cmdLine, CommandDecl &commandDecl)
ALIB_DLL void RemoveArg(integer argNo)
List< MonoAllocator, Option * > Options
The options parsed in the order of their appearance.
virtual ALIB_DLL void ReadOptions()
virtual ALIB_DLL void ReadNextCommands()
List< MonoAllocator, String, Recycling::Shared > OptionArgsIgnored
ALIB_DLL Option * GetOption(Enum element)
List< MonoAllocator, OptionDecl * > OptionDecls
Possible Options.
void Init(camp::Camp *resModule)
StdVectorMono< integer > ArgsLeft
List< MonoAllocator, CommandDecl * > CommandDecls
Commands defined.
NCString ResourceCategory
The resource category to fetch CLI resources within field Resources.
List< MonoAllocator, Command * > CommandsParsed
A list of commands actually parsed. Filled with method ReadNextCommands.
StdVectorMono< String > ArgStrings
List< MonoAllocator, Command * >::iterator NextCommandIt
The next command in CommandsParsed to be processed. Used with method NextCommand.
resources::ResourcePool * Resources
virtual ALIB_DLL String PopArg()
virtual ALIB_DLL Command * NextCommand()
virtual String GetArg(integer idx)
const String & ShortcutReplacementString()
Exception & Add(const lang::CallerInfo &ci, TEnum type, TArgs &&... args)
void DbgDisableBufferReplacementWarning()
TChar CharAtStart() const
constexpr bool IsNotEmpty() const
#define ALIB_CALLER_NULLED
#define ALIB_ERROR(domain,...)
#define ALIB_ASSERT_ERROR(cond, domain,...)
@ ParsingOptions
General option parse error. Adds option help text.
@ ParsingCommand
General parameter parse error. Adds command help text.
@ NoCommandGiven
Unknown command given.
@ UnknownCommand
Unknown command given.
constexpr String NULL_STRING
A nulled string of the default character type.
lang::integer integer
Type alias in namespace alib.
NLocalString< 1024 > NString1K
Type alias name for TLocalString<nchar,1024>.
strings::TCString< nchar > NCString
Type alias in namespace alib.
boxing::Enum Enum
Type alias in namespace alib.
LocalString< 1024 > String1K
Type alias name for TLocalString<character,1024>.
exceptions::Exception Exception
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
A command of a ALib CLI command line.
ALIB_DLL bool Read(CommandDecl &decl)
OptionDecl * Declaration
The declaration struct.
ALIB_DLL bool Read(OptionDecl &decl, String &arg, const integer argNo)
integer ConsumedArguments