📄 stafdatatypesinlimpl.cpp
字号:
const STAFObjectPtr &objPtr){ put(key, *objPtr);}STAF_INLINE void STAFObject::put(const STAFString &key, const STAFString &aString){ put(key, STAFObject(aString));}STAF_INLINE STAFObjectIteratorPtr STAFObject::keyIterator(){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; STAFObjectIterator_t iter = 0; rc = STAFObjectConstructMapKeyIterator(&iter, fObject); STAFException::checkRC(rc, "STAFObjectConstructMapKeyIterator", osRC); return STAFObjectIteratorPtr(new STAFObjectIterator(iter), STAFObjectIteratorPtr::INIT);}STAF_INLINE STAFObjectIteratorPtr STAFObject::valueIterator(){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; STAFObjectIterator_t iter = 0; rc = STAFObjectConstructMapValueIterator(&iter, fObject); STAFException::checkRC(rc, "STAFObjectConstructMapValueIterator", osRC); return STAFObjectIteratorPtr(new STAFObjectIterator(iter), STAFObjectIteratorPtr::INIT);}STAF_INLINE void STAFObject::setMapClassDefinition( const STAFMapClassDefinition &def){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; rc = STAFObjectMarshallingContextSetMapClassDefinition( fObject, def.name().getImpl(), def.fMapClassDefObj->fObject); STAFException::checkRC( rc, "STAFObjectMarshallingContextSetMapClassDefinition", osRC);}STAF_INLINE void STAFObject::setMapClassDefinition( const STAFMapClassDefinitionPtr &defPtr){ setMapClassDefinition(*defPtr);}STAF_INLINE STAFMapClassDefinitionPtr STAFObject::getMapClassDefinition( const STAFString &name){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; STAFObject_t obj = 0; rc = STAFObjectMarshallingContextGetMapClassDefinition( fObject, name.getImpl(), &obj); STAFException::checkRC( rc, "STAFObjectMarshallingContextGetMapClassDefinition", osRC); STAFObjectPtr objPtr = STAFObjectPtr(new STAFObject(obj), STAFObjectPtr::INIT); if (objPtr->type() == kSTAFNoneObject) { objPtr = STAFObject::createMap(); objPtr->put("keys", STAFObject::createList()); objPtr->put("name", name); } return STAFMapClassDefinitionPtr( new STAFMapClassDefinition(objPtr), STAFMapClassDefinitionPtr::INIT);}STAF_INLINE bool STAFObject::hasMapClassDefinition(const STAFString &name){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; unsigned int hasMCD = 0; rc = STAFObjectMarshallingContextHasMapClassDefinition( fObject, name.getImpl(), &hasMCD); STAFException::checkRC( rc, "STAFObjectMarshallingContextHasMapClassDefinition", osRC); return (hasMCD == 0) ? false : true;}STAF_INLINE STAFObjectIteratorPtr STAFObject::mapClassDefinitionIterator(){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; STAFObjectIterator_t iter = 0; rc = STAFObjectConstructMapClassDefinitionIterator(&iter, fObject); STAFException::checkRC( rc, "STAFObjectConstructMapClassDefinitionIterator", osRC); return STAFObjectIteratorPtr(new STAFObjectIterator(iter), STAFObjectIteratorPtr::INIT);}STAF_INLINE void STAFObject::setRootObject(const STAFObject &obj){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; rc = STAFObjectMarshallingContextSetRootObject(fObject, obj.fObject); STAFException::checkRC( rc, "STAFObjectMarshallingContextSetRootObject", osRC);}STAF_INLINE void STAFObject::setRootObject(const STAFObjectPtr &objPtr){ setRootObject(*objPtr);}STAF_INLINE STAFObjectPtr STAFObject::getRootObject(){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; STAFObject_t obj = 0; rc = STAFObjectMarshallingContextGetRootObject(fObject, &obj); STAFException::checkRC( rc, "STAFObjectMarshallingContextGetRootObject", osRC); return STAFObjectPtr(new STAFObject(obj), STAFObjectPtr::INIT);}STAF_INLINE STAFObject::~STAFObject(){ STAFObjectDestruct(&fObject);}STAF_INLINE STAFObjectIterator::STAFObjectIterator(STAFObjectIterator_t iter) : fIter(iter){ /* Do nothing */}STAF_INLINE bool STAFObjectIterator::hasNext(){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; unsigned int hasNext = 0; rc = STAFObjectIteratorHasNext(fIter, &hasNext); STAFException::checkRC(rc, "STAFObjectIteratorHasNext", osRC); return (hasNext == 0) ? false : true;}STAF_INLINE STAFObjectPtr STAFObjectIterator::next(){ unsigned int osRC = 0; STAFRC_t rc = kSTAFOk; STAFObject_t retObj = 0; rc = STAFObjectIteratorGetNext(fIter, &retObj); STAFException::checkRC(rc, "STAFObjectIteratorGetNext", osRC); return STAFObjectPtr(new STAFObject(retObj), STAFObjectPtr::INIT);}STAF_INLINE STAFObjectIterator::~STAFObjectIterator(){ STAFObjectIteratorDestruct(&fIter);}STAF_INLINE STAFMapClassDefinitionPtr STAFMapClassDefinition::create( const STAFString &name){ STAFObjectPtr mapClassDefObj = STAFObject::createMap(); mapClassDefObj->put("keys", STAFObject::createList()); mapClassDefObj->put("name", name); return STAFMapClassDefinitionPtr(new STAFMapClassDefinition(mapClassDefObj), STAFMapClassDefinitionPtr::INIT);}STAF_INLINE STAFMapClassDefinitionPtr STAFMapClassDefinition::createReference( STAFMapClassDefinitionPtr source){ return STAFMapClassDefinitionPtr( new STAFMapClassDefinition( STAFObject::createReference(source->fMapClassDefObj)), STAFMapClassDefinitionPtr::INIT);}STAF_INLINE STAFObjectPtr STAFMapClassDefinition::createInstance(){ static STAFString mapClassKey("staf-map-class-name"); STAFObjectPtr mapClassInstance = STAFObject::createMap(); mapClassInstance->put(mapClassKey, fMapClassDefObj->get("name")); return mapClassInstance;}STAF_INLINE STAFMapClassDefinitionPtr STAFMapClassDefinition::reference(){ return STAFMapClassDefinitionPtr( new STAFMapClassDefinition( STAFObject::createReference(fMapClassDefObj)), STAFMapClassDefinitionPtr::INIT);}STAF_INLINE void STAFMapClassDefinition::addKey(const STAFString &keyName){ STAFObjectPtr theKey = STAFObject::createMap(); theKey->put("key", keyName); fMapClassDefObj->get("keys")->append(theKey);}STAF_INLINE void STAFMapClassDefinition::addKey(const STAFString &keyName, const STAFString &displayName){ STAFObjectPtr theKey = STAFObject::createMap(); theKey->put("key", keyName); theKey->put("display-name", displayName); fMapClassDefObj->get("keys")->append(theKey);}STAF_INLINE void STAFMapClassDefinition::setKeyProperty( const STAFString &keyName, const STAFString &propName, const STAFString &propValue){ for (STAFObjectIteratorPtr iter = fMapClassDefObj->get("keys")->iterate(); iter->hasNext();) { STAFObjectPtr thisKey = iter->next(); if (thisKey->get("key")->asString() == keyName) thisKey->put(propName, propValue); }}STAF_INLINE STAFObjectIteratorPtr STAFMapClassDefinition::keyIterator(){ return fMapClassDefObj->get("keys")->iterate();}STAF_INLINE STAFString STAFMapClassDefinition::name() const{ return fMapClassDefObj->get("name")->asString();}STAF_INLINE STAFObjectPtr STAFMapClassDefinition::getMapClassDefinitionObject(){ return fMapClassDefObj;}STAF_INLINE STAFMapClassDefinition::STAFMapClassDefinition( STAFObjectPtr mapClassDefObj) : fMapClassDefObj(mapClassDefObj){ /* Do nothing */}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -