Exemple #1
0
bool isFlagSet(TCLAP::CmdLine& cmdline, const std::string& arg_name)
{
	using namespace TCLAP;

	std::list<Arg*>& args = cmdline.getArgList();
	for (auto& arg : args)
		if (arg->getName() == arg_name) return arg->isSet();
	return false;
}
Exemple #2
0
bool isFlagSet(TCLAP::CmdLine &cmdline, const std::string &arg_name)
{
	using namespace TCLAP;

	std::list<Arg*>& args = cmdline.getArgList();
	for (std::list<Arg*>::iterator it=args.begin();it!=args.end();++it)
		if ( (*it)->getName() == arg_name)
			return (*it)->isSet();
	return false;
}
Exemple #3
0
bool getArgValue(TCLAP::CmdLine &cmdline, const std::string &arg_name, T &out_val)
{
	using namespace TCLAP;

	std::list<Arg*>& args = cmdline.getArgList();
	for (std::list<Arg*>::iterator it=args.begin();it!=args.end();++it)
	{
		if ( (*it)->getName() == arg_name)
		{
			// Is it set? Return the default value anyway:
			TCLAP::ValueArg<T> *arg = static_cast<TCLAP::ValueArg<T> *>(*it);
			out_val = arg->getValue();
			return (*it)->isSet();
		}
	}
	return false;
}
Exemple #4
0
bool getArgValue(
	TCLAP::CmdLine& cmdline, const std::string& arg_name, T& out_val)
{
	using namespace TCLAP;

	std::list<Arg*>& args = cmdline.getArgList();
	for (auto& it : args)
	{
		if (it->getName() == arg_name)
		{
			// Is it set? Return the default value anyway:
			auto* arg = static_cast<TCLAP::ValueArg<T>*>(it);
			out_val = arg->getValue();
			return it->isSet();
		}
	}
	return false;
}