10# if !defined (HPP_ALIB_CLI_CLI)
13# if !defined (HPP_ALIB_CLI_COMMANDLINE)
16# if !defined (HPP_ALIB_STRINGS_UTIL_TOKENIZER)
19# if !defined (HPP_ALIB_ENUMS_RECORDPARSER)
22# if !defined(HPP_ALIB_CAMP_MESSAGE_REPORT)
32namespace alib {
namespace cli {
41 while( tknzr.
Next().IsNotEmpty() )
54 "Parameter named {!Q} not found while loading resources of command {!Q}.",
62 if( param->Name().Equals<
false>( name ) )
80 if( valueSeparator > 0 )
83 bool potentialIllegalContinuation=
false;
102 if( potentialIllegalContinuation )
104 auto nextChar= arg.
CharAt<
false>( identifier.
Length() );
105 if( !isalnum( nextChar ) )
118 if( valueSeparator > 0)
120 Args.PushBack( inArgArgument );
121 if(qtyArgsExpected > 0 )
127 if ( qtyArgsExpected >
integer(qtyArgsLeft) )
130 qtyArgsExpected, qtyArgsLeft );
133 for(
integer i= 0; i < qtyArgsExpected; ++i )
161 bool continueReading= param.
Read( **paramDeclIt );
166 if ( (*paramDeclIt)->IsOptional() )
178 if( !continueReading )
190 if( paramDecl->Name().Equals<
false>(name) )
199 if( param->Declaration->Name().Equals<
false>( name ) )
203 if( param->Declaration->Name().Equals<
false>( 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.PushBack( arg );
248 if( inArgArgument.IsNotEmpty() )
250 Args.PushBack( inArgArgument );
256 if( qtyArgsExpected < 0 )
266 for(
size_t i= 0; i < static_cast<size_t>( qtyArgsExpected ); ++i )
278void ERCommandDecl ::Parse()
285void EROptionDecl ::Parse()
306void ERExitCodeDecl ::Parse()
309 ERSerializable::MinimumRecognitionLength = 0;
ALIB_API void addParamDecls()
const String & Identifier()
List< ParameterDecl * > Parameters
int MinimumRecognitionLength()
ALIB_API ParameterDecl * GetParameterDecl(const String &name)
List< ParameterDecl * > ParameterDecls
virtual String GetArg(integer idx)
virtual ALIB_API String PopArg()
std::vector< integer, StdContMA< integer > > ArgsLeft
const String & Identifier()
const String & ValueSeparator()
int MinimumRecognitionLength()
character IdentifierChar()
integer QtyExpectedArgsFollowing()
const String & Identifier()
int QtyExpectedArgsFollowing()
const String & ValueSeparator()
int MinimumRecognitionLength()
ALIB_FORCE_INLINE T * Emplace(TArgs &&... args)
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.
constexpr String NullString()
characters::character character
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
List< Parameter *, Recycling::Shared > ParametersOptional
ALIB_API Parameter * GetParsedParameter(const String &name)
List< Parameter *, Recycling::Shared > ParametersMandatory
ALIB_API bool Read(CommandDecl &decl)
ALIB_API String GetParsedParameterArg(const String &name)
CommandDecl * Declaration
int qtyExpectedArgsFollowing
ALIB_API bool Read(OptionDecl &decl, String &arg, const integer argNo)
List< String, Recycling::Shared > Args
ALIB_API bool Read(ParameterDecl &decl)
List< String, Recycling::Shared > Args
ParameterDecl * Declaration
static ALIB_API void Get(String &result, bool isLastField=false)