本文整理汇总了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);
//.........这里部分代码省略.........