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


C++ Ptr::set方法代码示例

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


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

示例1: start

void ChannelController::start()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
			pcfParameters = data().getObject("input");
	}
	else
	{
			pcfParameters = new Poco::JSON::Object();
			setData("input", pcfParameters);

			std::vector<std::string> parameters = getParameters();
			// First parameter is queuemanager
			// Second parameter is a channelname
			if ( parameters.size() > 1 )
			{
				  pcfParameters->set("ChannelName", parameters[1]);
			}
			else
			{
				  if ( form().has("ChannelName") ) pcfParameters->set("ChannelName", form().get("ChannelName"));
			}

			if ( form().has("CommandScope") ) pcfParameters->set("CommandScope", form().get("CommandScope"));
			if ( form().has("ChannelDisposition") ) pcfParameters->set("ChannelDisposition", form().get("ChannelDisposition"));
	}

	ChannelStart command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
开发者ID:fbraem,项目名称:mqweb,代码行数:32,代码来源:ChannelController.cpp

示例2: copy

void ChannelController::copy()
{
	Poco::JSON::Object::Ptr pcfParameters;
	if (data().has("input") && data().isObject("input"))
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();

		std::vector<std::string> parameters = getParameters();
		if (parameters.size() > 2)
		{
			pcfParameters->set("FromChannelName", parameters[2]);
		}
		if (parameters.size() > 1)
		{
			pcfParameters->set("ToChannelName", parameters[1]);
		}

		// Copy all query parameters to PCF
		for (Poco::Net::NameValueCollection::ConstIterator it = form().begin(); it != form().end(); ++it)
		{
			pcfParameters->set(it->first, it->second);
		}
	}

	ChannelCopy command(*commandServer(), pcfParameters);
	command.execute();
}
开发者ID:fbraem,项目名称:mqweb,代码行数:31,代码来源:ChannelController.cpp

示例3: create

void ChannelController::create()
{
	Poco::JSON::Object::Ptr pcfParameters;
	if (data().has("input") && data().isObject("input"))
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();

		std::vector<std::string> parameters = getParameters();
		if (parameters.size() > 1)
		{
			pcfParameters->set("ChannelName", parameters[1]);
		}
		if (parameters.size() > 2)
		{
			pcfParameters->set("ChannelType", parameters[2]);
		}
		// Copy all query parameters to PCF, except ChannelName if it is already set on the URI
		for (Poco::Net::NameValueCollection::ConstIterator it = form().begin(); it != form().end(); ++it)
		{
			if (parameters.size() > 1 && Poco::icompare(it->first, "ChannelName") == 0) continue;
			if (parameters.size() > 2 && Poco::icompare(it->first, "ChannelType") == 0) continue;
			pcfParameters->set(it->first, it->second);
		}
	}
	ChannelCreate command(*commandServer(), pcfParameters);
	command.execute();
}
开发者ID:fbraem,项目名称:mqweb,代码行数:31,代码来源:ChannelController.cpp

示例4: inquire

void QueueStatusController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a queuename. If this is passed, the
		// query parameter QName or queueName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("QName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("QName", form().get("QName", "*"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);
		pcfParameters->set("ExcludeTemp", form().get("ExcludeTemp", "false").compare("true") == 0);

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}
		if ( form().has("QSGDisposition") )
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		if ( form().has("StatusType") ) pcfParameters->set("StatusType", form().get("StatusType"));
		if ( form().has("OpenType") ) pcfParameters->set("OpenType", form().get("OpenType"));

		handleFilterForm(pcfParameters);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("QStatusAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for QStatusAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("QStatusAttrs", attrs);
		}

	}

	QueueStatusInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
开发者ID:fbraem,项目名称:mqweb,代码行数:60,代码来源:QueueStatusController.cpp

示例5: Java_com_demo_pocodemo_MainActivity_JSONDemo

JNIEXPORT void Java_com_demo_pocodemo_MainActivity_JSONDemo(JNIEnv* env, jobject thiz) {

	// smart pointer, so don't worry about cleaning up
	Poco::JSON::Object::Ptr inner = new Poco::JSON::Object;
	inner->set("some_number", 5);
	inner->set("some_string", "xyz");

	std::string key = "new_object";
	Poco::JSON::Object::Ptr result = new Poco::JSON::Object;
	result->set(key, inner);
	printf("isObject: %i\n", result->isObject(key)); // true

	printf("size of inner json obj : %i\n", inner->size()); // true
}
开发者ID:zenith22,项目名称:PocoAndroidDemo,代码行数:14,代码来源:pocoMainShared.cpp

