void EditSFieldHandle<SFChunkBlockPtrMap>::add( FieldContainer *rhs, const std::string &szBindings) { ChunkBlock *pVal = dynamic_cast<ChunkBlock *>(rhs); KeyType oKey = 0x0000; if(pVal == NULL) { MapHelper *pMHelper = dynamic_cast<MapHelper *>(rhs); if(pMHelper != NULL) { pVal = dynamic_cast<ChunkBlock *>(pMHelper->getContainer()); const MapHelper::MFKeysType *pKeys = pMHelper->getMFKeys(); if(pKeys->empty() == false) { KeyType tmpKey = KeyPool::the()->getDefault(); for(UInt32 i = 0; i < pKeys->size(); ++i) { const std::string &szKey = pMHelper->getKeys(i); tmpKey = KeyPool::the()->getAuto(szKey.c_str()); oKey |= tmpKey; } } } } else { if(szBindings.empty() == false) { oKey = KeyPool::the()->getAuto(szBindings.c_str()); } } if(rhs != NULL && pVal == NULL) return; // for whatever reason VS2003 does not like == NULL if(_fAddMethod) { _fAddMethod(pVal, oKey); } }
void EditSFieldHandle<SFAttachmentPtrMap>::add( FieldContainer *rhs, const std::string &szBindings) { Attachment *pVal = dynamic_cast<Attachment *>(rhs); UInt32 uiBindings = 0; if(pVal == NULL) { MapHelper *pMHelper = dynamic_cast<MapHelper *>(rhs); if(pMHelper != NULL) { pVal = dynamic_cast<Attachment *>(pMHelper->getContainer()); if(pMHelper->getMFKeys()->empty() == false) { const std::string &szKey = pMHelper->getKeys(0); uiBindings = TypeTraits<UInt32>::getFromCString(szKey.c_str()); } } } else { if(szBindings.empty() == false) { uiBindings = TypeTraits<UInt32>::getFromCString(szBindings.c_str()); } } if(rhs != NULL && pVal == NULL) return; // for whatever reason VS2003 does not like == NULL if(_fAddMethod) { _fAddMethod(pVal, uiBindings); } }