|
HDK
|
Functions | |
| AttrDelegate< const ParamValueList > | ArgParse::operator[] (string_view name) const |
| Access a single argument result by name. More... | |
| AttrDelegate< ParamValueList > | ArgParse::operator[] (string_view name) |
| Access a single argument result by name. More... | |
| ParamValueList & | ArgParse::params () |
| Directly access the ParamValueList that holds the argument results. More... | |
| const ParamValueList & | ArgParse::cparams () const |
Retrieve arguments in the same manner that you would access them from a OIIO::ParamValueList.
Examples:
// Please see the code example in the "Action library" section above
// for the argument declarations.
// retrieve whether -v flag was set
bool verbose = ap["v"].get<int>();
// Retrieve the parameter passed to --bar, defaulting to 13 if
// never set on the command line:
int bar = ap["bar"].get<int>(13);
// Retrieve the color, which had 3 float parameters. Extract
// it as an Imath::Color3f.
Imath::Color3f diffuse = ap["color"].get<Imath::Color3f>();
// Retrieve the filename list as a vector:
auto filenames = ap["filename"].as_vec<std::string>();
for (auto& f : filenames)
Strutil::printf(" file: \"%s\"\n", f);| const ParamValueList& ArgParse::cparams | ( | ) | const |
Directly access the ParamValueList that holds the argument results (const version).
|
inline |
Access a single argument result by name.
Definition at line 727 of file argparse.h.
|
inline |
Access a single argument result by name.
Definition at line 732 of file argparse.h.
| ParamValueList& ArgParse::params | ( | ) |
Directly access the ParamValueList that holds the argument results.