22namespace alib {
namespace cli {
31 while( tknzr.
Next().IsNotEmpty() )
44 "Parameter named {!Q} not found while loading resources of command {!Q}.",
52 if( param->Name().Equals<
NC>( name ) )
70 if( valueSeparator > 0 )
73 bool potentialIllegalContinuation=
false;
92 if( potentialIllegalContinuation )
95 if( !isalnum( nextChar ) )
108 if( valueSeparator > 0)
110 Args.PushBack( inArgArgument );
111 if(argsExpected > 0 )
117 if ( argsExpected >
integer(argsLeft) )
120 argsExpected, argsLeft );
123 for(
integer i= 0; i < argsExpected; ++i )
151 bool continueReading= param.
Read( **paramDeclIt );
156 if ( (*paramDeclIt)->IsOptional() )
168 if( !continueReading )
180 if( paramDecl->Name().Equals<
NC>(name) )
189 if( param->Declaration->Name().Equals<
NC>( name ) )
193 if( param->Declaration->Name().Equals<
NC>( name ) )
202 return param && param->
Args.IsNotEmpty() ? param->
Args.Front()
214 if ( identifier.IsEmpty() && decl.
IsOptional() )
219 if( valueSeparator > 0 )
222 if ( identifier.IsEmpty()
234 Args.PushBack( arg );
240 Args.PushBack( inArgArgument );
246 if( argsExpected < 0 )
256 for(
size_t i= 0; i < size_t( argsExpected ); ++i )
268void ERCommandDecl ::Parse()
275void EROptionDecl ::Parse()
296void ERExitCodeDecl ::Parse()
299 ERSerializable::MinimumRecognitionLength = 0;
ALIB_API void addParamDecls()
ERCommandDecl record
A copy (!) of the enum record.
CommandLine & CmdLine
The command line instance we belong to.
const String & Identifier()
int MinimumRecognitionLength()
ALIB_API ParameterDecl * GetParameterDecl(const String &name)
List< MonoAllocator, ParameterDecl * > Parameters
Command parameters.
List< MonoAllocator, ParameterDecl * > ParameterDecls
Possible Parameters.
virtual String GetArg(integer idx)
StdVectorMono< integer > ArgsLeft
virtual ALIB_API String PopArg()
const String & Identifier()
const String & ValueSeparator()
int MinimumRecognitionLength()
character IdentifierChar()
integer QtyExpectedArgsFollowing()
const String & Identifier()
int QtyExpectedArgsFollowing()
const String & ValueSeparator()
int MinimumRecognitionLength()
constexpr bool IsNull() const
integer IndexOf(TChar needle, integer startIdx=0) const
constexpr bool IsEmpty() const
TChar CharAt(integer idx) const
constexpr bool IsNotEmpty() const
constexpr integer Length() 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_API TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
TSubstring< TChar > Actual
#define ALIB_CALLER_NULLED
#define ALIB_ASSERT_ERROR(cond,...)
@ IllegalOptionNameContinuation
lang::Exception Exception
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
constexpr String NULL_STRING
A nulled string of the default character type.
lang::integer integer
Type alias in namespace alib.
List< MonoAllocator, Parameter *, Recycling::Shared > ParametersMandatory
Mandatory parameters parsed.
ALIB_API Parameter * GetParsedParameter(const String &name)
ALIB_API bool Read(CommandDecl &decl)
ALIB_API String GetParsedParameterArg(const String &name)
List< MonoAllocator, Parameter *, Recycling::Shared > ParametersOptional
Optional parameters parsed.
String parameters
List of parameters attached. Separated by '/'.
bool isOptional
Denotes if this is an optional parameter.
String identifier
The identifier of the parameter.
ALIB_API void Parse()
Implementation of EnumRecordPrototype::Parse.
List< MonoAllocator, String, Recycling::Shared > Args
Arguments belonging to this option.
ALIB_API bool Read(OptionDecl &decl, String &arg, const integer argNo)
A declaration for a cli::Parameter.
List< MonoAllocator, String, Recycling::Shared > Args
Arguments belonging to us.
ALIB_API bool Read(ParameterDecl &decl)
CommandLine * CmdLine
The cli command line.
integer ConsumedArguments
static ALIB_API void Get(String &result, bool isLastField=false)