本文整理汇总了C++中AcDbDictionary::cancel方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDictionary::cancel方法的具体用法?C++ AcDbDictionary::cancel怎么用?C++ AcDbDictionary::cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDictionary
的用法示例。
在下文中一共展示了AcDbDictionary::cancel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAppDictionary
AcDbObjectId OarxEmployeeService::getAppDictionary () {
AcDbDictionary *pNOD =NULL ;
AcDbDictionary *pFirmDict =NULL ;
AcDbDictionary *pAppDict =NULL ;
try {
//----- Get hold of the NOD
ARXOK ( getNOD (pNOD, AcDb::kForRead) ) ;
//----- Get our Firm Dictionary
AcDbObjectId id0 ;
if ( pNOD->getAt (OARX_FIRM_DICT, id0) == Acad::eKeyNotFound ) {
//----- Then create it
pFirmDict =new AcDbDictionary ;
if ( pFirmDict == NULL )
throw Acad::eOutOfMemory ;
ARXOK ( pNOD->upgradeOpen () ) ;
ARXOK ( pNOD->setAt (OARX_FIRM_DICT, pFirmDict, id0) ) ;
} else {
//----- Open the dictionary
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pFirmDict, id0, AcDb::kForRead) ) ;
}
//----- Get our App Dictionary
if ( pFirmDict->getAt (OARX_APP_DICT, id0) == Acad::eKeyNotFound ) {
//----- Then create it
pAppDict =new AcDbDictionary ;
if ( pAppDict == NULL )
throw Acad::eOutOfMemory ;
if ( pFirmDict->isWriteEnabled () == false )
ARXOK ( pFirmDict->upgradeOpen () ) ;
ARXOK ( pFirmDict->setAt (OARX_APP_DICT, pAppDict, id0) ) ;
id0 =pAppDict->objectId () ;
}
pNOD->close () ;
pFirmDict->close () ;
pAppDict->close () ;
return (id0) ;
} catch (const Acad::ErrorStatus es) {
if ( pNOD != NULL )
pNOD->cancel () ;
if ( pFirmDict != NULL && pFirmDict->objectId () == AcDbObjectId::kNull )
delete pFirmDict ;
else if ( pFirmDict != NULL )
pFirmDict->cancel () ;
if ( pAppDict != NULL && pAppDict->objectId () == AcDbObjectId::kNull )
delete pAppDict ;
else
pAppDict->cancel () ;
return (AcDbObjectId::kNull) ;
}
}
示例2: isEmployeeExist
//-----------------------------------------------------------------------------
//----- This is the AcRxService class Implementation
Adesk::Boolean OarxEmployeeService::isEmployeeExist (int id) {
AcDbDictionary *pNOD =NULL ;
AcDbDictionary *pFirmDict =NULL ;
AcDbDictionary *pAppDict =NULL ;
try {
//----- Get hold of the NOD
ARXOK ( getNOD (pNOD, AcDb::kForRead) ) ;
//----- Get our Firm Dictionary
AcDbObjectId id0 ;
ARXOK ( pNOD->getAt (OARX_FIRM_DICT, id0) ) ;
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pFirmDict, id0, AcDb::kForRead) ) ;
//----- Get our App Dictionary
ARXOK ( pFirmDict->getAt (OARX_APP_DICT, id0) ) ;
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pAppDict, id0, AcDb::kForRead) ) ;
//----- Check if that entry already exist
char buffer [33] ;
sprintf (buffer, "%d", id) ;
Adesk::Boolean bRet =pAppDict->has (buffer) ;
//----- Normally we should have open the associated XRecord, and check the validity of
//----- the SoftPointerId which is supposed to point to an OarxEmployee entity... But
//----- to simplify the sample we stop checking here!
pNOD->close () ;
pFirmDict->close () ;
pAppDict->close () ;
return (bRet) ;
} catch (const Acad::ErrorStatus es) {
if ( pNOD != NULL )
pNOD->cancel () ;
if ( pFirmDict != NULL )
pFirmDict->cancel () ;
if ( pAppDict != NULL )
pAppDict->cancel () ;
return (Adesk::kFalse) ;
}
}
示例3: postToDatabase
OarxEmployee *OarxEmployeeService::createEmployee (int id, AcGePoint3d location, int cubeNumber, char *strFirstName, char *strLastName) {
OarxEmployee *p =NULL ;
AcDbXrecord *pRec =NULL ;
AcDbDictionary *pAppDict =NULL ;
try {
//----- Create the object
p =new OarxEmployee ;
if ( p == NULL )
throw Acad::eOutOfMemory ;
ARXOK ( p->setID (id) ) ;
ARXOK ( p->setCubeNumber (cubeNumber) ) ;
ARXOK ( p->setFirstName (strFirstName) ) ;
ARXOK ( p->setLastName (strLastName) ) ;
ARXOK ( p->setCenter (location) ) ;
AcDbObjectId id0 ;
ARXOK ( postToDatabase (p, id0) ) ;
pRec =new AcDbXrecord ;
if ( pRec == NULL )
throw Acad::eOutOfMemory ;
struct resbuf rb ;
rb.restype =330 ; //----- SoftPointerId to the OarxEmployee entity
rb.rbnext =NULL ;
ARXOK ( acdbGetAdsName (rb.resval.rlname, id0) ) ;
ARXOK ( pRec->setFromRbChain (rb) ) ;
pRec->setXlateReferences (Adesk::kTrue) ;
AcDbObjectId idDict =getAppDictionary () ;
if ( idDict == AcDbObjectId::kNull )
throw Acad::eNullObjectId ;
ARXOK ( acdbOpenAcDbObject ((AcDbObject *&)pAppDict, idDict, AcDb::kForWrite) ) ;
char buffer [33] ;
sprintf (buffer, "%d", id) ;
ARXOK ( pAppDict->setAt (buffer, pRec, id0) ) ;
pRec->close () ;
pAppDict->close () ;
return (p) ;
} catch (const Acad::ErrorStatus es) {
if ( p != NULL && p->objectId () == AcDbObjectId::kNull )
delete p ;
else
p->cancel () ;
if ( pRec != NULL && pRec->objectId () == AcDbObjectId::kNull )
delete pRec ;
else
pRec->cancel () ;
if ( pAppDict != NULL )
pAppDict->cancel () ;
return (NULL) ;
}
}