Share

AcDbObject::subErase

C++

Acad::ErrorStatus subErase(
    Adesk::Boolean erasing
) override;

Description

Called from within erase() before anything else is done. The default implementation is to return Acad::eOk. However, when overridden in custom classes, it provides a hook into the erase operation. If it returns anything other than Acad::eOk, then the erase operation is immediately terminated.

When overriding this function, a sequence of steps is required:

  1. Check to be sure everything is correct with the AcDbObject's state. If not, then immediately return a value other than Acad::eOk, which terminates the erase operation.
  2. Call the parent class's subErase(). If this returns Acad::eOk, then continue; otherwise immediately return whatever the parent class's subErase() returned.
  3. Do any operations desired before the erase operation continues.
  4. Return Acad::eOk to allow the erase operation to continue normally.
Note

When implementing your own subErase(), it is best not to change any of the object's state at all. But, if you must, then it is best to make such changes after invoking the parent class's subErase(), just in case it returns an error code other than Acad::eOk. If you must change state before invoking the parent class's subErase(), then be prepared to reverse the changes if the parent class returns a status other than Acad::eOk.

Parameters

Parameters Description
erasing Passed in copy of the erasing argument that was passed into the erase() function call that triggered this subErase() call

Links

AcDbRasterImageDef

Was this information helpful?