ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
cliargtypes.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_app of the \aliblong.
4///
5/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib::app {
9
10class CommandLine;
11
12//==================================================================================================
13/// Exceptions of module #"alib::app;2".
14/// As usual with class #"exc Exception", some of the exceptions are "inner exceptions"
15/// that are caught internally and re-thrown with more information and a different exception code.
16///
17/// The in this respect "external" exceptions that have to be caught by users of the library, are:
18///
19/// - #"%NoCommandGiven",
20/// - #"%UnknownCommand",
21/// - #"%ParsingOptions" and
22/// - #"%ParsingCommand".
23//==================================================================================================
24enum class CLIExceptions {
25 // main exceptions to be handled by the user
26 NoCommandGiven = 1, ///< Unknown command given.
27 UnknownCommand = 2, ///< Unknown command given.
28 ParsingOptions =10, ///< General option parse error. Adds option help text.
29 ParsingCommand =20, ///< General parameter parse error. Adds command help text.
30
31 // inner exceptions
32 MissingOptionValue =11, ///< Missing argument when reading option.
33 ///< (Will be generalized with ParsingOptions.)
34 IllegalOptionNameContinuation =12, ///< An option was given in long name, but continued after
35 ///< its name in an undefined way.
36 ///< (Will be generalized with ParsingOptions.)
37
38 MissingParameterValue =21, ///< Missing argument when reading parameter.
39 ///< (Will be generalized with ParameterError.)
40};
41
42/// Struct used as parent for types
43/// - #"app::Command",
44/// - #"app::Option", and
45/// - #"app::Parameter".
46///
47/// Stores
48/// - a pointer to the #"CommandLine" object,
49/// - the position in #"ARG_VN;2", respectively #"ARG_VW;2" where the object was found, and
50/// - the number of arguments consumed when reading the object.
51///
52/// \note
53/// For technical reasons, other members that are shared between the derived types named above,
54/// have to be declared (each three times) with the types themselves.
55struct Parsed {
56 /// The cli command-line.
58
59 /// The index in #"ARG_VN", respectively #"ARG_VW;2", that this instance (derived option
60 /// or parameter) was found at.
62
63 /// The number of command-line arguments that a command consumed. This includes the command name
64 /// itself. If the method \b Read of derived types leaves this to <c>0</c>, then the option or
65 /// parameter was not found.
67
68 /// Constructor
69 /// @param cmdLine The command-line instance.
70 Parsed( CommandLine* cmdLine )
71 : CmdLine (cmdLine)
72 , Position ((std::numeric_limits<integer>::max)())
73 , ConsumedArguments(0) {}
74};
75
76
77//##################################################################################################
78// Decl and Def versions of commands, options, parameters and ExitCodes
79//##################################################################################################
80
81
82/// #"alib_enums_records;ALib Enum Record" type used by class #"ParameterDecl".
84 /// The identifier of the parameter.
86
87 /// An optional separator string (usually "=") that separates the parameter name from a
88 /// value given within the parameter itself.
90
91 /// A separator character for parsing multiple values.
92 /// If set to <c>'C'</c>, method #"ParameterDecl::ValueListSeparator;*" will return
93 /// <c>','</c> instead.
95
96 /// The number of arguments to consume and store in #"Parameter::Args;*".
97 /// If negative, parsing stops. If previous field, separator string is set and this
98 /// value is equal or greater to \c 1, then a missing separator string leads to
99 /// a parsing exception.
101
102 /// Denotes if this is an optional parameter.
104
105 /// Default constructor leaving the record undefined. (Implementation required as documented
106 /// #"EnumRecordPrototype();here".)
107 ERParameterDecl() noexcept =default;
108
109 /// Implementation of #"EnumRecordPrototype::Parse;*".
111 void Parse();
112 };
113
114/// A parameter of a #"CommandDecl".
115///
116/// Construction is done by passing a custom enum element of an enum type equipped with
117/// #"alib_enums_records;ALib Enum Records" of type #"ERParameterDecl".
118///
119/// When bootstrapping, the method #"CommandLine::DefineParameters;*" has to be invoked for (each)
120/// enum type.
122 protected:
123 /// The enumeration element given with construction.
125
126 /// A copy (!) of the enum record.
128
129 /// The resource information of the enumeration type given with construction.
131
132 public:
133 /// Templated constructor which takes an enum element of a custom type equipped with
134 /// #"alib_enums_records;ALib Enum Records" of type #"ERParameterDecl".
135 ///
136 /// @tparam TEnum C++ enum type equipped with corresponding \alib Enum Records.
137 /// @param element The enum element
138 template<typename TEnum>
139 ParameterDecl( TEnum element )
140 : declElement( element )
141 , resourceInfo(element) {
142 // make a copy of the resourced record
144
145 // fix separator character
146 if( record.valueListSeparator == 'C' )
147 record.valueListSeparator= ',';
148 }
149
150 /// Returns the type and integral value of the enumeration element used with construction.
151 /// @return The enumeration element used with construction.
152 const Enum& Element() const { return declElement; }
153
154 /// Returns the name of the parameter. This is not the identifier. The name is just for
155 /// help and configuration output.
156 ///
157 /// \see Method #".Identifier".
158 ///
159 /// @return The name of the enum element.
160 const String& Name() { return record.EnumElementName; }
161
162 /// Returns the identifier of the parameter. If this is empty, the parameter is not optional
163 /// and hence has no identifier.
164 ///
165 /// @return The name of the enum element.
166 const String& Identifier() { return record.identifier; }
167
168 /// Returns the minimum parse length of the identifier.
169 /// @return The minimum characters to satisfy the parameter.
170 int MinimumRecognitionLength() { return record.MinimumRecognitionLength; }
171
172 /// An optional separator string (usually "="), that separates the parameter name from a
173 /// parameter value.
174 /// @return The separator string.
175 const String& ValueSeparator() { return record.valueSeparator; }
176
177 /// A separator character for parsing multiple values.
178 /// @return The separator character.
180 { return record.valueListSeparator != 'C' ? record.valueListSeparator : ','; }
181
182 /// The number of CLI arguments to consume and store in #"Option::Args;*" with method
183 /// #"Parameter::Read;*".
184 ///
185 /// @return The parameter identifier.
186 int QtyExpectedArgsFollowing() { return record.RequiredArguments; }
187
188 /// Returns \c true if the parameter is optional. The information about this attribute is
189 /// used to create help messages and usage format strings only. It does not automatically
190 /// raise an exception if a parameter is not given. Such exception or other error treatment
191 /// is up to the user code.
192 /// @return \c true if the parameter is optional, \c false otherwise.
193 bool IsOptional() { return record.isOptional; }
194
195 /// Returns the short help text.
196 /// Loads the string from #".resourceInfo" using resource name \c "THelpParShtNN",
197 /// where \c NN is the enum element's integral value.
198 /// @return The help text.
200 { return resourceInfo.Get( NString64("THlpParSht_" ) << Name() ALIB_DBG(, true) ); }
201
202 /// Returns the long help text.
203 /// Loads the string from #".resourceInfo" using resource name \c "THelpParLngNN",
204 /// where \c NN is the enum element's integral value.
205 /// @return The help text.
207 { return resourceInfo.Get( String64("THlpParLng_" ) << Name() ALIB_DBG(, true)); }
208}; // ParameterDecl
209
210/// A declaration for a #"app::Parameter".
211struct Parameter : public Parsed {
212 /// The underlying declaration.
214
215 /// Arguments belonging to us.
217
218 /// Constructor
219 /// @param cmdLine The command-line instance.
220 inline
221 Parameter( CommandLine* cmdLine );
222
223 /// Tries to read the object from the front of #"CommandLine::ArgsLeft;*".
224 /// Success is indicated by setting inherited fields #"Parsed::Position;*" and
225 /// #"Parsed::ConsumedArguments;*" to values greater than \c 0.
226 ///
227 /// If it could not be decided if the actual CLI argument contains this parameter, \c false
228 /// is returned to indicate that parsing commands has to stop now.
229 ///
230 /// This is done in the following cases:
231 /// - When #"ParameterDecl::Identifier;*" is empty and the parameter is
232 /// #"ParameterDecl::IsOptional;*" gives \c true.
233 /// - When it was successfully read, but #"ParameterDecl::QtyExpectedArgsFollowing;*"
234 /// is defined \c -1.
235 ///
236 /// See #"CommandLine;ReadNextCommands" for details
237 ///
238 /// @param decl The declaration used for reading
239 /// @return The \c true on success, \c false indicates that parsing has to end here.
241 bool Read( ParameterDecl& decl );
242};
243
244/// #"alib_enums_records;ALib Enum Record" type used by class #"OptionDecl".
246 /// The name of the option as parsed from command-line if single hyphen <c>'-'</c> is used.
247 /// Defined as string to be able to have empty strings, which disables single character
248 /// options.
250
251 /// An optional separator string (usually "=") that separates the option name from a value
252 /// within the first argument itself.
253 /// If this is not given, field #".RequiredArguments" has to be \c 0.
255
256 /// The number of arguments to consume and store in #"Option::Args;*".
257 /// If this field is set and this value is not \c 0, then a missing separator string leads
258 /// to a parsing exception.
260
261 /// If not empty, the argument string will be replaced by this and the search for next options
262 /// continues.
263 /// Note: Shortcut options have to occur earlier in the enumeration's resource definition.
265
266 /// Defaulted constructor leaving the record undefined.
267 /// (Implementation required as documented
268 /// #"EnumRecordPrototype::EnumRecordPrototype();here".)
269 EROptionDecl() noexcept =default;
270
271 /// Implementation of #"EnumRecordPrototype::Parse;*".
273 void Parse();
274};
275
276/// A declaration for an #"app::Option".
277///
278/// Construction is done by passing a custom enum element of an enum type equipped with
279/// #"alib_enums_records;ALib Enum Records" of type #"EROptionDecl".
280///
281/// When bootstrapping, the method #"CommandLine::DefineOptions;*" has to be invoked for (each)
282/// enum type.
284 protected:
285 /// The enumeration element given with construction.
287
288 /// A copy (!) of the enum record.
290
291 /// The resource information of the enumeration type given with construction.
293
294
295 public:
296 /// Templated constructor which takes an enum element of a custom type equipped with
297 /// #"alib_enums_records;ALib Enum Records" of type #"EROptionDecl".
298 ///
299 /// @tparam TEnum C++ enum type equipped with corresponding \alib Enum Records.
300 /// @param element The enum element
301 template<typename TEnum>
302 OptionDecl( TEnum element )
303 : declElement( element )
304 , resourceInfo(element)
305 {
306 // make a copy of the resourced record
308 }
309
310 /// Returns the type and integral value of the enumeration element used with construction.
311 /// @return The enumeration element used with construction.
312 const Enum& Element() const { return declElement; }
313
314 /// Returns the identifier of the option if double hyphen <c>'--'</c> is used.
315 /// @return The option identifier.
316 const String& Identifier() { return record.EnumElementName; }
317
318 /// Returns the minimum parse length of the identifier if double hyphen <c>'--'</c> is used.
319 /// @return The minimum characters to satisfy the option.
320 int MinimumRecognitionLength() { return record.MinimumRecognitionLength; }
321
322 /// Returns the identifier of the option if single hyphen <c>'-'</c> is used.
323 /// @return The option identifier.
325 {
326 return record.identifierChar.IsNotEmpty() ? record.identifierChar.CharAtStart()
327 : '\0';
328 }
329
330 /// An optional separator string (usually "="), that separates the parameter name from a
331 /// parameter value.
332 /// @return The separator string.
333 const String& ValueSeparator() { return record.valueSeparator; }
334
335 /// The number of CLI arguments to consume and store in #"Option::Args;*" with method
336 /// #"Option::Read;*".
337 /// @return The option identifier.
338 integer QtyExpectedArgsFollowing() { return record.RequiredArguments; }
339
340 /// If an option is a shortcut to another one, this string replaces the argument given.
341 /// @return The option identifier.
342 const String& ShortcutReplacementString() { return record.shortcutReplacementString; }
343
344
345 /// Returns a formal description of the usage.
346 /// Loads the string from #".resourceInfo" using resource name \c "TOptUsgNN",
347 /// where \c NN is the enum element's integral value.
348 /// @return The help text.
350 { return resourceInfo.Get( NString64("TOptUsg_" ) << Identifier() ALIB_DBG(, true) ); }
351
352 /// Returns the help text.
353 /// Loads the string from #".resourceInfo" using resource name \c "TOptHlpNN",
354 /// where \c NN is the enum element's integral value.
355 /// @return The help text.
357 { return resourceInfo.Get( NString64("TOptHlp_" ) << Identifier() ALIB_DBG(, true) ); }
358}; // OptionDecl
359
360/// An option of a command-line. Options are read "automatically" using their declaration
361/// information defined with externalized strings (resources) accessed through
362/// #"alib_enums_records;ALib Enum Records" associated with enum elements of enum custom types.
363///
364/// However, such automatic read is limited due to the fact, that the simple values and flags
365/// defined with #"OptionDecl", cannot provide the flexibility needed to perfectly
366/// parse options with a complex syntax.
367///
368/// In this case, the way out is to use custom code that invokes #"ReadOptions"
369/// and then processes all options that may have remaining arguments left in the list.
370/// By using the inherited field #"Parsed::Position", further arguments may be consumed from
371/// #"CommandLine::ArgsLeft".<br>
372/// Note that the term "processing all options" may mean a nested loop.
373/// The outer is over the option types in the field #"CommandLine::Options", the inner is over
374/// the vector of options per type.
375struct Option : public Parsed {
376 /// The declaration struct.
378
379 /// Arguments belonging to this option.
381
382 /// Constructor
383 /// @param cmdLine The command-line main object.
384 inline
385 Option( CommandLine* cmdLine );
386
387 /// Tries to read the object from the current CLI arg(s).
388 /// \note
389 /// Unlike the read methods #"Command::Read;*" and #"Parameter::Read;*", this
390 /// method expects the argument to test not only by number with \p{argNo} but as well
391 /// with string parameter \p{arg}.<br>
392 /// This redundancy is needed to easily implement shortcut options, that just
393 /// replace a shortcut option read to another one, probably with a preset argument included.
394 ///
395 /// @param decl The declaration used for reading.
396 /// @param arg The argument string starting with one or two hyphens.
397 /// @param argNo The position of reading.
398 /// @return The \c true on success, \c false otherwise.
400 bool Read( OptionDecl& decl, String& arg, const integer argNo );
401};
402
403/// #"alib_enums_records;ALib Enum Record" type used by class #"CommandDecl".
405 /// List of parameters attached. Separated by <c>'/'</c>.
407
408 /// Default constructor leaving the record undefined.
409 /// (Implementation required as documented
410 /// #"EnumRecordPrototype();here".)
411 ERCommandDecl() noexcept =default;
412
413 /// Implementation of #"EnumRecordPrototype::Parse;*".
415 void Parse();
416};
417
418/// A declaration for a #"app::Command".
419///
420/// Construction is done by passing a custom enum element of an enum type equipped with
421/// #"alib_enums_records;ALib Enum Records" of type #"ERCommandDecl".
422///
423/// When bootstrapping, method #"CommandLine::DefineCommands;*" has to be invoked for (each)
424/// enum type.
426 protected:
427 /// The enumeration element given with construction.
429
430 /// A copy (!) of the enum record.
432
433 /// The resource information of the enumeration type given with construction.
435
436 public :
437 /// The command-line instance we belong to.
439
440 /// Command parameters.
442
443 /// Templated constructor which takes an enum element of a custom type equipped with
444 /// #"alib_enums_records;ALib Enum Records" of type #"ERCommandDecl".
445 ///
446 /// Field #".Parameters" is filled as specified in the enum record.
447 ///
448 /// @tparam TEnum C++ enum type equipped with corresponding \alib Enum Records.
449 /// @param element The enum element
450 /// @param cmdLine The command-line object. Will be stored.
451 template<typename TEnum>
452 inline
453 CommandDecl( TEnum element, CommandLine& cmdLine );
454
455 /// Returns the type and integral value of the enumeration element used with construction.
456 /// @return The enumeration element used with construction.
457 const Enum& Element() const { return declElement; }
458
459 /// Returns the identifier (name) of the command
460 /// @return The command identifier.
461 const String& Identifier() { return record.EnumElementName; }
462
463 /// Returns the minimum parse length of the identifier.
464 /// @return The minimum characters to satisfy the command to be parsed.
465 int MinimumRecognitionLength() { return record.MinimumRecognitionLength; }
466
467 /// Returns the short version of the help text.
468 /// Loads the string from #".resourceInfo" using resource name \c "THlpCmdShtNN",
469 /// where \c NN is the enum element's integral value.
470 /// @return The help text.
472 { return resourceInfo.Get( NString64("THlpCmdSht_" ) << Identifier() ALIB_DBG(, true) ); }
473
474 /// Returns the long version of the help text.
475 /// Loads the string from #".resourceInfo" using resource name \c "THlpCmdLngNN",
476 /// where \c NN is the enum element's integral value.
477 /// @return The help text.
479 { return resourceInfo.Get( NString64("THlpCmdLng_" ) << Identifier() ALIB_DBG(, true) ); }
480
481 /// Searches in #".Parameters" for the declaration of parameter \p{name}.
482 /// @param name The declaration name of the parameter.
483 /// @return A pointer to the parameter's declaration, \c nullptr if parameter was not
484 /// declared.
486 ParameterDecl* GetParameterDecl(const String& name );
487
488 protected:
489 /// Called from the constructor. Parses field #"ERCommandDecl::parameters;*" of the
490 /// enum record, and loads the corresponding parameters.
492 void addParamDecls();
493};
494
495/// A command argument of the command-line.
496struct Command : public Parsed {
497 /// The underlying declaration.
499
500 /// Mandatory parameters parsed.
502
503 /// Optional parameters parsed.
505
506 /// Constructor
507 /// @param cmdLine The command-line instance.
508 inline
509 Command( CommandLine* cmdLine );
510
511 /// Tries to read the object from the front of #"CommandLine::ArgsLeft;*".
512 /// @param decl The declaration used for reading.
513 /// @return The \c true on success, \c false otherwise.
515 bool Read( CommandDecl& decl );
516
517 /// Searches in #".ParametersMandatory" and #".ParametersOptional" for parameter \p{name}.
518 /// @param name The declaration name of the parameter.
519 /// @return A pointer to the parameter, \c nullptr if parameter was not parsed.
521 Parameter* GetParsedParameter(const String& name );
522
523 /// Searches in #".ParametersMandatory" and #".ParametersOptional" for parameter \p{name} and returns
524 /// its (first) argument.
525 /// @param name The declaration name of the parameter.
526 /// @return The argument string, #"%NULL_STRING" if parameter was not parsed if not given.
528 String GetParsedParameterArg( const String& name );
529};
530
531/// #"alib_enums_records;ALib Enum Record" type used by class #"ExitCodeDecl".
532/// \note Field #"ERSerializable::MinimumRecognitionLength;*" is not read from the string,
533/// but set to fixed value \c 0.
535 /// Default constructor leaving the record undefined.
536 /// (Implementation required as documented
537 /// #"EnumRecordPrototype();here".)
539
540 /// Implementation of #"EnumRecordPrototype::Parse;*". This implementation omits parsing
541 /// the inherited field #"ERSerializable::MinimumRecognitionLength;2".
543 void Parse();
544};
545
546/// An exit-code of a cli application.
547///
548/// Construction is done by passing a custom enum element of an enum type equipped with
549/// #"alib_enums_records;ALib Enum Records" of type #"ERExitCodeDecl".
550///
551/// When bootstrapping, the method #"CommandLine::DefineExitCodes;*" has to be invoked for
552/// (each) enum type.
553///
554/// With the announcment of exit codes to the CLI, these codes can be listed with help output
555/// generated by class #"CLIUtil".
557 protected:
558 /// The enumeration element given with construction.
560
561 /// A copy (!) of the enum record.
563
564 /// The resource information of the enumeration type given with construction.
566
567 public:
568 /// Templated constructor which takes an enum element of a custom type equipped with
569 /// #"alib_enums_records;ALib Enum Records" of type #"ERExitCodeDecl".
570 ///
571 /// @tparam TEnum C++ enum type equipped with corresponding \alib Enum Records.
572 /// @param element The enum element.
573 template<typename TEnum>
574 ExitCodeDecl( TEnum element )
575 : declElement( element )
576 , resourceInfo(element)
577 {
578 // make a copy of the resourced record
580 }
581
582 /// Returns the name of the enum element
583 /// @return The name of the enum element.
584 const String& Name() { return record.EnumElementName; }
585
586 /// Returns the format string associated with this exit-code.
587 /// Loads the string from #".resourceInfo" using resource name \c "TExitNN",
588 /// where \c NN is the enum element's integral value.
589 /// @return The format string.
591 { return resourceInfo.Get( NString64("TExit" ) << declElement.Integral() ALIB_DBG(,true)); }
592};
593
594} // namespace [alib::app]
#define ALIB_DLL
#define ALIB_EXPORT
#define ALIB_DBG(...)
CommandLine & CmdLine
The command-line instance we belong to.
const String & HelpTextLong()
const String & HelpTextShort()
ListMA< ParameterDecl * > Parameters
Command parameters.
ERCommandDecl record
A copy (!) of the enum record.
const Enum & Element() const
CommandDecl(TEnum element, CommandLine &cmdLine)
Definition cli.hpp:508
ResourceInfo resourceInfo
The resource information of the enumeration type given with construction.
const String & Identifier()
Enum declElement
The enumeration element given with construction.
const String & FormatString()
ResourceInfo resourceInfo
The resource information of the enumeration type given with construction.
Enum declElement
The enumeration element given with construction.
const String & Name()
ExitCodeDecl(TEnum element)
ERExitCodeDecl record
A copy (!) of the enum record.
EROptionDecl record
A copy (!) of the enum record.
integer QtyExpectedArgsFollowing()
Enum declElement
The enumeration element given with construction.
ResourceInfo resourceInfo
The resource information of the enumeration type given with construction.
const String & HelpUsageLine()
const Enum & Element() const
const String & Identifier()
OptionDecl(TEnum element)
const String & HelpText()
const String & ValueSeparator()
const String & ShortcutReplacementString()
const String & ValueSeparator()
Enum declElement
The enumeration element given with construction.
const String & Identifier()
const Enum & Element() const
const String & GetHelpTextShort()
ERParameterDecl record
A copy (!) of the enum record.
const String & GetHelpTextLong()
ParameterDecl(TEnum element)
ResourceInfo resourceInfo
The resource information of the enumeration type given with construction.
@ 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.
const RecordsTraits< TEnum >::Type & GetRecord(TEnum element)
Definition records.hpp:182
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace #"%alib".
Definition list.hpp:689
LocalString< 64 > String64
Type alias name for #"TLocalString;TLocalString<character,64>".
lang::integer integer
Type alias in namespace #"%alib".
Definition integers.hpp:149
strings::TString< character > String
Type alias in namespace #"%alib".
Definition string.hpp:2165
characters::nchar nchar
Type alias in namespace #"%alib".
resources::ResourceInfo ResourceInfo
Type alias in namespace #"%alib".
characters::character character
Type alias in namespace #"%alib".
NLocalString< 64 > NString64
Type alias name for #"TLocalString;TLocalString<nchar,64>".
boxing::Enum Enum
Type alias in namespace #"%alib".
Definition enum.hpp:210
CommandDecl * Declaration
The underlying declaration.
ListMA< Parameter *, Recycling::Shared > ParametersMandatory
Mandatory parameters parsed.
ListMA< Parameter *, Recycling::Shared > ParametersOptional
Optional parameters parsed.
Parameter * GetParsedParameter(const String &name)
String GetParsedParameterArg(const String &name)
bool Read(CommandDecl &decl)
Command(CommandLine *cmdLine)
Definition cli.hpp:519
#"alib_enums_records;ALib Enum Record" type used by class #"CommandDecl".
ERCommandDecl() noexcept=default
String parameters
List of parameters attached. Separated by '/'.
void Parse()
Implementation of #"EnumRecordPrototype::Parse;*".
#"alib_enums_records;ALib Enum Record" type used by class #"OptionDecl".
void Parse()
Implementation of #"EnumRecordPrototype::Parse;*".
EROptionDecl() noexcept=default
#"alib_enums_records;ALib Enum Record" type used by class #"ParameterDecl".
ERParameterDecl() noexcept=default
String identifier
The identifier of the parameter.
bool isOptional
Denotes if this is an optional parameter.
void Parse()
Implementation of #"EnumRecordPrototype::Parse;*".
bool Read(OptionDecl &decl, String &arg, const integer argNo)
ListMA< String, Recycling::Shared > Args
Arguments belonging to this option.
OptionDecl * Declaration
The declaration struct.
Option(CommandLine *cmdLine)
Definition cli.hpp:503
A declaration for a #"app::Parameter".
bool Read(ParameterDecl &decl)
ListMA< String, Recycling::Shared > Args
Arguments belonging to us.
ParameterDecl * Declaration
The underlying declaration.
Parameter(CommandLine *cmdLine)
Definition cli.hpp:499
integer ConsumedArguments
CommandLine * CmdLine
The cli command-line.
Parsed(CommandLine *cmdLine)
ERSerializable() noexcept=default
Defaulted constructor leaving the record undefined.