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