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


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

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


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

示例1: cf

// Execute the named procedure on the remote server.
// Params should be an array of the arguments for the method.
// Returns true if the request was sent and a result received (although the result
// might be a fault).
bool
XmlRpcClient::execute(const char* method, XmlRpcValue const& params, XmlRpcValue& result)
{
  XmlRpcUtil::log(1, "XmlRpcClient::execute: method %s (_connectionState %d).", method, _connectionState);

  // This is not a thread-safe operation, if you want to do multithreading, use separate
  // clients for each thread. If you want to protect yourself from multiple threads
  // accessing the same client, replace this code with a real mutex.
  if (_executing)
    return false;

  _executing = true;
  ClearFlagOnExit cf(_executing);

  _sendAttempts = 0;
  _isFault = false;

  if ( ! setupConnection())
    return false;

  if ( ! generateRequest(method, params))
    return false;

  result.clear();
  double msTime = -1.0;   // Process until exit is called
  _disp.work(msTime);

  if (_connectionState != IDLE || ! parseResponse(result))
    return false;

  XmlRpcUtil::log(1, "XmlRpcClient::execute: method %s completed.", method);
  _response = "";
  return true;
}
开发者ID:shaikhkh,项目名称:fcc_files,代码行数:38,代码来源:XmlRpcClient.cpp

示例2:

bool
XmlRpcClient::executeCheckDone(XmlRpcValue& result)
{
  result.clear();
  // Are we done yet?
  if (_connectionState != IDLE)
    return false;
  if (! parseResponse(result))
  {
    // Hopefully the caller can determine that parsing failed.
  }
  //XmlRpcUtil::log(1, "XmlRpcClient::execute: method %s completed.", method);
  _response = "";
  return true;
}
开发者ID:Aand1,项目名称:ROSCH,代码行数:15,代码来源:XmlRpcClient.cpp

示例3: testStruct

void testStruct()
{
	XmlRpcValue struct1;
	struct1["i4"] = 1;
	struct1["str"] = "two";
	struct1["d"] = 43.7;
	XmlRpcValue a;
	a.setSize(4);
	a[0] = 1;
	a[1] = std::string("two");
	a[2] = 43.7;
	a[3] = "four";
	assert(struct1["d"] == a[2]);
	char csStructXml[] =
		"<value><struct>\n"
		"  <member>\n"
		"    <name>i4</name> \n"
		"    <value><i4>1</i4></value> \n"
		"  </member>\n"
		"  <member>\n"
		"    <name>d</name> \n"
		"    <value><double>43.7</double></value>\n"
		"  </member>\n"
		"  <member>\n"
		"    <name>str</name> \n"
		"    <value> <string>two</string></value>\n"
		"  </member>\n"
		"</struct></value>";

	int offset = 0;
	XmlRpcValue structXml(csStructXml, &offset);
	assert(struct1 == structXml);

	XmlRpcValue astruct;
	astruct["array"] = a;
	assert(astruct["array"][2] == struct1["d"]);

	for (int i=0; i<10; i++) {

		XmlRpcValue Event;

		Event["Name"] = "string";
		Event.clear();

		const int NELMTS = 100;
		int ii;

		for (ii=0; ii< NELMTS; ++ii) {
			char buf[40];
			sprintf(buf,"%d", ii);
			Event[std::string(buf)] = buf;
		}

		Event.clear();

		for (ii=0; ii< NELMTS; ++ii) {
			char buf[40];
			sprintf(buf,"%d", ii);
			if (ii != NELMTS/2)
				Event[std::string(buf)] = ii;
			else
				for (int jj=0; jj< NELMTS; ++jj) {
					char bufj[40];
					sprintf(bufj,"%d", jj);
					Event[std::string(buf)][std::string(bufj)] = bufj;
				}
		}

		for (ii=0; ii< NELMTS; ++ii) {
			char buf[40];
			sprintf(buf,"%d", ii);
			if (ii != NELMTS/2)
				assert(Event[std::string(buf)] == XmlRpcValue(ii));
			else
				assert(Event[std::string(buf)].size() == NELMTS);
		}
	}
}
开发者ID:Analias,项目名称:flxmlrpc,代码行数:78,代码来源:TestValues.cpp


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