Getting and Setting Specific Data (color, binary, resbuf)
Tagged data can store additional specific information:
Color object — The group code 5011 defines a color object
as an instance of the OdCmColor type.
Resbuf-object — The group code 5023 defines another resbuf-object as an instance of the
OdResBuf type and is used for storing nested structures of resbuf-instances.
Binary chunk — Group codes 310 to 319 and 1004
define data as a binary chunk.
In the following examples, the pRb variable stores a pointer to the resbuf-object, and the pDb
variable stores a pointer to the database object.
Color Value
To get a color, use the getColor() method which does not have arguments and returns an instance of the
OdCmColor type. For example:
OdCmColor color = pRb->getColor();
odPrintConsoleString(L"\nValue = %s", color.colorNameForDisplay().c_str());
To set the color, use the setColor() method which requires an instance of the OdCmColor type as an argument
and does not return a value. For example:
Note: The specific group code kRtColor (5011) defines the color object as data of the resbuf-object.
Binary Chunk Value
To get a binary chunk, use the getBinaryChunk() method which does not have arguments and returns an instance
of the OdBinaryData type. For example:
OdBinaryData chunk = pRb->getBinaryChunk();
int i, size;
size = chunk.length();
odPrintConsoleString(L"\nChunk = ");
for(i=0 ; i < size ; i++)
odPrintConsoleString(L"\n%x", chunk.at(i));
To set a binary chunk, use the setBinaryChunk() method which requires an instance of the OdBinaryData type as an
argument and does not return a value. For example:
One resbuf-instance can be nested in another resbuf-instance as a data value. The specific group code kRtResBuf
(5023) defines an instance of the OdResBuf type as data of the resbuf-object.
To get the nested resbuf-instance, use the getResBuf() method which does not have arguments and returns the typified
smart pointer to the instance of the OdResBuf type. For example:
OdResBufPtr pNest = pRb->getResBuf();
odPrintConsoleString(L"\nNested ResBuf Type = %d", pNest->restype());
To set the resbuf-instance as a nested sub-structure, use the setResBuf() method which requires an instance of the
OdResBuf type as an argument and does not return a value. For example: