Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
core.internal.parseoptions
parse configuration options
License:
Source core/internal/parseoptions.d
- struct
MemVal
; - UDA for field treated as memory value
- bool
initConfigOptions
(CFG)(ref CFGcfg
, stringcfgname
); - initialize members of struct CFG from rt_config optionsoptions will be read from the environment, the command line or embedded into the executable as configured (see rt.config) fields of the struct are populated by parseOptions().
- bool
parseOptions
(CFG)(ref CFGcfg
, stringopt
); - initialize members of struct CFG from a string of sub-options.fields of the struct are populated by listing them as space separated sub-options
:value, e.g. "precise:1 profile:1" supported field value types: - strings (without spaces)
- integer types (positive values only)
- bool
- float
- bool
rt_parseOption
(T)(const(char)[]optname
, ref inout(char)[]str
, ref Tres
, const(char)[]errName
); - Parses an individual option
optname
value from a provided stringstr
. The option type is given by the type T of the fieldres
to which the parsed value will be written too. In case of an error,errName
will be used to display an error message and the failure of the parsing will be indicated by a falsy return value.For boolean values, '0/n/N' (false) or '1/y/Y' (true) are accepted.Parameters:const(char)[] optname
name of the option to parse inout(char)[] str
raw string to parse the option value from T res
reference to the resulting data field that the option should be parsed too const(char)[] errName
full-text name of the option which should be displayed in case of errors Returns:false if a parsing error happened.
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Mon Apr 28 06:59:03 2025