本文整理汇总了C++中ArgParse::geterror方法的典型用法代码示例。如果您正苦于以下问题:C++ ArgParse::geterror方法的具体用法?C++ ArgParse::geterror怎么用?C++ ArgParse::geterror使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgParse
的用法示例。
在下文中一共展示了ArgParse::geterror方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
&Mcam[2][0], &Mcam[2][1], &Mcam[2][2], &Mcam[2][3],
&Mcam[3][0], &Mcam[3][1], &Mcam[3][2], &Mcam[3][3],
"Set the camera matrix",
"--Mscreen %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
&Mscr[0][0], &Mscr[0][1], &Mscr[0][2], &Mscr[0][3],
&Mscr[1][0], &Mscr[1][1], &Mscr[1][2], &Mscr[1][3],
&Mscr[2][0], &Mscr[2][1], &Mscr[2][2], &Mscr[2][3],
&Mscr[3][0], &Mscr[3][1], &Mscr[3][2], &Mscr[3][3],
"Set the screen matrix",
"--hash", NULL, "",
"--prman-metadata", &prman_metadata, "Add prman specific metadata",
"--constant-color-detect", &constant_color_detect, "Create 1-tile textures from constant color inputs",
"--monochrome-detect", &monochrome_detect, "Create 1-channel textures from monochrome inputs",
"--opaque-detect", &opaque_detect, "Drop alpha channel that is always 1.0",
"--ignore-unassoc", &ignore_unassoc, "Ignore unassociated alpha tags in input (don't autoconvert)",
"--stats", &stats, "Print runtime statistics",
"--mipimage %L", &mipimages, "Specify an individual MIP level",
"<SEPARATOR>", "Basic modes (default is plain texture):",
"--shadow", &shadowmode, "Create shadow map",
"--envlatl", &envlatlmode, "Create lat/long environment map",
"--lightprobe", &lightprobemode, "Create lat/long environment map from a light probe",
// "--envcube", &envcubemode, "Create cubic env map (file order: px, nx, py, ny, pz, nz) (UNIMP)",
"<SEPARATOR>", colortitle_help_string().c_str(),
"--colorconvert %s %s", &incolorspace, &outcolorspace,
colorconvert_help_string().c_str(),
"--unpremult", &unpremult, "Unpremultiply before color conversion, then premultiply "
"after the color conversion. You'll probably want to use this flag "
"if your image contains an alpha channel.",
"<SEPARATOR>", "Configuration Presets",
"--prman", &prman, "Use PRMan-safe settings for tile size, planarconfig, and metadata.",
"--oiio", &oiio, "Use OIIO-optimized settings for tile size, planarconfig, metadata.",
NULL);
if (ap.parse (argc, (const char**)argv) < 0) {
std::cerr << ap.geterror() << std::endl;
ap.usage ();
exit (EXIT_FAILURE);
}
if (help || filenames.empty()) {
ap.usage ();
exit (EXIT_FAILURE);
}
int optionsum = ((int)shadowmode + (int)envlatlmode + (int)envcubemode +
(int)lightprobemode);
if (optionsum > 1) {
std::cerr << "maketx ERROR: At most one of the following options may be set:\n"
<< "\t--shadow --envlatl --envcube --lightprobe\n";
ap.usage ();
exit (EXIT_FAILURE);
}
if (optionsum == 0)
mipmapmode = true;
if (prman && oiio) {
std::cerr << "maketx ERROR: '--prman' compatibility, and '--oiio' optimizations are mutually exclusive.\n";
std::cerr << "\tIf you'd like both prman and oiio compatibility, you should choose --prman\n";
std::cerr << "\t(at the expense of oiio-specific optimizations)\n";
ap.usage ();
exit (EXIT_FAILURE);
}
if (filenames.size() != 1) {
std::cerr << "maketx ERROR: requires exactly one input filename\n";
exit (EXIT_FAILURE);
}
示例2: options_parse
static void options_parse(int argc, const char **argv)
{
options.width = 0;
options.height = 0;
options.filepath = "";
options.session = NULL;
options.quiet = false;
/* device names */
string device_names = "";
string devicename = "cpu";
bool list = false;
vector<DeviceType>& types = Device::available_types();
foreach(DeviceType type, types) {
if(device_names != "")
device_names += ", ";
device_names += Device::string_from_type(type);
}
/* shading system */
string ssname = "svm";
/* parse options */
ArgParse ap;
bool help = false;
ap.options ("Usage: cycles [options] file.xml",
"%*", files_parse, "",
"--device %s", &devicename, ("Devices to use: " + device_names).c_str(),
#ifdef WITH_OSL
"--shadingsys %s", &ssname, "Shading system to use: svm, osl",
#endif
"--background", &options.session_params.background, "Render in background, without user interface",
"--quiet", &options.quiet, "In background mode, don't print progress messages",
"--samples %d", &options.session_params.samples, "Number of samples to render",
"--output %s", &options.session_params.output_path, "File path to write output image",
"--threads %d", &options.session_params.threads, "CPU Rendering Threads",
"--width %d", &options.width, "Window width in pixel",
"--height %d", &options.height, "Window height in pixel",
"--list-devices", &list, "List information about all available devices",
"--help", &help, "Print help message",
NULL);
if(ap.parse(argc, argv) < 0) {
fprintf(stderr, "%s\n", ap.geterror().c_str());
ap.usage();
exit(EXIT_FAILURE);
}
else if(list) {
vector<DeviceInfo>& devices = Device::available_devices();
printf("Devices:\n");
foreach(DeviceInfo& info, devices) {
printf(" %s%s\n",
info.description.c_str(),
(info.display_device)? " (display)": "");
}
exit(EXIT_SUCCESS);
}
示例3: options_parse
static void options_parse(int argc, const char **argv)
{
options.width = 0;
options.height = 0;
options.filepath = "";
options.session = NULL;
options.quiet = false;
/* device names */
string device_names = "";
string devicename = "cpu";
bool list = false;
vector<DeviceType>& types = Device::available_types();
/* TODO(sergey): Here's a feedback loop happens: on the one hand we want
* the device list to be printed in help message, on the other hand logging
* is not initialized yet so we wouldn't have debug log happening in the
* device initialization.
*/
foreach(DeviceType type, types) {
if(device_names != "")
device_names += ", ";
device_names += Device::string_from_type(type);
}
/* shading system */
string ssname = "svm";
/* parse options */
ArgParse ap;
bool help = false, debug = false, version = false;
int verbosity = 1;
ap.options ("Usage: cycles [options] file.xml",
"%*", files_parse, "",
"--device %s", &devicename, ("Devices to use: " + device_names).c_str(),
#ifdef WITH_OSL
"--shadingsys %s", &ssname, "Shading system to use: svm, osl",
#endif
"--background", &options.session_params.background, "Render in background, without user interface",
"--quiet", &options.quiet, "In background mode, don't print progress messages",
"--samples %d", &options.session_params.samples, "Number of samples to render",
"--output %s", &options.session_params.output_path, "File path to write output image",
"--threads %d", &options.session_params.threads, "CPU Rendering Threads",
"--width %d", &options.width, "Window width in pixel",
"--height %d", &options.height, "Window height in pixel",
"--list-devices", &list, "List information about all available devices",
#ifdef WITH_CYCLES_LOGGING
"--debug", &debug, "Enable debug logging",
"--verbose %d", &verbosity, "Set verbosity of the logger",
#endif
"--help", &help, "Print help message",
"--version", &version, "Print version number",
NULL);
if(ap.parse(argc, argv) < 0) {
fprintf(stderr, "%s\n", ap.geterror().c_str());
ap.usage();
exit(EXIT_FAILURE);
}
if(debug) {
util_logging_start();
util_logging_verbosity_set(verbosity);
}
if(list) {
vector<DeviceInfo>& devices = Device::available_devices();
printf("Devices:\n");
foreach(DeviceInfo& info, devices) {
printf(" %-10s%s%s\n",
Device::string_from_type(info.type).c_str(),
info.description.c_str(),
(info.display_device)? " (display)": "");
}
exit(EXIT_SUCCESS);
}
示例4: main
int main(int argc, const char **argv)
{
bool help = false;
int errorcount = 0;
std::string inputconfig;
std::string outputconfig;
ArgParse ap;
ap.options("ociocheck -- validate an OpenColorIO configuration\n\n"
"usage: ociocheck [options]\n",
"--help", &help, "Print help message",
"--iconfig %s", &inputconfig, "Input .ocio configuration file (default: $OCIO)",
"--oconfig %s", &outputconfig, "Output .ocio file",
NULL);
if (ap.parse(argc, argv) < 0)
{
std::cout << ap.geterror() << std::endl;
ap.usage();
std::cout << DESC_STRING;
return 1;
}
if (help)
{
ap.usage();
std::cout << DESC_STRING;
return 1;
}
try
{
OCIO::ConstConfigRcPtr config;
std::cout << std::endl;
std::cout << "OpenColorIO Library Version: " << OCIO::GetVersion() << std::endl;
std::cout << "OpenColorIO Library VersionHex: " << OCIO::GetVersionHex() << std::endl;
if(!inputconfig.empty())
{
std::cout << "Loading " << inputconfig << std::endl;
config = OCIO::Config::CreateFromFile(inputconfig.c_str());
}
else if(getenv("OCIO"))
{
std::cout << "Loading $OCIO " << getenv("OCIO") << std::endl;
config = OCIO::Config::CreateFromEnv();
}
else
{
std::cout << "ERROR: You must specify an input OCIO configuration ";
std::cout << "(either with --iconfig or $OCIO).\n";
ap.usage ();
std::cout << DESC_STRING;
return 1;
}
std::cout << std::endl;
std::cout << "** General **" << std::endl;
std::cout << "Search Path: " << config->getSearchPath() << std::endl;
std::cout << "Working Dir: " << config->getWorkingDir() << std::endl;
std::cout << std::endl;
std::cout << "Default Display: " << config->getDefaultDisplay() << std::endl;
std::cout << "Default View: " << config->getDefaultView(config->getDefaultDisplay()) << std::endl;
{
std::cout << std::endl;
std::cout << "** Roles **" << std::endl;
std::set<std::string> usedroles;
const char * allroles[] = { OCIO::ROLE_DEFAULT, OCIO::ROLE_SCENE_LINEAR,
OCIO::ROLE_DATA, OCIO::ROLE_REFERENCE,
OCIO::ROLE_COMPOSITING_LOG, OCIO::ROLE_COLOR_TIMING,
OCIO::ROLE_COLOR_PICKING,
OCIO::ROLE_TEXTURE_PAINT, OCIO::ROLE_MATTE_PAINT,
NULL };
int MAXROLES=256;
for(int i=0;i<MAXROLES; ++i)
{
const char * role = allroles[i];
if(!role) break;
usedroles.insert(role);
OCIO::ConstColorSpaceRcPtr cs = config->getColorSpace(role);
if(cs)
{
std::cout << cs->getName() << " (" << role << ")" << std::endl;
}
else
{
std::cout << "ERROR: NOT DEFINED" << " (" << role << ")" << std::endl;
errorcount += 1;
}
}
for(int i=0; i<config->getNumRoles(); ++i)
{
const char * role = config->getRoleName(i);
if(usedroles.find(role) != usedroles.end()) continue;
//.........这里部分代码省略.........