Share

AcDbDxfFiler::readResBuf

C++

virtual Acad::ErrorStatus readResBuf(
    resbuf* pRb
);

Description

This method is the only actual "read" input function provided to read data.

The pRb->restype value indicates what data type is in the resbuf's resval union. See the AcDbDxfFiler DXF Group Codes section for information on which DXF group codes indicate which data types.

For single data items such as doubles or ints, this method should follow that of the ObjectARX internal filers. It should:

  • Read in the AcDb::DxfCode value and the actual data value that goes with it.
  • Place the DxfCode in the pRb->restype field.
  • Place the data item in the appropriate field of the pRb->resval union.

For data items such as points and vectors that have multiple components, this method should follow that of the ObjectARX internal filers. It should:

  • Read in all the components and their DxfCodes.
  • Place the first of the DxfCodes in pRb->restype.
  • Place the data items in the pRb->resval.rpoint array.

For AcDbObjectId data items (including handles), this method should follow that of the ObjectARX internal filers. It should:

  • Read in the AcDb::DxfCode value and the actual data value that goes with it.
  • Place the DxfCode in the pRb->restype field.
  • Read in a handle rather than an objectId, if reading from a DXF file. In this case the handle must be converted to the appropriate objectId (using the AcDbDatabase::getAcDbObjectId() method).
  • Place the 64-bit handle value in the first element of the pRb->resval.rlname array.

For string data items, this method should follow that of the ObjectARX internal filers. It should:

  • Read in the AcDb::DxfCode value and the actual data value that goes with it.
  • Place the DxfCode in the pRb->restype field.
  • Use acdbAlloc() to allocate memory to copy the string into.
  • Copy the string into the newly allocated memory.
  • Set the pRb->resval.rstring pointer to the address of the new string copy.
Warning

The ObjectARX internal filers maintain their own copy of the string pointer and free the memory it points to before each new read. So, callers of this function must make their own copy of the string returned, rather than just copying the returned string's address.

For binary data items, this method should follow that of the ObjectARX internal filers. It should:

  • Read in the AcDb::DxfCode value and the actual data value that goes with it.
  • Place the DxfCode in the pRb->restype field.
  • Use acdbAlloc()to allocate memory to copy the binary data into (the first two bytes of the binary data are the length of the actual binary data that makes up the rest of the data item).
  • Copy the binary data into the newly allocated memory.
  • Set pRb->resval.rbinary.clen to the length of the binary data.
  • Set the pRb->resval.rbinary.buf pointer to the address of the new binary data copy.
Warning

The ObjectARX internal filers maintain their own copy of the pointer to the binary data buffer and free the memory it points to before each new read. So, callers of this function must make their own copy of the binary data returned, rather than just copying the returned buffer's address.

If successful, this method should follow that of the ObjectARX internal filers and return Acad::eOk.

If an error occurs, this method should this method should follow that of the ObjectARX internal filers. It should set pRb->restype to AcDb::kDxfInvalid, set an appropriate error message string in the filer, and return an appropriate Acad::ErrorStatus value.

The default implementation of this method is to terminate AutoCAD. If this function is called when the filer is filing out, AutoCAD is terminated.

Parameters

Parameters Description
unnamed Pointer to resbuf structure to be read in

Links

AcDbDxfFiler

Was this information helpful?