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


C++ Argument::setValue方法代码示例

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


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

示例1: clearOutputAgumentValues

void Action::clearOutputAgumentValues() {
  ArgumentList *outArgList = getOutputArgumentList();
  int nArgs = outArgList->size();
  for (int n = 0; n < nArgs; n++) {
    Argument *arg = outArgList->getArgument(n);
    arg->setValue("");
  }
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:8,代码来源:Action.cpp

示例2: analyse

//! 
void ArgManager::analyse(int argc, char *argv[])
{
	// Lecture des paramétres
	int nbParam = (argc-1)/2;
	int acParam = 0;
	while(acParam <= nbParam && nbParam>0)
	{
		acParam++;
		string argTag = string(argv[acParam]);	
		absArgument* arg = getArg(argTag);
		if(arg==NULL){
			cerr << "Erreur argument " << argTag << " : tag non valide" << endl;
			stopProcess();
		}
		
		Argument<string>* strArg = dynamic_cast<Argument<string>* >(arg);
		Argument<int>* intArg = dynamic_cast<Argument<int>* >(arg);
		if(strArg)
		{	
			cerr << "if(strArg) ok" << " Value = " << string(argv[acParam+1]);
			strArg->validArg();
			strArg->setValue(string(argv[++acParam]));
		}
		else if(intArg)
		{
			// cerr << "acParam = " << acParam << "argc = "<< argc << endl;
			// cerr << "if(intArg) ok" << " Value = " << string(argv[acParam+1]) << endl;
			intArg->validArg();
			string strInt = string(argv[++acParam]);
			intArg->setValue(atoi(strInt.c_str()));
		}
		else
		{
			cerr << "Erreur argument " << argTag << " : type non valide" << endl;
			stopProcess();
		}

	}
}
开发者ID:utcoupe,项目名称:coupe2013,代码行数:40,代码来源:argManager.cpp

示例3: initArgumentList

void ActionRequest::initArgumentList() {
  Node *actNode = getActionNode();
  if (actNode == NULL)
    return;
  int nArgNodes = actNode->getNNodes();
  argumentList.clear();
  for (int n = 0; n < nArgNodes; n++) {
    Argument *arg = new Argument();
    Node *argNode = actNode->getNode(n);
    arg->setName(argNode->getName());
    arg->setValue(argNode->getValue());
    argumentList.add(arg);
  }
}
开发者ID:moon-sky,项目名称:fishjam-template-library,代码行数:14,代码来源:ActionRequest.cpp

示例4: actionControlReceived

bool TestDevice::actionControlReceived(Action *action)
{
	const char *actionName = action->getName();
	if (strcmp("GetCount", actionName) == 0) {
		Argument *countArg = action->getArgument("CurrentCount");
		countArg->setValue(count);
		return true;
	}
	if (strcmp(actionName, "SetCount") == 0) {
		Argument *countArg = action->getArgument("NewCount");
		int newCount = countArg->getIntegerValue();
		count = newCount;
		return true;
	}
	return false;
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:16,代码来源:TestDevice.cpp

示例5: actionControlReceived

ClockDevice::ClockDevice() : Device(CLOCK_DESCRIPTION_FILE_NAME)
#else
ClockDevice::ClockDevice() : Device()
#endif
{
#if !defined(USE_CLOCK_DESCRIPTION_FILE)
	loadDescription(CLOCK_DEVICE_DESCRIPTION);
	Service *timeService = getService("urn:schemas-upnp-org:service:timer:1");
	timeService->loadSCPD(CLOCK_SERVICE_DESCRIPTION);
#endif

	Action *getTimeAction = getAction("GetTime");
	getTimeAction->setActionListener(this);
		
	Action *setTimeAction = getAction("SetTime");
	setTimeAction->setActionListener(this);
		
	ServiceList *serviceList = getServiceList();
	Service *service = serviceList->getService(0);
	service->setQueryListener(this);

	m_timeVar = getStateVariable("Time");

	setLeaseTime(60);
}

////////////////////////////////////////////////
// ActionListener
////////////////////////////////////////////////

bool ClockDevice::actionControlReceived(Action *action)
{
	const char *actionName = action->getName();
	if (strcmp("GetTime", actionName) == 0) {
		std::string dateStr;
		Clock clock;
		clock.toString(dateStr);
		Argument *timeArg = action->getArgument("CurrentTime");
		timeArg->setValue(dateStr.c_str());
		return true;
	}
	if (strcmp(actionName, "SetTime") == 0) {
		Argument *timeArg = action->getArgument("NewTime");
		const char *newTime = timeArg->getValue();
		Argument *resultArg = action->getArgument("Result");
		std::ostringstream valbuf;
		valbuf << "Not implemented (" << newTime << ")";
		resultArg->setValue(valbuf.str().c_str());
		return true;
	}
	return false;
}

////////////////////////////////////////////////
// QueryListener
////////////////////////////////////////////////

bool ClockDevice::queryControlReceived(StateVariable *stateVar)
{
	const char *varName = stateVar->getName();
	Clock clock;
	string clockVal;
	stateVar->setValue(clock.toString(clockVal));
	return true;
}

////////////////////////////////////////////////
// HttpRequestListner
////////////////////////////////////////////////

//void ClockDevice::httpRequestRecieved(HTTPRequest *httpReq)
HTTP::StatusCode ClockDevice::httpRequestRecieved(HTTPRequest *httpReq)
{
	ParameterList paramList;
	httpReq->getParameterList(paramList);
	for (int n=0; n<paramList.size(); n++) {
		Parameter *param = paramList.getParameter(n);
		cout << "[" << n << "] : " << param->getName() << " = " << param->getValue() << endl;
	}

	string uri;
	httpReq->getURI(uri);
	if (uri.find(CLOCK_PRESENTATION_URI) == string::npos)  {
		Device::httpRequestRecieved(httpReq);
        return HTTP::OK_REQUEST;
		//return ;
	}
			 
	string clockStr;
	Clock clock;
	clock.toString(clockStr);
	string contents;
	contents = "<HTML><BODY><H1>";
	contents += clockStr;
	contents += "</H1></BODY></HTML>";
		
	HTTPResponse httpRes;
	httpRes.setStatusCode(HTTP::OK_REQUEST);
	httpRes.setContent(contents);
	return httpReq->post(&httpRes) ? HTTP::OK_REQUEST : HTTP::INTERNAL_SERVER_ERROR;
//.........这里部分代码省略.........
开发者ID:moon-sky,项目名称:fishjam-template-library,代码行数:101,代码来源:ClockDevice.cpp

示例6: if

bool X86RTLGenerator::parseArgument(x86_op_t *pOp, Argument &aArgument)
{
	if(!pOp)
	{
		return false;
	}

	switch(pOp->type)
	{
		case op_register:
		{
			aArgument.setType(Argument::TYPE_REGISTER);
			std::string strRegisterName = pOp->data.reg.name;

			if(strRegisterName == "ah")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_8_LW_HB);
			}
			else if(strRegisterName == "al")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_8_LW_LB);
			}
			else if(strRegisterName == "ax")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_16_LW);
			}
			else if(strRegisterName == "eax")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_32);
			}
			else if(strRegisterName == "esi")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_ESI);
				aArgument.setDataWidth(Argument::DATA_WIDTH_32);
			}
			else if(strRegisterName == "esp")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_ESP);
				aArgument.setDataWidth(Argument::DATA_WIDTH_32);
			}
			else
				return false;
			break;
		}
		case op_immediate:
			aArgument.setType(Argument::TYPE_VALUE);

			switch(pOp->datatype)
			{
				case op_byte:
					aArgument.setValue(pOp->data.byte);
					aArgument.setDataWidth(Argument::DATA_WIDTH_8_LW_LB);
					break;
				default:
					return false;
			}
			break;
		case op_expression:
			aArgument.setType(Argument::TYPE_MEMORY_LOC);
			break;
		case op_offset:
			aArgument.setType(Argument::TYPE_MEMORY_LOC);
			break;
		case op_relative_far:
			aArgument.setType(Argument::TYPE_VALUE);
			break;
		case op_relative_near:
			aArgument.setType(Argument::TYPE_VALUE);
			break;
		default:
			return false;
	}

	return true;
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:79,代码来源:X86RTLGenerator.cpp


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