HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
values of parsed arguments

Functions

AttrDelegate< const
ParamValueList
ArgParse::operator[] (string_view name) const
 Access a single argument result by name. More...
 
AttrDelegate< ParamValueListArgParse::operator[] (string_view name)
 Access a single argument result by name. More...
 
ParamValueListArgParse::params ()
 Directly access the ParamValueList that holds the argument results. More...
 
const ParamValueListArgParse::cparams () const
 

Detailed Description

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);

Function Documentation

const ParamValueList& ArgParse::cparams ( ) const

Directly access the ParamValueList that holds the argument results (const version).

AttrDelegate<const ParamValueList> ArgParse::operator[] ( string_view  name) const
inline

Access a single argument result by name.

Definition at line 708 of file argparse.h.

AttrDelegate<ParamValueList> ArgParse::operator[] ( string_view  name)
inline

Access a single argument result by name.

Definition at line 713 of file argparse.h.

ParamValueList& ArgParse::params ( )

Directly access the ParamValueList that holds the argument results.