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


C++ VariantType::sequence方法代码示例

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


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

示例1: getProperty

GVariant* AbstractDBusInterface::getProperty(GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName,
											 const gchar* propertyName, GError** error, gpointer userData)
{
	if(DebugOut::getDebugThreshhold() >= 6)
	{
		DebugOut(6)<<"DBus GetProperty call from: "<<sender<< " pid: " <<getPid(sender)<< " interface: "<<interfaceName<<" property: "<<propertyName<<endl;
		DebugOut(6)<<"DBus GetProperty call path: "<<objectPath<<endl;
	}

	std::string pn = propertyName;
	if(pn == "Time")
	{
		if(objectMap.find(objectPath) == objectMap.end())
		{
			DebugOut(DebugOut::Error)<<objectPath<<" is not a valid object path."<<endl;
			return nullptr;
		}
		double time = objectMap[objectPath]->time();

		GVariant* value = g_variant_new("d", time);
		return value;
	}

	else if(boost::ends_with(pn, "Sequence"))
	{
		AbstractDBusInterface* t = static_cast<AbstractDBusInterface*>(userData);

		int pos = pn.find("Sequence");

		std::string p = pn.substr(0,pos);

		VariantType * theProperty = t->property(p);

		if(!theProperty)
		{
			DebugOut(DebugOut::Error)<<"Invalid Sequence property: "<<p<<endl;
			return nullptr;
		}

		int sequence = theProperty->sequence();

		GVariant* value = g_variant_new("i", sequence);
		return value;
	}

	else if(boost::ends_with(pn, "ValueQuality"))
	{
		AbstractDBusInterface* t = static_cast<AbstractDBusInterface*>(userData);

		int pos = pn.find("ValueQuality");

		std::string p = pn.substr(0, pos);

		VariantType * theProperty = t->property(p);

		if(!theProperty)
		{
			DebugOut(DebugOut::Error)<<"Invalid ValueQuality property: "<<p<<endl;
			return nullptr;
		}

		int quality = theProperty->value()->valueQuality;

		GVariant* value = g_variant_new("i", quality);
		return value;
	}

	else if(boost::ends_with(pn, "UpdateFrequency"))
	{
		AbstractDBusInterface* t = static_cast<AbstractDBusInterface*>(userData);

		int pos = pn.find("UpdateFrequency");

		std::string p = pn.substr(0, pos);

		VariantType * theProperty = t->property(p);

		if(!theProperty)
		{
			DebugOut(DebugOut::Error)<<"Invalid UpdateFrequency property: "<<p<<endl;
			return nullptr;
		}

		int freq = theProperty->updateFrequency();

		GVariant* value = g_variant_new("i", freq);
		return value;
	}

	else if(pn == "Zone")
	{
		if(objectMap.find(objectPath) == objectMap.end())
		{
			DebugOut(DebugOut::Error)<<objectPath<<" is not a valid object path."<<endl;
			return nullptr;
		}

		Zone::Type zone = objectMap[objectPath]->zone();

		GVariant* value = g_variant_new("i",(int)zone);
//.........这里部分代码省略.........
开发者ID:fredcadete,项目名称:automotive-message-broker,代码行数:101,代码来源:abstractdbusinterface.cpp


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