GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::cli Namespace Reference

Classes

struct  Error
 Base exception type for errors originating from the command line interface. More...
struct  Help
 Exception type thrown by the command line interface containing a help string that was requested by the user. More...
struct  InvalidUsage
 Exception type thrown by the command line interface when an incorrect number of arguments were provided. More...
struct  InvalidArgument
 Exception type thrown by the command line interface when an invalid argument value was provided. More...
struct  UnknownOption
 Exception type thrown by the command line interface when an unknown option was specified. More...
struct  InvalidOptionValue
 Exception type thrown by the command line interface when an invalid option value was provided. More...
class  Proxy
 Proxy type for making command line option fields that reference other values. More...
struct  CommandLineParserOptions
 Configuration options for command line parsing. More...

Functions

template<detail::boolean_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into a boolean value.
template<detail::integer_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into an integer value.
template<detail::character_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into a character value.
template<detail::float_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into a single-precision floating-point value.
template<detail::double_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into a double-precision floating-point value.
template<detail::quantity_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into a single-precision floating-point quantity.
template<detail::string_argument T>
void parseArgumentValue (T &output, CStringView argument)
 Parse a command line argument into a string value.
template<typename Rep, typename Period>
void parseArgumentValue (DurationBase< Rep, Period > &output, CStringView argument)
 Parse a command line argument into a duration value.
template<aggregate Arguments, aggregate Options>
requires (default_initializable<Arguments> && default_initializable<Options>)
ArrayList< CStringView > parseCommandLine (Arguments &outputArguments, Options &outputOptions, Span< const CStringView > command, const CommandLineParserOptions &options={})
 Parse a command line into arguments and options.
template<aggregate Arguments, aggregate Options>
requires (default_initializable<Arguments> && default_initializable<Options>)
ArrayList< CStringView > parseCommandLine (Arguments &outputArguments, Options &outputOptions, int argc, char *argv[], const CommandLineParserOptions &options={})
 Parse the command line received by main() into arguments and options.
template<aggregate Arguments>
requires (default_initializable<Arguments>)
ArrayList< CStringView > parseCommandLineArguments (Arguments &outputArguments, Span< const CStringView > command, const CommandLineParserOptions &options={})
 Parse a command line into arguments.
template<aggregate Arguments>
requires (default_initializable<Arguments>)
ArrayList< CStringView > parseCommandLineArguments (Arguments &outputArguments, int argc, char *argv[], const CommandLineParserOptions &options={})
 Parse the command line received by main() into arguments.
template<aggregate Options>
requires (default_initializable<Options>)
ArrayList< CStringView > parseCommandLineOptions (Options &outputOptions, Span< const CStringView > command, const CommandLineParserOptions &options={})
 Parse a command line into options.
template<aggregate Options>
requires (default_initializable<Options>)
ArrayList< CStringView > parseCommandLineOptions (Options &outputOptions, int argc, char *argv[], const CommandLineParserOptions &options={})
 Parse the command line received by main() into options.

Function Documentation

◆ parseArgumentValue() [1/8]

template<detail::boolean_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into a boolean value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [2/8]

template<detail::integer_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into an integer value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [3/8]

template<detail::character_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into a character value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [4/8]

template<detail::float_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into a single-precision floating-point value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [5/8]

template<detail::double_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into a double-precision floating-point value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [6/8]

template<detail::quantity_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into a single-precision floating-point quantity.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [7/8]

template<detail::string_argument T>
void grem::cli::parseArgumentValue ( T & output,
CStringView argument )
inline

Parse a command line argument into a string value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
anyexception thrown by the assignment operator of the output type.

◆ parseArgumentValue() [8/8]

template<typename Rep, typename Period>
void grem::cli::parseArgumentValue ( DurationBase< Rep, Period > & output,
CStringView argument )
inline

Parse a command line argument into a duration value.

Parameters
outputvalue to parse the argument into.
argumentargument to parse.
Exceptions
std::invalid_argumenton failure to parse a valid value from the argument.

◆ parseCommandLine() [1/2]

template<aggregate Arguments, aggregate Options>
requires (default_initializable<Arguments> && default_initializable<Options>)
ArrayList< CStringView > grem::cli::parseCommandLine ( Arguments & outputArguments,
Options & outputOptions,
Span< const CStringView > command,
const CommandLineParserOptions & options = {} )

Parse a command line into arguments and options.

