本文整理汇总了C++中DataRef::isWritable方法的典型用法代码示例。如果您正苦于以下问题:C++ DataRef::isWritable方法的具体用法?C++ DataRef::isWritable怎么用?C++ DataRef::isWritable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataRef
的用法示例。
在下文中一共展示了DataRef::isWritable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subscribeRef
DataRef* XPlanePlugin::subscribeRef(QString name) {
DEBUG << name;
// Search in list of already subscribed datarefs - if found return that
foreach(DataRef *ref, refs) {
if(ref->name()==name) {
DEBUG << "Already subscribed to " << name;
ref->setSubscribers(ref->subscribers() + 1);
return ref;
}
}
// Not yet subscribed - create a new dataref
XPLMDataRef ref = XPLMFindDataRef(name.toLatin1());
if(ref) {
XPLMDataTypeID refType = XPLMGetDataRefTypes(ref);
DataRef *dr = 0;
if(refType & xplmType_Double) {
dr = new DoubleDataRef(this, name, ref);
} else if(refType & xplmType_Float) {
dr = new FloatDataRef(this, name, ref);
} else if(refType & xplmType_Int) {
dr = new IntDataRef(this, name, ref);
} else if (refType & xplmType_FloatArray) {
dr = new FloatArrayDataRef(this, name, ref);
} else if (refType & xplmType_IntArray) {
dr = new IntArrayDataRef(this, name, ref);
} else if (refType & xplmType_Data) {
dr = new DataDataRef(this, name, ref);
}
if(dr) {
dr->setSubscribers(1);
dr->setWritable(XPLMCanWriteDataRef(ref) != 0);
DEBUG << "Subscribed to ref " << dr->name() << ", type: " << dr->typeString() << ", writable:" << dr->isWritable();
refs.append(dr);
return dr;
} else {
INFO << "Dataref type " << refType << "not supported";
}
} else {
INFO << "Can't find dataref " << name;
}
return 0;
}