The dimeRecordHolder class is a superclass for objects that store records. More...
#include <RecordHolder.h>
Inherits dimeBase.
Inherited by dimeClass, dimeEntity, dimeObject and dimeTableEntry.
This class makes it very easy to add new classes to dxflib, as it handles all of the reading, error checking and storing of records of no use to the subclass. Subclasses will only need to implement the dimeRecordHolder::handleRecord() and dimeRecordHolder::getRecord() methods.
Constructor. separator is the group code that will separate objects, to enable the record holder to stop reading the object at the correct time. For instance, entities are separated by group code 0 (a group code 0 signals a new entity is about to start).
[virtual]
Destructor.
Sets the data for the record with group code groupcode. If the record already exists, it's value will simply be overwritten, otherwise a new record will be created. If the record is handled by a subclass, param will be passed on to the subclass (using dimeRecordHolder::handleRecord()), and will be ignored by dimeRecordHolder.
For entities, you cannot use this method to set the layer name. Use dimeEntity::setLayer() to do that. Also, you should not use this function to set the block name for a dimeInsert entity; use dimeInsert::setBlock() instead.
Sets an array of entities. It is much more efficient to use this than using dimeRecordHolder::setRecord() several times if you are going to set the value of more than one record. Otherwise behaves exactly as dimeRecordHolder::setRecord().
[virtual]
Will return the value of the record with group code groupcode. false is returned if the record could not be found. Subclasses should overload this method if one or several records are stored in the class. If the groupcode queried is not stored internally, the subclass should call its parent's method.
Reimplemented in dime3DFace, dimeArc, dimeBlock, dimeCircle, dimeEllipse, dimeEntity, dimeExtrusionEntity, dimeFaceEntity, dimeInsert, dimeLWPolyline, dimeLine, dimePoint, dimePolyline, dimeSolid, dimeSpline, dimeTrace and dimeVertex.
[virtual]
Reads records from in until the separator groupcode (specified in constructor) is found. Can be overloaded by subclasses, but in most cases this will not be necessary as dimeRecordHolder::handleRecord() is called for each record found in the stream.
Reimplemented in dimeBlock, dimeClass, dimeEntity, dimeInsert, dimeLayerTable, dimeObject, dimePolyline and dimeTableEntry.
[virtual]
Will write the records to file.
Reimplemented in dime3DFace, dimeArc, dimeBlock, dimeCircle, dimeClass, dimeEllipse, dimeEntity, dimeInsert, dimeLWPolyline, dimeLayerTable, dimeLine, dimeObject, dimePoint, dimePolyline, dimeSolid, dimeSpline, dimeTableEntry, dimeTrace, dimeUCSTable, dimeUnknownClass, dimeUnknownEntity, dimeUnknownObject, dimeUnknownTable and dimeVertex.
[virtual]
Reimplemented from dimeBase.
Reimplemented in dimeClass, dimeEntity, dimeExtrusionEntity, dimeFaceEntity, dimeObject and dimeTableEntry.
[virtual]
Returns the number of records in the record holder. Should be overloaded by subclasses which should count their records, and then call the parent's method. This method is used to precalculate the number of records to be written. Very useful when progress information is needed during write().
Reimplemented in dime3DFace, dimeArc, dimeBlock, dimeCircle, dimeClass, dimeEllipse, dimeEntity, dimeExtrusionEntity, dimeFaceEntity, dimeInsert, dimeLWPolyline, dimeLayerTable, dimeLine, dimeObject, dimePoint, dimePolyline, dimeSolid, dimeSpline, dimeTableEntry, dimeTrace, dimeUCSTable, dimeUnknownClass, dimeUnknownEntity, dimeUnknownObject, dimeUnknownTable and dimeVertex.
Returns the record with group code groupcode. Returns NULL if the record is not found.
[protected, virtual]
Must be overloaded by entities that directly supports a record type. During dimeRecordHolder::read(), dimeRecordHolder::setRecord() and dimeRecordHolder::setRecords(), this function is called for every record found, and it is up to the subclass if the record should be stored internally, or if a generic record should be created and stored in this superclass. A subclass should return \true when it will handle the record, false otherwise. Default function does nothing, and returns false.
For entities, records with group codes 8 (layer name) and 62 (color number) are automatically handled by the dimeEntity class.
Reimplemented in dime3DFace, dimeArc, dimeBlock, dimeCircle, dimeClass, dimeEllipse, dimeEntity, dimeExtrusionEntity, dimeFaceEntity, dimeInsert, dimeLWPolyline, dimeLayerTable, dimeLine, dimeObject, dimePoint, dimePolyline, dimeSolid, dimeSpline, dimeTableEntry, dimeTrace, dimeUCSTable and dimeVertex.
[protected]
Copies the stored records into rh.