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"
45 for(
auto* paramDecl :
CmdLine.ParameterDecls )
54 "Parameter named \"{}\" not found while loading resources of command \"{}\".",
62 if( param->Name().Equals<
NC>( name ) )
74 auto argsLeft =
CmdLine->ArgsLeft.size() -1;
80 if( valueSeparator > 0 )
83 bool potentialIllegalContinuation=
false;
102 if( potentialIllegalContinuation )
105 if( !isalnum( nextChar ) )
107 identifier, argNo,
CmdLine->GetArg(argNo) );
118 if( valueSeparator > 0)
120 Args.push_back( inArgArgument );
121 if(argsExpected > 0 )
127 if ( argsExpected >
integer(argsLeft) )
130 argsExpected, argsLeft );
133 for(
integer i= 0; i < argsExpected; ++i )
161 bool continueReading= param.
Read( **paramDeclIt );
166 if ( (*paramDeclIt)->IsOptional() )
178 if( !continueReading )
190 if( paramDecl->Name().Equals<
NC>(name) )
195 ALIB_ASSERT_ERROR( found,
"CLI",
"Requested parameter \"{}\" not defined.", name )
199 if( param->Declaration->Name().Equals<
NC>( name ) )
203 if( param->Declaration->Name().Equals<
NC>( name ) )
212 return param && param->
Args.IsNotEmpty() ? param->
Args.front()
224 if ( identifier.IsEmpty() && decl.
IsOptional() )
229 if( valueSeparator > 0 )
232 if ( identifier.IsEmpty()
244 Args.push_back( arg );
250 Args.push_back( inArgArgument );
256 if( argsExpected < 0 )
263 argsExpected,
CmdLine->ArgsLeft.size() );
266 for(
size_t i= 0; i < size_t( argsExpected ); ++i )
278void ERCommandDecl ::Parse()
285void EROptionDecl ::Parse()
306void ERExitCodeDecl ::Parse()
309 ERSerializable::MinimumRecognitionLength = 0;
ERCommandDecl record
A copy (!) of the enum record.
CommandLine & CmdLine
The command line instance we belong to.
ALIB_DLL ParameterDecl * GetParameterDecl(const String &name)
int MinimumRecognitionLength()
const String & Identifier()
ALIB_DLL void addParamDecls()
List< MonoAllocator, ParameterDecl * > Parameters
Command parameters.
int MinimumRecognitionLength()
const String & ValueSeparator()
integer QtyExpectedArgsFollowing()
const String & Identifier()
character IdentifierChar()
const String & Identifier()
int MinimumRecognitionLength()
int QtyExpectedArgsFollowing()
const String & ValueSeparator()
constexpr integer Length() const
constexpr bool IsEmpty() const
integer IndexOf(TChar needle, integer startIdx=0) const
TChar CharAt(integer idx) const
constexpr bool IsNotEmpty() const
constexpr bool IsNull() const
bool StartsWith(const TString &needle) const
bool ConsumeString(const TString< TChar > &consumable)
TSubstring & Split(integer position, TSubstring &target, integer separatorWidth=0, bool trim=false)
ALIB_DLL TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
TSubstring< TChar > Actual
#define ALIB_CALLER_NULLED
#define ALIB_ASSERT_ERROR(cond, domain,...)
@ IllegalOptionNameContinuation
constexpr String NULL_STRING
A nulled string of the default character type.
strings::util::TTokenizer< character > Tokenizer
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
exceptions::Exception Exception
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
ALIB_DLL Parameter * GetParsedParameter(const String &name)
ALIB_DLL bool Read(CommandDecl &decl)
ALIB_DLL String GetParsedParameterArg(const String &name)
CommandDecl * Declaration
The underlying declaration.
List< MonoAllocator, Parameter *, Recycling::Shared > ParametersOptional
Optional parameters parsed.
List< MonoAllocator, Parameter *, Recycling::Shared > ParametersMandatory
Mandatory parameters parsed.
String parameters
List of parameters attached. Separated by '/'.
int associatedCLIException
The CLI module exception associated to this exit code.
integer RequiredArguments
String shortcutReplacementString
ALIB_DLL void Parse()
Implementation of EnumRecordPrototype::Parse.
String identifier
The identifier of the parameter.
bool isOptional
Denotes if this is an optional parameter.
List< MonoAllocator, String, Recycling::Shared > Args
Arguments belonging to this option.
OptionDecl * Declaration
The declaration struct.
ALIB_DLL bool Read(OptionDecl &decl, String &arg, const integer argNo)
A declaration for a cli::Parameter.
ParameterDecl * Declaration
The underlying declaration.
List< MonoAllocator, String, Recycling::Shared > Args
Arguments belonging to us.
ALIB_DLL bool Read(ParameterDecl &decl)
integer ConsumedArguments
CommandLine * CmdLine
The cli command line.
static ALIB_DLL void Get(String &result, bool isLastField=false)