a2dIOHandlerKeyIn Class Reference
[File IO]

Input driver for KEY format files. More...

#include <keyio.h>

Inheritance diagram for a2dIOHandlerKeyIn:

Inheritance graph
[legend]
Collaboration diagram for a2dIOHandlerKeyIn:

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool LinkReferences ()
 link references to their destination
wxChar PeekNextC ()
void IncC ()
virtual bool CanLoad (a2dDocumentInputStream &stream, const wxObject *obj=NULL, wxClassInfo *docClassInfo=NULL)
 Should return true if the handler can read from the stream.
virtual bool Load (a2dDocumentInputStream &stream, wxObject *doc)
 override to read the stream and store (part of) the contents in to a specific a2dDocument or othere object.
virtual void InitializeLoad ()
 Inits the handler for reading.
virtual void ResetLoad ()
 Reset the handler after loading.

Protected Member Functions

bool GetCommand ()
bool NormalWord ()
bool QuotedString ()
bool BracedString ()
bool Comment ()
bool Blanks ()
bool Word ()
bool ReadItem (const wxString &type)
bool SkipXYData ()
double ReadDouble ()
void SetDataTypeProperty (a2dCanvasObject *toobject, wxUint16 type)
 set datatype of elements as a property
void ReadKey ()
bool ReadBgnlib ()
bool ReadProperties (a2dCanvasObject *parent)
bool ReadBoundary (a2dCanvasObject *parent)
bool ReadSurface (a2dCanvasObject *parent)
bool ReadPath (a2dCanvasObject *parent)
bool ReadText (a2dCanvasObject *parent)
bool ReadStructureReference (a2dCanvasObject *parent)
bool ReadArrayReference (a2dCanvasObject *parent)
bool ReadNode (a2dCanvasObject *parent)
bool ReadBox (a2dCanvasObject *parent)
bool ReadCircle (a2dCanvasObject *parent)
bool ReadArc (a2dCanvasObject *parent)
bool ReadLine (a2dCanvasObject *parent)
bool ReadImage (a2dCanvasObject *parent)
bool ReadElflags (a2dCanvasObject *object)
bool ReadGdsHeader ()
bool ReadLayer (a2dCanvasObject *object)
bool ReadLibrarySettings ()
bool Read (a2dPoint2D &_Point)
bool ReadStrans (Strans &_Strans)
bool ReadStructure (a2dCanvasObject *parent)
bool ReadElement (a2dCanvasObject *parent)
bool ReadTextBody ()
bool ReadPolygon (a2dVertexList *segments)
bool ReadPolyline (a2dVertexList *segments)
void SetFlags (a2dCanvasObject *Element)

Protected Attributes

bool m_back
 last read record is stored
wxString m_keyword
 keyword for record in KEY data
wxString m_value
 value for record in KEY data
int m_recordtype
 type of the record in KEY data
wxUint32 m_linenumber
 last read line in DATA
wxChar a
wxString m_error_mes
wxString m_b
TWO_G_BYTE_UNSIGNED_INTEGER m_recordsize
 size of the last read record
int m_mapping [wxMAXLAYER]
 mapping of GDSII layers to internal layers
a2dCanvasDocumentm_doc
 the document to store/load the data found into
double m_scale_in
double m_userunits_out
int m_objectFlags
wxUint16 m_lastElementLayer


Detailed Description

Input driver for KEY format files.

Every record in the KEY file is read/mapped into the right internal structure The KEY file is parsed according to the BNF of the KEY format. Info on the different record types that are read can be found in the KEY format manual All basic data types are read using a specialized function that now how those types are stored in KEY. For layers settings this handler checks for a file with the same name as the document that is loaded, but with extension ".cvg", if it does exist it will be used to read layers (in CVG format).

Definition at line 43 of file keyio.h.


Member Function Documentation

bool a2dIOHandlerKeyIn::LinkReferences (  )  [virtual]

link references to their destination

Override this to define input format specific needs for linking references in a certain format. In the default situation the parser uses m_objecthashmap to store object to which references can be made, while m_lastObjectId is used to store unresolved references. Here those to are resolved.

In the CVG format one can store multiple refrences to one and the same object. The object that is referenced is only written once, for the other references only the object with refid or specific id attributes are written to the CVG file. When loading a file in CVG, such references are resolved and removed from the document. So in the end the old reference is restored. When loading an object, it is created, but its contents will be empty, after resolving, this one will be replaced by the real referenced object. The reason behind all this, is that the actual object might need to be read yet, when a reference is encountered in the CVG file, and therefore the link can not be directly created. In other formats references are used in a simular manner, and to resolve them the same mechanism is used.

Some input/ouput formats are organized in a list of grouped objects, the hierarchy is created after the whole file is read into memory. All non referenced objects are direct childs of the rootobject. In the GDSII format these are called top structures.

Returns:
true if all references were resolved.

Reimplemented from a2dIOHandler.

Definition at line 511 of file keyio.cpp.

bool a2dIOHandlerKeyIn::CanLoad ( a2dDocumentInputStream stream,
const wxObject *  obj = NULL,
wxClassInfo *  docClassInfo = NULL 
) [virtual]

Should return true if the handler can read from the stream.

A typical implementation is to read the first part of the file, to see if the contents is right for this handler. Then it resets the file pointer to the beginning again.

In general a handler is written with a certain type of document in mind, since that is where the information will be stored. The document view framework, uses document templates to get to input handlers. The last 2 parameters can be checked if set. Use SetDocumentClassInfo() to set the right classinfo, in case of a derived document object, which still can be read with the this handler. Like:

        a2dIOHandlerKeyIn* keyhin = new a2dIOHandlerKeyIn();
        keyhin->SetDocumentClassInfo( &MyDocument::ms_classInfo );

Parameters:
stream the open stream which its header can be tested
obj to check and load the data into, needs to be casted to the right one internal.
docClassInfo to check if the inout handler is indeed able to read document of m_docClassInfo.

Implements a2dIOHandlerStrIn.

Definition at line 474 of file keyio.cpp.

bool a2dIOHandlerKeyIn::Load ( a2dDocumentInputStream stream,
wxObject *  obj 
) [virtual]

override to read the stream and store (part of) the contents in to a specific a2dDocument or othere object.

Understand that a a2dDocument itself is useless for storing data, so it needs to be casted internal.

Parameters:
stream the open stream to load from
obj to load the data into, needs to be casted to the right one internal.

Implements a2dIOHandlerStrIn.

Definition at line 531 of file keyio.cpp.


The documentation for this class was generated from the following files:
a2dIOHandlerKeyIn Class Reference -- Tue Aug 31 18:29:04 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation