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


C++ Arguments::clear方法代码示例

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


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

示例1: ExtractGetArguments

void OrthancContext::ExtractGetArguments(Arguments& arguments,
        const OrthancPluginHttpRequest& request)
{
    Check();
    arguments.clear();

    for (uint32_t i = 0; i < request.getCount; i++)
    {
        arguments[request.getKeys[i]] = request.getValues[i];
    }
}
开发者ID:vinayvenu,项目名称:orthanc,代码行数:11,代码来源:OrthancContext.cpp

示例2: ReaderLoop

void GTPReader::ReaderLoop() {
    // Main loop to read commands from standard input 

    std::string inputstring;
    int id;
    std::string command("");
    std::string rawargs;
    std::stringstream ss;
    Arguments arguments;
  
    while(command != "quit") {

	std::getline(std::cin, inputstring);
	ss.str(inputstring);
	ss.clear();
	ss.seekg(0, std::ios::beg);
	ss >> id;

	if(ss.fail()) {
	    id = -1;
	    ss.clear();
	    ss.seekg(0, std::ios::beg);
	}
    
	ss >> command;
    
	if(ss.fail()) {
	    ss.clear();
	    ss.seekg(0, std::ios::beg);
	    continue;
	}
    
	while (ss >> rawargs){
	    arguments.add(rawargs);
	    rawargs.clear();
	}

	ss.clear();
	ss.seekg(0, std::ios::beg);
	rawargs.clear();
    
	engine.command(id, command, arguments);

	arguments.clear();
    }

}
开发者ID:benner78,项目名称:BenGo,代码行数:47,代码来源:GTPReader.cpp

示例3: RegisterServiceCtrlHandler

void
ArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn)
{
	typedef std::vector<LPCTSTR> ArgList;
	typedef std::vector<std::string> Arguments;
	const char** argv = const_cast<const char**>(argvIn);

	// create synchronization objects
	m_serviceMutex        = ARCH->newMutex();
	m_serviceCondVar      = ARCH->newCondVar();
	
	// register our service handler function
	m_statusHandle = RegisterServiceCtrlHandler(argv[0],
								&ArchDaemonWindows::serviceHandlerEntry);
	if (m_statusHandle == 0) {
		// cannot start as service
		m_daemonResult = -1;
		ARCH->closeCondVar(m_serviceCondVar);
		ARCH->closeMutex(m_serviceMutex);
		return;
	}

	// tell service control manager that we're starting
	m_serviceState = SERVICE_START_PENDING;
	setStatus(m_serviceState, 0, 10000);

	std::string commandLine;

	// if no arguments supplied then try getting them from the registry.
	// the first argument doesn't count because it's the service name.
	Arguments args;
	ArgList myArgv;
	if (argc <= 1) {
		// read command line
		HKEY key = openNTServicesKey();
		key      = ArchMiscWindows::openKey(key, argvIn[0]);
		key      = ArchMiscWindows::openKey(key, _T("Parameters"));
		if (key != NULL) {
			commandLine = ArchMiscWindows::readValueString(key,
												_T("CommandLine"));
		}

		// if the command line isn't empty then parse and use it
		if (!commandLine.empty()) {
			// parse, honoring double quoted substrings
			std::string::size_type i = commandLine.find_first_not_of(" \t");
			while (i != std::string::npos && i != commandLine.size()) {
				// find end of string
				std::string::size_type e;
				if (commandLine[i] == '\"') {
					// quoted.  find closing quote.
					++i;
					e = commandLine.find("\"", i);

					// whitespace must follow closing quote
					if (e == std::string::npos ||
						(e + 1 != commandLine.size() &&
						commandLine[e + 1] != ' ' &&
						commandLine[e + 1] != '\t')) {
						args.clear();
						break;
					}

					// extract
					args.push_back(commandLine.substr(i, e - i));
					i = e + 1;
				}
				else {
					// unquoted.  find next whitespace.
					e = commandLine.find_first_of(" \t", i);
					if (e == std::string::npos) {
						e = commandLine.size();
					}

					// extract
					args.push_back(commandLine.substr(i, e - i));
					i = e + 1;
				}

				// next argument
				i = commandLine.find_first_not_of(" \t", i);
			}

			// service name goes first
			myArgv.push_back(argv[0]);

			// get pointers
			for (size_t j = 0; j < args.size(); ++j) {
				myArgv.push_back(args[j].c_str());
			}

			// adjust argc/argv
			argc = (DWORD)myArgv.size();
			argv = &myArgv[0];
		}
	}

	m_commandLine = commandLine;

	try {
//.........这里部分代码省略.........
开发者ID:TotoxLAncien,项目名称:synergy,代码行数:101,代码来源:ArchDaemonWindows.cpp


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