Share

AcDbObject::setXData

C++

virtual ACDBCORE2D_PORT Acad::ErrorStatus setXData(
    const resbuf* xdata
);

Description

Each regapp sublist (delimited by a resbuf with restype == 1001 and resval.rstring == a valid regappName string) within the resbuf chain pointed to by xdata, is placed in the xdata area of the object. If any of the regappNames in xdata are already present in the xdata area of the object, then that regappName's existing data on the object is overwritten by that regappName's new data in xdata.

All resbufs with restype == 1001 must have valid regappNames for the database the object resides in (that is, the regappNames must be in the APPID table of the database).

Only valid xdata group codes (1000--1071) are accepted in the restype fields of the resbufs in xdata.

No "-3" group code is necessary, and in fact, is not accepted. So, the first element in the resbuf chain must be a 1001 group code with a resval.rstring set to a regappName that's already registered in the regapp table. To register a regappName, use the acdbRegApp() function.

To remove an appName (and its xdata) from an object, just use a resbuf with restype == 1001, resval == and no data resbufs following it (that is, either its rbnext == NULL or the next resbuf is another 1001)

This function is virtual because some objects or entities may need to store some or all of their "built-in" state as xdata. Classes defining such objects can override this function in order to monitor and validate xdata requests as they see fit. If an object does not care about what xdata is attached to it (which is the preferred practice), then it need not override this member.

If this function is overridden, then it should supermessage its parent in order to invoke the built-in mechanism to add the xdata to the object.

Returns Acad::eOk if the xdata is successfully added to the object. If there is insufficient space in the xdata area of the object, then Acad::eXdataSizeExceeded is returned. If any of the regappNames in xdata are not in the APPID table, then Acad::eRegappIdNotFound is returned.

Parameters

Parameters Description
xdata Input linked list of resbuf structures containing xdata

Links

AcDbObject

Was this information helpful?