本文整理汇总了C++中tclap::ValueArg::getFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ ValueArg::getFlag方法的具体用法?C++ ValueArg::getFlag怎么用?C++ ValueArg::getFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tclap::ValueArg
的用法示例。
在下文中一共展示了ValueArg::getFlag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usage
void VTOutput::usage(TCLAP::CmdLineInterface& c)
{
std::string s = "";
std::list<TCLAP::Arg*> args = c.getArgList();
//prints unlabeled arument list first
for (TCLAP::ArgListIterator it = args.begin(); it != args.end(); it++)
{
if (typeid(**it)==typeid(TCLAP::UnlabeledValueArg<std::string>))
{
TCLAP::UnlabeledValueArg<std::string> *i = (TCLAP::UnlabeledValueArg<std::string> *) (*it);
s = i->getName();
}
else if (typeid(**it)==typeid(TCLAP::UnlabeledMultiArg<std::string>))
{
TCLAP::UnlabeledMultiArg<std::string> *i = (TCLAP::UnlabeledMultiArg<std::string> *) (*it);
s = i->getName();
}
}
std::clog << c.getProgramName() << " v" << c.getVersion() << "\n\n";
std::clog << "description : " << c.getMessage() << "\n\n";
std::clog << "usage : vt " << c.getProgramName() << " [options] " << s << "\n\n";
//prints rest of arguments
for (TCLAP::ArgListIterator it = args.begin(); it != args.end(); it++)
{
if (it==args.begin())
{
std::clog << "options : ";
}
else
{
std::clog << " ";
}
if (typeid(**it)==typeid(TCLAP::ValueArg<std::string>) ||
typeid(**it)==typeid(TCLAP::ValueArg<uint32_t>) ||
typeid(**it)==typeid(TCLAP::ValueArg<int32_t>) ||
typeid(**it)==typeid(TCLAP::ValueArg<double>) ||
typeid(**it)==typeid(TCLAP::ValueArg<float>))
{
TCLAP::ValueArg<std::string> *i = (TCLAP::ValueArg<std::string> *) (*it);
std::clog << "-" << i->getFlag()
<< " " << i->getDescription() << "\n";
}
else if (typeid(**it)==typeid(TCLAP::SwitchArg))
{
TCLAP::SwitchArg *i = (TCLAP::SwitchArg *) (*it);
std::clog << "-" << i->getFlag()
<< " " << i->getDescription() << "\n";
}
else if (typeid(**it)==typeid(TCLAP::UnlabeledValueArg<std::string>))
{
//ignored
}
else if (typeid(**it)==typeid(TCLAP::UnlabeledMultiArg<std::string>))
{
//ignored
}
else
{
std::clog << "oops, argument type not handled\n";
}
}
std::clog << "\n";
}