本文整理汇总了C++中DynamicObject类的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject类的具体用法?C++ DynamicObject怎么用?C++ DynamicObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DynamicObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAttributeByPath
bool DynamicObjectImp::setAttributeByPath(QStringList pathComponents, DataVariant& value, bool swap)
{
if (!value.isValid())
{
return false;
}
QString finalName = pathComponents.back();
pathComponents.pop_back();
string loopType = "DynamicObject";
DynamicObject* pLoopObj = dynamic_cast<DynamicObject*>(this);
DynamicObject* pCurObj = pLoopObj;
for (QStringList::const_iterator iter = pathComponents.begin();
iter != pathComponents.end(); ++iter)
{
if (pLoopObj == NULL || loopType != "DynamicObject")
{
return false;
}
pCurObj = pLoopObj;
DataVariant& attrValue = pCurObj->getAttribute(iter->toStdString());
loopType = attrValue.getTypeName();
pLoopObj = attrValue.getPointerToValue<DynamicObject>();
if ((pLoopObj != NULL) && (loopType != "DynamicObject"))
{
return false;
}
if (pLoopObj == NULL)
{
FactoryResource<DynamicObject> pNewObj;
if (pCurObj != NULL)
{
pCurObj->setAttribute(iter->toStdString(), *pNewObj.get());
DataVariant& currentValue = pCurObj->getAttribute(iter->toStdString());
loopType = currentValue.getTypeName();
pLoopObj = currentValue.getPointerToValue<DynamicObject>();
}
}
}
if (pLoopObj == NULL || loopType != "DynamicObject")
{
return false;
}
pCurObj = pLoopObj;
DynamicObjectImp* const pCurObjImp = dynamic_cast<DynamicObjectImp*>(pCurObj);
VERIFY(pCurObjImp != NULL);
return pCurObjImp->setAttribute(finalName.toStdString(), value, swap);
}
示例2: IsWritableDataOnlyDetectionBitSet
bool RecyclableObject::IsWritableDataOnlyDetectionBitSet()
{
if (DynamicType::Is(this->GetTypeId()))
{
DynamicObject* obj = DynamicObject::FromVar(this);
return obj->GetTypeHandler()->IsWritableDataOnlyDetectionBitSet() ||
(obj->HasObjectArray() && obj->GetObjectArrayOrFlagsAsArray()->IsWritableDataOnlyDetectionBitSet());
}
return false;
}
示例3: HasOnlyWritableDataProperties
bool RecyclableObject::HasOnlyWritableDataProperties()
{
if (DynamicType::Is(this->GetTypeId()))
{
DynamicObject* obj = DynamicObject::FromVar(this);
return obj->GetTypeHandler()->GetHasOnlyWritableDataProperties() &&
(!obj->HasObjectArray() || obj->GetObjectArrayOrFlagsAsArray()->HasOnlyWritableDataProperties());
}
return true;
}
示例4:
DynamicObject& Exception::getDetails()
{
if(mDetails->isNull())
{
DynamicObject details;
details->setType(Map);
*mDetails = details;
}
return *mDetails;
}
示例5: toDynamicObject
DynamicObject* DisplayQueryOptions::toDynamicObject() const
{
DynamicObject* pDynObj = QueryOptions::toDynamicObject();
VERIFYRV(pDynObj != NULL, NULL);
pDynObj->setAttribute(UNIQUE_NAME, mUniqueName);
pDynObj->setAttribute(CHECKED, mbQueryActive);
pDynObj->setAttribute(ORDER, mOrder);
return pDynObj;
}
示例6: while
void Cal3dModel::render(bool select_mode) {
// TODO Make this into a matrix?
// Render *render = RenderSystem::getInstance().getRenderer();
// render->rotate(m_rotate,0.0f,0.0f,1.0f); //so zero degrees points east
DynamicObjectList::iterator I = m_dos.begin();
DynamicObjectList::const_iterator Iend = m_dos.end();
while (I != Iend) {
DynamicObject* dyno = *I++;
dyno->render(select_mode);
}
}
示例7: empty
const var EnviJSONRPC::toArray (const StringPairArray &stringPairArray)
{
var ret = empty(false);
DynamicObject *dso = ret.getDynamicObject();
for (int i=0; i<stringPairArray.size(); i++)
{
dso->setProperty (stringPairArray.getAllKeys() [i], stringPairArray.getAllValues() [i]);
}
return (ret);
}
示例8: ClearWritableDataOnlyDetectionBit
void RecyclableObject::ClearWritableDataOnlyDetectionBit()
{
if (DynamicType::Is(this->GetTypeId()))
{
DynamicObject* obj = DynamicObject::FromVar(this);
obj->GetTypeHandler()->ClearWritableDataOnlyDetectionBit();
if (obj->HasObjectArray())
{
obj->GetObjectArrayOrFlagsAsArray()->ClearWritableDataOnlyDetectionBit();
}
}
}
示例9: xml
vector<ImportDescriptor*> LayerImporter::getImportDescriptors(const string& filename, bool reportErrors)
{
vector<ImportDescriptor*> descriptors;
if (!filename.empty())
{
MessageLog* pLog = NULL;
if (reportErrors == true)
{
Service<MessageLogMgr> pLogMgr;
pLog = pLogMgr->getLog();
}
XmlReader xml(pLog);
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDoc = xml.parse(filename, "metadata");
DOMElement* pRootElement = NULL;
if (pDoc != NULL)
{
pRootElement = pDoc->getDocumentElement();
}
if (pRootElement != NULL)
{
for (DOMNode* pChild = pRootElement->getFirstChild();
pChild != NULL;
pChild = pChild->getNextSibling())
{
if (pChild->getNodeType() == DOMNode::ELEMENT_NODE)
{
DOMElement* pChildElement = static_cast<DOMElement*>(pChild);
string cNodeName = A(pChildElement->getNodeName());
ImportDescriptor* pImportDescriptor = ModelImporter::populateImportDescriptor(pChildElement, filename);
if (pImportDescriptor != NULL)
{
DataDescriptor* pDataDescriptor = pImportDescriptor->getDataDescriptor();
if (NULL != pDataDescriptor)
{
DynamicObject* pMetadataZ = pDataDescriptor->getMetadata();
VERIFYRV(pMetadataZ, descriptors);
if (!pMetadataZ->getAttributeByPath("Layer/Import Options/Use Pixel Coordinates").isValid())
{
pMetadataZ->setAttributeByPath("Layer/Import Options/Use Pixel Coordinates", false);
}
}
descriptors.push_back(pImportDescriptor);
}
}
}
}
}
return descriptors;
}
示例10: if
bool Map::isValid(
DynamicObject& obj,
ValidatorContext* context)
{
bool rval = true;
if(!obj.isNull() && obj->getType() == monarch::rt::Map)
{
Validators::iterator i;
for(i = mValidators.begin(); i != mValidators.end(); ++i)
{
// only add a "." if this is not a root map
if(context->getDepth() != 0)
{
context->pushPath(".");
}
context->pushPath(i->first);
if(obj->hasMember(i->first))
{
// do not short-circuit to ensure all keys tested
if(!i->second.validator->isValid(obj[i->first], context))
{
rval = false;
}
}
else if(!i->second.validator->isOptional(context))
{
rval = false;
DynamicObject detail =
context->addError("monarch.validation.MissingField", &obj);
detail["validator"] = "monarch.validator.Map";
detail["message"] = "A required field has not been specified.";
detail["key"] = i->first;
}
context->popPath();
if(context->getDepth() > 0)
{
context->popPath();
}
}
}
else
{
rval = false;
DynamicObject detail =
context->addError("monarch.validation.TypeError", &obj);
detail["validator"] = "monarch.validator.Map";
detail["message"] = "The given object type must a mapping (Map) type";
}
return rval;
}
示例11: cleanup
void WebServer::cleanup()
{
// reset container
mContainer->clear();
DynamicObject domains;
domains->append("*");
mContainer->setDefaultDomains(domains);
// clean up
mHostAddress.setNull();
mSslContext.setNull();
mSocketDataPresenterList.setNull();
}
示例12: getStateInformation
//==============================================================================
void MidiSelectProcessor::getStateInformation (MemoryBlock &destData)
{
// Use json for better forward-compatibility (not just splat)
DynamicObject *data = new DynamicObject;
data->setProperty("lowerNote", lowerNote);
data->setProperty("upperNote", upperNote);
String json = JSON::toString(var(data), true);
MemoryOutputStream stream(destData, false);
stream.write(json.toUTF8(), json.length());
}
示例13: loadModulations
void LoadSave::loadModulations(SynthBase* synth,
const Array<var>* modulations) {
synth->clearModulations();
var* modulation = modulations->begin();
for (; modulation != modulations->end(); ++modulation) {
DynamicObject* mod = modulation->getDynamicObject();
std::string source = mod->getProperty("source").toString().toStdString();
std::string destination = mod->getProperty("destination").toString().toStdString();
mopo::ModulationConnection* connection = synth->getModulationBank().get(source, destination);
synth->setModulationAmount(connection, mod->getProperty("amount"));
}
}
示例14: f
void PMixInterpolationSpaceLayout::updateComponents()
{
// for (int i = getNumChildComponents(); --i >= 0;)
// {
// if (InterpolationSpacePreset* const pc = dynamic_cast <InterpolationSpacePreset*> (getChildComponent (i)))
// pc->update();
// }
for (int i = audioEngine.getDoc().getNumNodes(); --i >= 0;)
{
const AudioProcessorGraph::Node::Ptr f (audioEngine.getDoc().getNode (i));
if (!InternalPluginFormat::isInternalFormat(f->getProcessor()->getName()))
{
Array<InterpolationSpacePreset*> comps;
getComponentsForNode(f->nodeID, comps);
Array<var>* presets = f->properties.getVarPointer("presets")->getArray();
// if the number of presets for this node has changed then delete the components and re-create
if (comps.size() != presets->size())
{
for (int componentIdx = 0; componentIdx<comps.size(); componentIdx++)
{
removeChildComponent(comps[componentIdx]);
delete comps[componentIdx];
}
for (int presetIdx = 0; presetIdx < presets->size(); presetIdx++)
{
DynamicObject* obj = presets->getReference(presetIdx).getDynamicObject();
String label = obj->getProperty("name");
InterpolationSpacePreset* const comp = new InterpolationSpacePreset(audioEngine, label, f->nodeID, obj->getProperty("uid"), audioEngine.getDoc().getNodeColour(f->nodeID) );
String componentID;
componentID << "p." << (int) f->nodeID << "." << presetIdx;
comp->setComponentID(componentID);
float r = MIN_RADIUS + (RADIUS_RANGE * (float) obj->getProperty("radius"));
float x = getWidth() * (float) obj->getProperty("x");
float y = getHeight() * (float) obj->getProperty("y");
comp->setSize(r, r);
comp->setCentrePosition(x, y);
comp->update();
addAndMakeVisible (comp);
}
}
}
}
}
示例15: _encode
// TODO: expose as utility function?
static string _encode(
RdfType type, const char* value, const char* datatype = NULL)
{
string rval;
// FIXME: escape
// <value>
if(type == RDF_TYPE_IRI)
{
rval.push_back('<');
rval.append(value);
rval.push_back('>');
}
// value^^<datatype>
else if(type == RDF_TYPE_TYPED_LITERAL)
{
// FIXME: this is called with <> wrapped datatypes, despite func docs.
// Adjust datatype to an unwrapped version if needed.
const char* dt = datatype;
size_t dtlen = strlen(dt);
if(dtlen > 1 && dt[0] == '<' && dt[dtlen - 1] == '>')
{
dt++;
dtlen -= 2;
}
// use canonical form for xsd:double
if(strncmp(datatype, XSD_DOUBLE, dtlen) == 0)
{
DynamicObject d;
d = value;
rval = StringTools::format("%1.6e", d->getDouble());
}
else
{
rval.assign(value);
}
rval.append("^^");
rval.push_back('<');
rval.append(dt, dtlen);
rval.push_back('>');
}
// default
else
{
rval.assign(value);
}
return rval.c_str();
}