当前位置: 首页>>代码示例>>C++>>正文


C++ OptionList类代码示例

本文整理汇总了C++中OptionList的典型用法代码示例。如果您正苦于以下问题:C++ OptionList类的具体用法?C++ OptionList怎么用?C++ OptionList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OptionList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OptionSelection

void
Ex3SuifPass::initialize()
{
    PipelinablePass::initialize();

    OptionList *l;

    // Create grammar for parsing the command line.  This must occur
    // after the parent class's initialize routine has been executed.
    _command_line->set_description("cookbook example #3");

    // Collect optional flags.
    OptionSelection *flags = new OptionSelection(false);

    // -reserve_reg
    l = new OptionList;
    l->add(new OptionLiteral("-reserve_reg"));
    l->add(new OptionString("reg", &reserved_reg_name));
    l->set_description("specifies name of register to reserve");
    flags->add(l);

    // Accept tagged options in any order.
    _command_line->add(new OptionLoop(flags));

    // zero or more file names
    file_names = new OptionString("file name");
    OptionLoop *files =
	new OptionLoop(file_names,
		       "names of optional input and/or output files");
    _command_line->add(files);
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:31,代码来源:suif_pass.cpp

示例2: strlen

JavaAssertions::OptionList*
JavaAssertions::match_package(const char* classname) {
  // Search the package list for any items that apply to classname.  Each
  // sub-package in classname is checked, from most-specific to least, until one
  // is found.
  if (_packages == 0) return 0;

  // Find the length of the "most-specific" package in classname.  If classname
  // does not include a package, length will be 0 which will match items for the
  // default package (from options "-ea:..."  or "-da:...").
  size_t len = strlen(classname);
  for (/* empty */; len > 0 && classname[len] != '/'; --len) /* empty */;

  do {
    assert(len == 0 || classname[len] == '/', "not a package name");
    for (OptionList* p = _packages; p != 0; p = p->next()) {
      if (strncmp(p->name(), classname, len) == 0 && p->name()[len] == '\0') {
        return p;
      }
    }

    // Find the length of the next package, taking care to avoid decrementing
    // past 0 (len is unsigned).
    while (len > 0 && classname[--len] != '/') /* empty */;
  } while (len > 0);

  return 0;
}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:28,代码来源:javaAssertions.cpp

示例3: Protocol

MeterRandom::MeterRandom(std::list<Option> options)
		: Protocol("random")
{
	OptionList optlist;

	_min = 0;
	_max = 40;
	_last = (_max + _min) / 2; /* start in the middle */

	try {
		_min = optlist.lookup_double(options, "min");
	} catch( vz::OptionNotFoundException &e ) {
		_min = 0;
	} catch( vz::VZException &e ) {
		print(log_error, "Min value has to be a floating point number (e.g. '40.0')", name().c_str());
		throw;
	}

	try {
		_max = optlist.lookup_double(options, "max");
	} catch( vz::OptionNotFoundException &e ) {
		_max = 0;
	} catch( vz::VZException &e ) {
		print(log_error, "Max value has to be a floating point number (e.g. '40.0')", name().c_str());
		throw;
	}
}
开发者ID:HelmutK,项目名称:vzlogger,代码行数:27,代码来源:MeterRandom.cpp

示例4: OptionSelection

void
M2aSuifPass::initialize()
{
    OptionList *l;
    OptionLiteral *f;

    PipelinablePass::initialize();

    // Create parse tree for parsing the command line.  This must occur
    // after the parent class's initialize routine has been executed.
    _command_line->set_description(
	"translate Machine-SUIF file to assembly language");

    // Collect optional flags.
    OptionSelection *flags = new OptionSelection(false);

    // -debug level
    l = new OptionList;
    l->add(new OptionLiteral("-debug"));
    l->add(new OptionInt("level", &debuglvl));
    l->set_description("set verbosity level for debugging messages");
    flags->add(l);

    // -all_notes -- print all instruction notes
    f = new OptionLiteral("-all_notes", &m2a.print_all_notes, true);
    f->set_description("force all instruction notes to appear in output");
    flags->add(f);
    
    // -noprint note -- do not print this note
    l = new OptionList;
    l->add(new OptionLiteral("-noprint"));
    nonprinting_notes_option = new OptionString("annotation key");
    l->add(nonprinting_notes_option);
    l->set_description("suppress annotations with given key");
    flags->add(l);

    // -G max -- max byte size of datum in $gp area
    l = new OptionList;
    l->add(new OptionLiteral("-G"));
    l->add(new OptionInt("max", &m2a.Gnum));
    l->set_description("set max byte size of a datum in the $gp area");
    flags->add(l);

    // -stabs -- print with stabs information
    f = new OptionLiteral("-stabs", &m2a.want_stabs, true);
    f->set_description("add stabs debugging information to output");
    flags->add(f);

    // accept flags in any order
    _command_line->add(new OptionLoop(flags));

    // zero or more file names
    file_names_option = new OptionString("file name");
    OptionLoop *files =
	new OptionLoop(file_names_option,
		       "names of optional input and/or output files");
    _command_line->add(files);
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:58,代码来源:suif_pass.cpp

示例5:

inline JavaAssertions::OptionList*
JavaAssertions::match_class(const char* classname) {
  for (OptionList* p = _classes; p != 0; p = p->next()) {
    if (strcmp(p->name(), classname) == 0) {
      return p;
    }
  }
  return 0;
}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:9,代码来源:javaAssertions.cpp

示例6: OptionInt

void SolveFeedbackVariablesPass3::initialize()
{
  PipelinablePass::initialize() ;
  _command_line->set_description("Solves feedback variables") ;
  OptionInt* optionIsSystolic = new OptionInt("IsSystolic", &isSystolic) ;
  OptionList* feedbackArguments = new OptionList() ;
  feedbackArguments->add(optionIsSystolic) ;
  _command_line->add(feedbackArguments) ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:9,代码来源:solve_feedback_variables_pass_2.0_new.cpp

示例7: OptionString

void ExportPass::initialize()
{
  PipelinablePass::initialize() ;
  _command_line->set_description("Add either a system or a module to the repository from the current suif file") ;
  OptionString* directory = new OptionString("Local Dir", &localDirectory) ;
  OptionList* args = new OptionList() ;
  args->add(directory) ;
  _command_line->add(args) ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:9,代码来源:exportPass.cpp

示例8: ApiIF

vz::api::Volkszaehler::Volkszaehler(
	Channel::Ptr ch,
	std::list<Option> pOptions
	)
	: ApiIF(ch)
	, _last_timestamp(0)
{
	OptionList optlist;
	char url[255], agent[255];
	unsigned short curlTimeout = 30; // 30 seconds

/* parse options */
	try {
		_middleware = optlist.lookup_string(pOptions, "middleware");
	} catch (vz::OptionNotFoundException &e) {
		throw;
	} catch (vz::VZException &e) {
		throw;
	}

	try {
		curlTimeout = optlist.lookup_int(pOptions, "timeout");
	} catch (vz::OptionNotFoundException &e) {
	// use default value instead
		curlTimeout = 30; // 30 seconds
	} catch (vz::VZException &e) {
		throw;
	}

/* prepare header, uuid & url */
	sprintf(agent, "User-Agent: %s/%s (%s)", PACKAGE, VERSION, curl_version());     /* build user agent */
	sprintf(url, "%s/data/%s.json", middleware().c_str(), channel()->uuid());                        /* build url */

	_api.headers = NULL;
	_api.headers = curl_slist_append(_api.headers, "Content-type: application/json");
	_api.headers = curl_slist_append(_api.headers, "Accept: application/json");
	_api.headers = curl_slist_append(_api.headers, agent);

	_api.curl = curl_easy_init();
	if (!_api.curl) {
		throw vz::VZException("CURL: cannot create handle.");
	}

	curl_easy_setopt(_api.curl, CURLOPT_URL, url);
	curl_easy_setopt(_api.curl, CURLOPT_HTTPHEADER, _api.headers);
	curl_easy_setopt(_api.curl, CURLOPT_VERBOSE, options.verbosity());
	curl_easy_setopt(_api.curl, CURLOPT_DEBUGFUNCTION, curl_custom_debug_callback);
	curl_easy_setopt(_api.curl, CURLOPT_DEBUGDATA, channel().get());

	// signal-handling in libcurl is NOT thread-safe. so force to deactivated them!
	curl_easy_setopt(_api.curl, CURLOPT_NOSIGNAL, 1);

	// set timeout to 5 sec. required if next router has an ip-change.
	curl_easy_setopt(_api.curl, CURLOPT_TIMEOUT, curlTimeout);
}
开发者ID:DoganA,项目名称:vzlogger,代码行数:55,代码来源:Volkszaehler.cpp

示例9: QVariant

QVariant TableModelVariablesOptions::data(const QModelIndex &index, int role) const
{
	if (_boundTo == NULL)
		return QVariant();

	if (index.column() == 0)
	{
		if (role == Qt::DisplayRole)
		{
			OptionField *option = static_cast<OptionField *>(_boundTo->at(index.row())->get(0));
			string value = option->value()[0];
			return QString::fromUtf8(value.c_str(), value.length());
		}
		else
		{
			return QVariant();
		}
	}
	else
	{
		if (role != Qt::DisplayRole && role != Qt::EditRole)
			return QVariant();

		Option* option = _boundTo->at(index.row())->get(index.column());
		OptionList *list = dynamic_cast<OptionList *>(option);
		if (list == NULL)
			return QVariant("WTF");

		string selected = list->value();
		QString qsSelected = QString::fromUtf8(selected.c_str(), selected.length());

		if (role == Qt::DisplayRole)
			return qsSelected;

		vector<string> items = list->options();
		QStringList qsItems;

		for (int i = 0; i < items.size(); i++)
		{
			string item = items.at(i);
			QString qs = QString::fromUtf8(item.c_str(), item.size());
			qsItems.append(qs);
		}

		QVariant qvSelected = QVariant(qsSelected);
		QVariant qvItems = QVariant(qsItems);

		QList<QVariant> qvValue;
		qvValue.append(qvSelected);
		qvValue.append(qvItems);

		return qvValue;
	}

}
开发者ID:afwild,项目名称:jasp-desktop,代码行数:55,代码来源:tablemodelvariablesoptions.cpp

示例10: _fd

MeterS0::HWIF_UART::HWIF_UART(const std::list<Option> &options) :
	_fd(-1)
{
	OptionList optlist;

	try {
		_device = optlist.lookup_string(options, "device");
	} catch (vz::VZException &e) {
		print(log_error, "Missing device or invalid type", "");
		throw;
	}
}
开发者ID:andig,项目名称:vzlogger,代码行数:12,代码来源:MeterS0.cpp

示例11: OptionString

void MarkRedundantPass::initialize()
{
  PipelinablePass::initialize() ;
  _command_line->set_description("Marks labels as redundant") ;
  OptionString* optionRedundantLabel = new OptionString("Redundant Label",
							&redundantLabel) ;
  OptionInt* doubleOption = new OptionInt("DoubleOrTriple", &doubleOrTriple) ;
  OptionList* arguments = new OptionList() ;
  arguments->add(optionRedundantLabel) ;
  arguments->add(doubleOption) ;
  _command_line->add(arguments) ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:12,代码来源:mark_redundant.cpp

示例12: fail

	//------------------------------------------------------------------------
	void OptimiseTool::doInvoke(const OptionList& toolOptions,
		const Ogre::StringVector& inFileNames, const Ogre::StringVector& outFileNamesArg)
	{
		// Name count has to match, else we have no way to figure out how to apply output
		// names to input files.
		if (!(outFileNamesArg.empty() || inFileNames.size() == outFileNamesArg.size()))
		{
			fail("number of output files must match number of input files.");
		}

		mPosTolerance = mNormTolerance = mUVTolerance = 1e-06f;
		mKeepIdentityTracks = OptionsUtil::isOptionSet(toolOptions, "keep-identity-tracks");
		for (OptionList::const_iterator it = toolOptions.begin(); it != toolOptions.end(); ++it)
		{
			if (it->first == "tolerance")
			{
				mPosTolerance = mNormTolerance = mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "pos_tolerance")
			{
				mPosTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "norm_tolerance")
			{
				mNormTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "uv_tolerance")
			{
				mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
		}


		StringVector outFileNames = outFileNamesArg.empty() ? inFileNames : outFileNamesArg;

		// Process the meshes
		for (size_t i = 0, end = inFileNames.size(); i < end; ++i)
		{
			if (StringUtil::endsWith(inFileNames[i], ".mesh", true))
			{
				processMeshFile(inFileNames[i], outFileNames[i]);
			}
			else if (StringUtil::endsWith(inFileNames[i], ".skeleton", true))
			{
				processSkeletonFile(inFileNames[i], outFileNames[i]);
			}
			else
			{
				warn("unrecognised name ending for file " + inFileNames[i]);
				warn("file skipped.");
			}
		}
	}
开发者ID:xubingyue,项目名称:Ogitor,代码行数:54,代码来源:MmOptimiseTool.cpp

示例13: OptionString

void RemoveModulePass::initialize()
{
    PipelinablePass::initialize() ;
    _command_line->set_description("Remove a module from the repository") ;
    OptionString* name = new OptionString("Module Name", &moduleName) ;
    OptionString* directory = new OptionString("Local Directory",
            &localDirectory) ;
    OptionList* args = new OptionList() ;
    args->add(name) ;
    args->add(directory) ;
    _command_line->add(args) ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:12,代码来源:removeModulePass.cpp

示例14: generate

Playlist Generator::generate(OptionList optionList)
{
  //Recupération d'une pool de morceaux
  TrackPool pool = db.select(optionList,optionList.getSize()*POOL_SIZE_FACTOR);
  selectionFeedback.notifyAll(pool.size(), pool);
  Playlist playlist;
  if(pool.size() == 0)
    return playlist;
  //On lance la génération
  generationLoop(&playlist, pool, optionList.getSize());
  return playlist;
}
开发者ID:NoZip,项目名称:soundcity,代码行数:12,代码来源:Generator.cpp

示例15: Protocol

MeterSML::MeterSML(std::list<Option> options) 
		: Protocol("sml")
		, _host("")
		, _device("")
		, BUFFER_LEN(SML_BUFFER_LEN)
{
	OptionList optlist;

	/* connection */
	try {
		_host = optlist.lookup_string(options, "host");
	} catch ( vz::OptionNotFoundException &e ) {
		try {
			_device = optlist.lookup_string(options, "device");
		} catch ( vz::VZException &e ){
			print(log_error, "Missing device or host", name().c_str());
			throw ;
		}
	} catch( vz::VZException &e ) {
		print(log_error, "Missing device or host", name().c_str());
		throw;
	}

	/* baudrate */
	int baudrate = 9600; /* default to avoid compiler warning */
	try {
		baudrate = optlist.lookup_int(options, "baudrate");
		/* find constant for termios structure */
		switch (baudrate) {
				case 1200: _baudrate = B1200; break;
				case 1800: _baudrate = B1800; break;
				case 2400: _baudrate = B2400; break;
				case 4800: _baudrate = B4800; break;
				case 9600: _baudrate = B9600; break;
				case 19200: _baudrate = B19200; break;
				case 38400: _baudrate = B38400; break;
				case 57600: _baudrate = B57600; break;
				case 115200: _baudrate = B115200; break;
				case 230400: _baudrate = B230400; break;
				default:
					print(log_error, "Invalid baudrate: %i", name().c_str(), baudrate);
					throw vz::VZException("Invalid baudrate");
		}
	} catch( vz::OptionNotFoundException &e ) {
		/* using default value if not specified */
		_baudrate = 9600;
	} catch( vz::VZException &e ) {
		print(log_error, "Failed to parse the baudrate", name().c_str());
		throw;
	}
}
开发者ID:mysmartgrid,项目名称:vzlogger,代码行数:51,代码来源:MeterSML.cpp


注:本文中的OptionList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。