www.mxdraw.com
内容索引主面
前一个向上下一个
McDbGroup 类

McDbGroup类表示由一个名称标识的一个实体集,McDbGroup存放于McDbDatabase里的组字典中, McDbDatabase::getGroupDictionary函数组字典对象

C++
class McDbGroup : public McDbObject;

McDbGroup.h

例如: 得到实体所在组

        McDbObjectId   getGroup(IN McDbObjectId entId)
        {
            McDbDatabase* pDatabase = NULL;
            {
                McDbObjectPointer<McDbEntity> spEnt(entId,McDb::kForRead);
                if(spEnt.openStatus() != Mcad::eOk)
                    return McDbObjectId::kNull;
                pDatabase = spEnt->database();
            }

            McDbObjectPointer<McDbDictionary> spDict;
            McDbDictionary  * pDict = NULL;
            if(pDatabase->getGroupDictionary(pDict,McDb::kForWrite) != Mcad::eOk)
            {

                return McDbObjectId::kNull;
            }
            spDict.acquire(pDict);

            McDbDictionaryIterator* pIter = spDict->newIterator();
            std::auto_ptr<McDbDictionaryIterator> spIter(pIter);

            for(;!pIter->done();pIter->next())
            {
                McDbObjectPointer<McDbGroup> spGroup(pIter->objectId(),McDb::kForRead);
                if(spGroup.openStatus() != Mcad::eOk)
                {

                    continue;;
                }

                if(spGroup->has(entId) )
                {

                    return pIter->objectId();

                }
            }

            return McDbObjectId::kNull;
        }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!