本文整理汇总了C++中AcDbEntity::database方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::database方法的具体用法?C++ AcDbEntity::database怎么用?C++ AcDbEntity::database使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::database方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Acad::ErrorStatus
ArxDbgUtils::verifyEntityReference(const AcDbEntity* ent, const AcDbObjectId& idToValidate,
AcRxClass* classType, bool allowNull, bool allowErased)
{
if (ent == NULL) {
ASSERT(0);
return Acad::eInvalidInput;
}
// first check for NULL
if (idToValidate == AcDbObjectId::kNull) {
if (allowNull)
return Acad::eOk;
else
return Acad::eNullObjectId;
}
// now open it up and see what it is
Acad::ErrorStatus es;
AcDbEntity* entToValidate;
es = acdbOpenAcDbEntity(entToValidate, idToValidate, AcDb::kForRead);
if (es == Acad::eOk) {
// make sure all references are from the same database
// which should always be the case!
if (ent->database() != entToValidate->database()) {
entToValidate->close();
return Acad::eWrongDatabase;
}
// make sure that references are from the same block
// This can fail from a simple deepClone() to make a
// blockTableRecord. If the user didn't pick all the
// referenced objects in the anchor at the time of
// making the block, they will still point to the
// entities in modelSpace... which will eventually crash
// the whole thing.
if (ent->blockId() != entToValidate->blockId()) {
entToValidate->close();
return Acad::eNotInBlock;
}
// see if they want to validate based on object type
if (classType != NULL) {
es = verifyClassType(entToValidate, classType);
if (es != Acad::eOk) {
entToValidate->close();
return es;
}
}
entToValidate->close();
return Acad::eOk; // passed our test
}
else if (es == Acad::eWasErased) {
if (allowErased)
return Acad::eOk; // passed under relaxed constraints
else
return Acad::eWasErased; // failed
}
else {
return es; // failed
}
}