Parameters
outputArgumentsuser-defined aggregate of fields to parse as arguments from the command line.
outputOptionsuser-defined aggregate of fields to parse as options from the command line.
commandview over the given command line arguments.
optionsparser options, see CommandLineParserOptions.
Returns
extra arguments that were provided after the CommandLineParserOptions::extraArgumentsSeparator, if any.
Exceptions
cli::Erroron failure to parse the given arguments and/or options.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the assignment operators of the given argument or option fields.

◆ parseCommandLine() [2/2]

template<aggregate Arguments, aggregate Options>
requires (default_initializable<Arguments> && default_initializable<Options>)
ArrayList< CStringView > grem::cli::parseCommandLine ( Arguments & outputArguments,
Options & outputOptions,
int argc,
char * argv[],
const CommandLineParserOptions & options = {} )

Parse the command line received by main() into arguments and options.

Parameters
outputArgumentsuser-defined aggregate of fields to parse as arguments from the command line.
outputOptionsuser-defined aggregate of fields to parse as options from the command line.
argcnumber of arguments in the given command line.
argvpointer to a null-terminated array of pointers to null-terminated strings holding the given command line arguments.
optionsparser options, see CommandLineParserOptions.
Returns
extra arguments that were provided after the CommandLineParserOptions::extraArgumentsSeparator, if any.
Exceptions
cli::Erroron failure to parse the given arguments and/or options.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the assignment operators of the given argument or option fields.

◆ parseCommandLineArguments() [1/2]

template<aggregate Arguments>
requires (default_initializable<Arguments>)
ArrayList< CStringView > grem::cli::parseCommandLineArguments ( Arguments & outputArguments,
Span< const CStringView > command,
const CommandLineParserOptions & options = {} )

Parse a command line into arguments.

Parameters
outputArgumentsuser-defined aggregate of fields to parse as arguments from the command line.
commandview over the given command line arguments.
optionsparser options, see CommandLineParserOptions.
Returns
extra arguments that were provided after the CommandLineParserOptions::extraArgumentsSeparator, if any.
Exceptions
cli::Erroron failure to parse the given arguments.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the assignment operators of the given argument fields.

◆ parseCommandLineArguments() [2/2]

template<aggregate Arguments>
requires (default_initializable<Arguments>)
ArrayList< CStringView > grem::cli::parseCommandLineArguments ( Arguments & outputArguments,
int argc,
char * argv[],
const CommandLineParserOptions & options = {} )

Parse the command line received by main() into arguments.

Parameters
outputArgumentsuser-defined aggregate of fields to parse as arguments from the command line.
argcnumber of arguments in the given command line.
argvpointer to a null-terminated array of pointers to null-terminated strings holding the given command line arguments.
optionsparser options, see CommandLineParserOptions.
Returns
extra arguments that were provided after the CommandLineParserOptions::extraArgumentsSeparator, if any.
Exceptions
cli::Erroron failure to parse the given arguments.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the assignment operators of the given argument fields.

◆ parseCommandLineOptions() [1/2]

template<aggregate Options>
requires (default_initializable<Options>)
ArrayList< CStringView > grem::cli::parseCommandLineOptions ( Options & outputOptions,
Span< const CStringView > command,
const CommandLineParserOptions & options = {} )

Parse a command line into options.

Parameters
outputOptionsuser-defined aggregate of fields to parse as options from the command line.
commandview over the given command line arguments.
optionsparser options, see CommandLineParserOptions.
Returns
extra arguments that were provided after the CommandLineParserOptions::extraArgumentsSeparator, if any.
Exceptions
cli::Erroron failure to parse the given options.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the assignment operators of the given option fields.

◆ parseCommandLineOptions() [2/2]

template<aggregate Options>
requires (default_initializable<Options>)
ArrayList< CStringView > grem::cli::parseCommandLineOptions ( Options & outputOptions,
int argc,
char * argv[],
const CommandLineParserOptions & options = {} )

Parse the command line received by main() into options.

Parameters
outputOptionsuser-defined aggregate of fields to parse as options from the command line.
argcnumber of arguments in the given command line.
argvpointer to a null-terminated array of pointers to null-terminated strings holding the given command line arguments.
optionsparser options, see CommandLineParserOptions.
Returns
extra arguments that were provided after the CommandLineParserOptions::extraArgumentsSeparator, if any.
Exceptions
cli::Erroron failure to parse the given options.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the assignment operators of the given option fields.