Tagged data can store a string value, grouped into the following categories:
Arbitrary strings — An arbitrary string can be up to 255 characters long and can contain
any letters. Group codes 1 , 300 to 309, 410 to 419, 470 to 479, 1000, and 5005 define data as an
arbitrary string.
Control strings — A control string can be "{" or "}" and subdivides tagged data into
logical blocks. The left brace begins a block and the right brace ends a block. Group codes 102 and
1002 define data as a control string.
Names of objects — A name is a nonempty string that can be up to 255 characters long
and can contain admissible letters for objects (see Naming objects).
Group codes 2 to 4, 6 to 9, 1001, and 1003 define data as a name of an object.
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.
Getting a String Value
To get any string value, use the getString() method which does not have arguments and returns an
instance of the OdString type. For example:
To set a control string, pass the left brace for opening a block or right brace for closing a block to
the setString() method. Only the 102 or 1002 codes are controlled and must be used in pairs: (102,"{") — (102,"}")
for DXF technology or (1002,"{") — (1002,"}") for XData technology. For example:
// Open a block
pRb->setRestype(102);
pRb->setString("{");
// Close a block
pRb->setRestype(102);
pRb->setString("}");
Setting a Name of an Object
To set a name, set the data type corresponding to the specified object and pass the name of an existing
object to the setString() method as a data value. For example:
// Set the layer name
OdDbLayerTableRecordPtr pLayer = pDb->getLayerZeroId().safeOpenObject();
pRb->setRestype(1003);
pRb->setString(pLayer->getName());
// Set the text style name
OdDbTextStyleTableRecordPtr pTextStyle = pDb->getTextStyleStandardId().safeOpenObject();
pRb->setRestype(7);
pRb->setString(pTextStyle->getName());
Note: The passed data value must correspond to the specified data type, otherwise the exception
"68 - Invalid ResBuf" occurs. When a string is a name, the object must exist in the database.