PropertyMap TagUnion<COUNT>::properties() const { for(size_t i = 0; i < COUNT; ++i) { if(d->tags[i] && !d->tags[i]->isEmpty()) return d->tags[i]->properties(); } return PropertyMap(); }
void CPropertyBase::PutPropertyValue(LPCTSTR Name, MPropertyValue & Value) { long i=PropertyIndex(Name); if (i>=0) { if (PropertyMap()[i]->Settable()) PutPropertyValue(i, Value); else { CString S; S.Format("%s '%s' not Settable", DefinedPropertyMapName(), Name); throw MMdlException(0, S); } } CString S; S.Format("%s '%s' not valid", DefinedPropertyMapName(), Name); throw MMdlException(0, (LPCTSTR)S); };
/*virtual*/ void CPropertyBase::PutPropertyValue(long Index, MPropertyValue & Value) { if (Index<0 || Index>=PropertyCount()) { CString S; S.Format("%s Index %i not Valid", DefinedPropertyMapName(), Index); throw MMdlException(0, (LPCTSTR)S); } if (!PropertyMap()[Index]->Settable()) { CString S; S.Format("%s Index %i not Settable", DefinedPropertyMapName(), Index); throw MMdlException(0, S); } CString S; S.Format("%s Index %i Unknown Error", DefinedPropertyMapName(), Index); throw MMdlException(0, S); };
void List::fromPropertyMap(PropertyMap const& _map) { clear(); PropertyMap _children = _map.getValue("inputs",PropertyMap()); auto _ids = _children.ids(); for (auto& _id : _ids) { _children.getPtr(_id,[&](Id const& _typeId) -> Input * { return addInput(_typeId); }); } _map("currentIndex",currentIndex_); setCurrentIndex(currentIndex_); }
FreeMovingSolidGameObject::PropertyMap FreeMovingSolidGameObject::GetProperties() const { return PropertyMap(); // TODO }
Preferences::Pointer Preferences::Node_unlocked(const QString& path) { QString pathName = path; AssertValid_unlocked(); AssertPath_unlocked(pathName); Preferences::Pointer node; // self reference if(pathName == "") return Preferences::Pointer(this); // absolute path else if(pathName[0] == '/') { pathName = pathName.mid(1); // call root with this relative path if (this == m_Root) return m_Root->Node_unlocked(pathName); else return m_Root->Node(pathName).Cast<Preferences>(); } // relative path else { // check if pathName contains anymore names QString name = pathName; // create new child nodes as long as there are names in the path int pos = pathName.indexOf('/'); // cut from the beginning if(pos != -1) { name = pathName.left(pos); pathName = pathName.mid(pos+1); } // now check if node exists->if not: make new for (ChildrenList::iterator it = m_Children.begin() ; it != m_Children.end(); it++) { // node found if((*it)->Name() == name && (*it)->IsRemoved() == false) { node = *it; break; } } // node not found create new one if(node.IsNull()) { // the new node automatically pushes itself into the children array of *this* Preferences::Pointer newNode(new Preferences(PropertyMap(), name, this, m_Storage)); node = newNode.GetPointer(); // this branch is dirty now -> prefs must be rewritten persistently this->SetDirty_unlocked(true); } // call Node() again if there are any names left on the path if(pos != -1) { if (this == node.GetPointer()) node = node->Node_unlocked(pathName); else node = node->Node(pathName).Cast<Preferences>(); } } return node; }