示例6: portInfosToJSON

//! helper to convert the port info vector into JSON for serialization of the block
static Poco::JSON::Array::Ptr portInfosToJSON(const std::vector<Pothos::PortInfo> &infos)
{
    Poco::JSON::Array::Ptr array = new Poco::JSON::Array();
    for (const auto &info : infos)
    {
        Poco::JSON::Object::Ptr portInfo = new Poco::JSON::Object();
        portInfo->set("name", info.name);
        portInfo->set("isSigSlot", info.isSigSlot);
        portInfo->set("size", info.dtype.size());
        portInfo->set("dtype", info.dtype.toMarkup());
        array->add(portInfo);
    }
    return array;
}
开发者ID:xloem,项目名称:pothos,代码行数:15,代码来源:BlockEval.cpp

示例7: modifyTask

void modifyTask()
{
	int ret;
	ret = 0;
	printf("\n>>>>    Modify task    <<<<\n");
	printf("Which task would be modified:");
	int num;
	ret = scanf("%d", &num);
	if(num > tasksNum)
	{
		printf("Num input error.\n");
	}
	else
	{
		printf("Task option:");
		int option;
		ret = scanf("%d", &option);
		printf("Hour:");
		int hour;
		ret = scanf("%d", &hour);
		printf("Minute:");
		int minute;
		ret = scanf("%d", &minute);
		printf("Weekday:");
		char str[8];
		unsigned char mask = 0x40;
		ret = scanf("%s", str);
		int weekday = 0;
		for(int i = 0; i < 7; i++)
		{
			if(str[i] == '1')
			{
				weekday &= mask;
				mask >>= 1;
			}
		}
		printf("prepare to modify Task[%llu]\n", pTask[num]->id);
		Poco::JSON::Object::Ptr pObj = new Poco::JSON::Object;
		pObj->set("id",  (Poco::Int64)pTask[num - 1]->id);
		pObj->set("option", option);
		pObj->set("hour", hour);
		pObj->set("minute", minute);
		pObj->set("weekday", weekday);
		printf("new task:(%d, %d, %d, %d)\n", option, hour, minute, weekday);
		ret = task_manager->modifyTask(pObj);
		printf("modify task return %d\n", ret);
		updateTasksList();
		ret++;
		getchar();
	}
开发者ID:shuchuangtech,项目名称:Shuchuang,代码行数:50,代码来源:main.cpp

示例8: clear

void QueueController::clear()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if (data().has("input") && data().isObject("input"))
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		meta().set("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a queuename. If this is passed, the
		// query parameter QName or queueName is ignored.
		if (parameters.size() > 1)
		{
			pcfParameters->set("QName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("QName", form().get("QName", "*"));
		}

		if (form().has("CommandScope"))
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if (form().has("QSGDisposition"))
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

	}

	QueueClear command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
开发者ID:fbraem,项目名称:mqweb,代码行数:42,代码来源:QueueController.cpp

示例9: getDevVersion

bool CSystemManager::getDevVersion(Poco::JSON::Object::Ptr& param, std::string& detail)
{
	CConfigManager* config = CConfigManager::instance();
	JSON::Object::Ptr pUpdate;
	config->getConfig("Update", pUpdate);
	if(pUpdate.isNull() || !pUpdate->has("infoPath"))
	{
		detail = "901";
		return false;
	}
	std::string infoPath = pUpdate->getValue<std::string>("infoPath");
	File file(infoPath);
	if(!file.exists())
	{
		detail = "465";
		return false;
	}
	Util::JSONConfiguration info;
	std::string version;
	std::string buildtime;
	try
	{
		info.load(infoPath);
		version = info.getString(UPDATE_VERSION_STR);
		buildtime = info.getString(UPDATE_BUILDTIME_STR);
	}
	catch(Exception& e)
	{
		detail = "465";
		warnf("%s, %d: Load device info file failed, %s", __FILE__, __LINE__, e.message().c_str());
		return false;
	}
	if(param->has(REG_TOKEN_STR))
	{
		param->remove(REG_TOKEN_STR);
	}
	param->set(SYSTEM_VERSION_STR, version);
	param->set(SYSTEM_BUILDTIME_STR, buildtime);
	return true;
}
开发者ID:shuchuangtech,项目名称:Shuchuang,代码行数:40,代码来源:SystemManager.cpp

示例10: assert

Poco::JSON::Object::Ptr AffinityZoneEditor::getCurrentConfig(void) const
{
    Poco::JSON::Object::Ptr config = new Poco::JSON::Object();
    config->set("color", _colorPicker->currentColor().name().toStdString());
    config->set("hostUri", _hostsBox->itemText(_hostsBox->currentIndex()).toStdString());
    config->set("processName", _processNameEdit->text().toStdString());
    config->set("numThreads", _numThreadsSpin->value());
    config->set("priority", _prioritySpin->value()/100.0);
    assert(_cpuSelection != nullptr);
    config->set("affinityMode", _cpuSelection->mode());
    Poco::JSON::Array::Ptr affinityMask = new Poco::JSON::Array();
    for (auto num : _cpuSelection->selection()) affinityMask->add(num);
    config->set("affinityMask", affinityMask);
    config->set("yieldMode", _yieldModeBox->itemData(_yieldModeBox->currentIndex()).toString().toStdString());
    return config;
}
开发者ID:hailynch,项目名称:pothos,代码行数:16,代码来源:AffinityZoneEditor.cpp

示例11: addTask

void addTask()
{
	printf("\n>>>>    Add task    <<<<\n");
	printf("Task option:");
	int option;
	int ret;
	ret = 0;
	ret = scanf("%d", &option);
	printf("Hour:");
	int hour;
	ret = scanf("%d", &hour);
	printf("Minute:");
	int minute;
	ret = scanf("%d", &minute);
	printf("Weekday:");
	int weekday = 0;
	char str[9];
	ret = scanf("%s", str);
	unsigned short mask = 0x40;
	for(int i = 0; i < 7; i++)
	{
		if(str[i] == '1')
			weekday |= mask;
		mask = mask >> 1;
	}
	printf("%x\n", weekday);
	Poco::JSON::Object::Ptr pObj = new Poco::JSON::Object;
	pObj->set("option", option);
	pObj->set("hour", hour);
	pObj->set("minute", minute);
	pObj->set("weekday", weekday);
	Poco::Int64 retval = task_manager->addTask(pObj);
	printf("Add task result: %llu.\n", retval);
	updateTasksList();
	ret++;
	getchar();
}
开发者ID:shuchuangtech,项目名称:Shuchuang,代码行数:37,代码来源:main.cpp

示例12: remove

void ChannelController::remove()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if (data().has("input") && data().isObject("input"))
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		meta().set("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a queuename. If this is passed, the
		// query parameter QName or queueName is ignored.
		if (parameters.size() > 1)
		{
			pcfParameters->set("ChannelName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			std::string channelName;
			if (form().has("ChannelName"))
			{
				channelName = form().get("ChannelName");
			}
			pcfParameters->set("ChannelName", channelName);
		}

		if (form().has("CommandScope"))
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if (form().has("QSGDisposition"))
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		if (form().has("ChannelType"))
		{
			pcfParameters->set("ChannelType", form().get("ChannelType"));
		}

		if (form().has("ChannelTable"))
		{
			pcfParameters->set("ChannelTable", form().get("ChannelTable"));
		}
	}

	ChannelRemove command(*commandServer(), pcfParameters);
	command.execute();
}
开发者ID:fbraem,项目名称:mqweb,代码行数:56,代码来源:ChannelController.cpp

示例13:

Poco::JSON::Object::Ptr BlockEval::inspectPorts(void)
{
    auto block = _proxyBlock;
    Poco::JSON::Object::Ptr info = new Poco::JSON::Object();

    info->set("uid", block.call<std::string>("uid"));

    //TODO FIXME inspect will fail for topologies ATM, cant query isSignal/isSlot on topology

    Poco::JSON::Array::Ptr inputPorts = new Poco::JSON::Array();
    for (const auto &name : block.call<std::vector<std::string>>("inputPortNames"))
    {
        Poco::JSON::Object::Ptr portInfo = new Poco::JSON::Object();
        portInfo->set("name", name);
        portInfo->set("isSlot", block.callProxy("input", name).call<bool>("isSlot"));
        portInfo->set("size", block.callProxy("input", name).callProxy("dtype").call<unsigned>("size"));
        portInfo->set("dtype", block.callProxy("input", name).callProxy("dtype").call<std::string>("toString"));
        inputPorts->add(portInfo);
    }
    info->set("inputPorts", inputPorts);

    Poco::JSON::Array::Ptr outputPorts = new Poco::JSON::Array();
    for (const auto &name : block.call<std::vector<std::string>>("outputPortNames"))
    {
        Poco::JSON::Object::Ptr portInfo = new Poco::JSON::Object();
        portInfo->set("name", name);
        portInfo->set("isSignal", block.callProxy("output", name).call<bool>("isSignal"));
        portInfo->set("size", block.callProxy("output", name).callProxy("dtype").call<unsigned>("size"));
        portInfo->set("dtype", block.callProxy("output", name).callProxy("dtype").call<std::string>("toString"));
        outputPorts->add(portInfo);
    }
    info->set("outputPorts", outputPorts);

    return info;
}
开发者ID:hailynch,项目名称:pothos,代码行数:35,代码来源:BlockEval.cpp

示例14: inquire

void ChannelController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a channelname. If this is passed
		// the query parameter ChannelName is ignored. A third parameter
		// can be used for setting the channel type. This parameter can also
		// be set using the query parameter ChannelType.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("ChannelName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("ChannelName", form().get("ChannelName", "*"));
		}

		if ( parameters.size() > 2 )
		{
			pcfParameters->set("ChannelType", parameters[2]);
		}
		else if ( form().has("ChannelType") )
		{
			pcfParameters->set("ChannelType", form().get("ChannelType", "All"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("ChannelAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for ChannelAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("ChannelAttrs", attrs);
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("QSGDisposition") )
		{
			pcfParameters->set("QSGDisposition", form().get("QSGDisposition"));
		}

		if ( form().has("DefaultChannelDisposition") )
		{
			pcfParameters->set("DefaultChannelDisposition", form().get("DefaultChannelDisposition"));
		}

		handleFilterForm(pcfParameters);
	}

	ChannelInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
开发者ID:fbraem,项目名称:mqweb,代码行数:72,代码来源:ChannelController.cpp

示例15: inquire

void SubscriptionController::inquire()
{
	Poco::JSON::Object::Ptr pcfParameters;

	if ( data().has("input") && data().isObject("input") )
	{
		pcfParameters = data().getObject("input");
	}
	else
	{
		pcfParameters = new Poco::JSON::Object();
		setData("input", pcfParameters);

		std::vector<std::string> parameters = getParameters();
		// First parameter is queuemanager
		// Second parameter can be a subname. If this is passed
		// the query parameter subName is ignored.
		if ( parameters.size() > 1 )
		{
			pcfParameters->set("SubName", parameters[1]);
		}
		else
		{
			// Handle query parameters
			pcfParameters->set("SubName", form().get("SubName", "*"));
		}

		if ( form().has("SubId") )
		{
			pcfParameters->set("SubId", form().get("SubId"));
		}

		if ( form().has("SubscriptionType") )
		{
			pcfParameters->set("SubscriptionType", form().get("SubscriptionType"));
		}

		pcfParameters->set("ExcludeSystem", form().get("ExcludeSystem", "false").compare("true") == 0);

		Poco::JSON::Array::Ptr attrs = new Poco::JSON::Array();
		formElementToJSONArray("SubAttrs", attrs);
		if ( attrs->size() == 0 ) // Nothing found for SubAttrs, try Attrs
		{
			formElementToJSONArray("Attrs", attrs);
		}
		if ( attrs->size() > 0 )
		{
			pcfParameters->set("SubAttrs", attrs);
		}

		if ( form().has("CommandScope") )
		{
			pcfParameters->set("CommandScope", form().get("CommandScope"));
		}

		if ( form().has("Durable") )
		{
			pcfParameters->set("Durable", form().get("Durable"));
		}

		handleFilterForm(pcfParameters);
	}

	SubscriptionInquire command(*commandServer(), pcfParameters);
	setData("data", command.execute());
}
开发者ID:fbraem,项目名称:mqweb,代码行数:66,代码来源:SubscriptionController.cpp


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