SERIALIZER Class Reference

Class for serializing object instances to file. More...

#include <mi32/serializer.h>

List of all members.

Public Member Functions

 SERIALIZER ()
virtual ~SERIALIZER ()
ERRVALUE Append (const FILEPATH &filepath)
void Close ()
const FILEPATHGetFilePath () const
bool GetIgnoreSkippable () const
const char * GetItemName () const
bool GetItemValue (double &value) const
const MIUNICODEGetItemValue () const
MISTRINGGetLog ()
const MISTRINGGetLog () const
const MIUNICODEGetObjectName () const
void GetScanListMissing (RVC::OBJITEMLIST &MissingList)
void GetScanListUsed (RVC::OBJITEMLIST &UsedList)
UINT16 GetVersion () const
bool IsScanOnly () const
void LogClear ()
void LogError (ERRVALUE err)
void LogText (const MISTRING &text)
ERRVALUE Make (const FILEPATH &filepath, int version=1)
ERRVALUE Make (RVC::OBJECT &parent, RVC::OBJTYPE objtype, RVC::DESCRIPTOR &descriptor, const RVC::SERIALIZE::MAKEPARMS &makeparms)
ERRVALUE Make (RVC::OBJITEM &objitem, const RVC::SERIALIZE::MAKEPARMS &makeparms)
ERRVALUE Open (const FILEPATH &filepath)
ERRVALUE Open (const RVC::OBJITEM &objitem)
ERRVALUE PutBegin (const char *tagname, UINT16 version=0)
ERRVALUE PutDouble (const char *tagname, double value)
ERRVALUE PutEnd ()
ERRVALUE PutInt (const char *tagname, int value)
ERRVALUE PutItem (const char *tagname, const SPATREF::COORDREFSYS &crs)
ERRVALUE PutItem (const char *tagname, const OLDPROJPARM &oldprojparm)
ERRVALUE PutItem (const char *tagname, const DOUBLE_RANGE &value)
ERRVALUE PutItem (const char *tagname, const LRECT2D &rect)
ERRVALUE PutItem (const char *tagname, const LPOINT2D &point2d)
ERRVALUE PutItem (const char *tagname, const DRECT3D &rect)
ERRVALUE PutItem (const char *tagname, const DRECT2D &rect)
ERRVALUE PutItem (const char *tagname, const DPOINT3D &point3d)
ERRVALUE PutItem (const char *tagname, const DPOINT2D &point2d)
ERRVALUE PutItem (const char *tagname, const COLOR &color)
ERRVALUE PutStr (const char *tagname, const MIUNICODE *str)
ERRVALUE PutStrML (const char *tagname, const MIUNICODE *str)
ERRVALUE PutUnsigned (const char *tagname, unsigned int value)
ERRVALUE Read (OLDPROJPARM &oldprojparm)
ERRVALUE Read (const char *tagname, const SERIALIZERITEM *itemdef, void *data)
ERRVALUE Read (const SERIALIZERITEM *itemdef, void *data)
ERRVALUE Read (const char *tagname, SERIALIZABLE &object)
ERRVALUE Read (SERIALIZABLE &object)
ERRVALUE Rewind ()
void SetIgnoreSkippable (bool IgnoreSkippable=true)
void SetScanOnly (bool ScanOnly)
void SetVersion (UINT16 Version)
ERRVALUE SkipStruct ()
ERRVALUE StatusTextUpdate (const MISTRING &string)
ERRVALUE Write (const SERIALIZABLE &object, const char *tagname=0)
ERRVALUE Write (const char *tagname, const SERIALIZERITEM *itemdef, const void *data, UINT16 version=0)
ERRVALUE Write (const SERIALIZERITEM *itemdef, const void *data)

Detailed Description

Class for serializing object instances to file.

The SERIALIZER class provides methods to write object instances to a text file/object and read those instances back into memory later. The design allows for the object structure to change while maintaining compatibility with previously existing files.


Constructor & Destructor Documentation

SERIALIZER::SERIALIZER (  ) 

Default constructor.

virtual SERIALIZER::~SERIALIZER (  )  [virtual]

Destructor.


Member Function Documentation

ERRVALUE SERIALIZER::Append ( const FILEPATH filepath  ) 

Open text file containing serialization to append.

Parameters:
filepath Text file path
void SERIALIZER::Close (  ) 

Close the serializer, will be done in destructor.

const FILEPATH& SERIALIZER::GetFilePath (  )  const [inline]

Get path to serialization file.

bool SERIALIZER::GetIgnoreSkippable (  )  const [inline]

Determine if ignoring "skippable" items.

const char* SERIALIZER::GetItemName (  )  const [inline]

Get name of current item being read/written.

bool SERIALIZER::GetItemValue ( double &  value  )  const

Get value for current item as double.

Returns:
true if could convert, false if not
Parameters:
value Value returned
const MIUNICODE* SERIALIZER::GetItemValue (  )  const [inline]

Get value for current item being read.

MISTRING& SERIALIZER::GetLog (  )  [inline]
const MISTRING& SERIALIZER::GetLog (  )  const [inline]
const MIUNICODE* SERIALIZER::GetObjectName (  )  const [inline]

Get name of object, will be blank if text file.

void SERIALIZER::GetScanListMissing ( RVC::OBJITEMLIST MissingList  )  [inline]

Get list of missing files/objects after scan, also clears the list.

void SERIALIZER::GetScanListUsed ( RVC::OBJITEMLIST UsedList  )  [inline]

Get list of "used" files/objects after scan, also clears the list.

UINT16 SERIALIZER::GetVersion (  )  const [inline]

Get current version setting.

bool SERIALIZER::IsScanOnly (  )  const [inline]

Check if scanning serialization only.

void SERIALIZER::LogClear (  )  [inline]

Clear serialization log.

void SERIALIZER::LogError ( ERRVALUE  err  ) 

Add error message to log.

Will insert newline before and after error text.

void SERIALIZER::LogText ( const MISTRING text  )  [inline]

Add text to log.

ERRVALUE SERIALIZER::Make ( const FILEPATH filepath,
int  version = 1 
)

Create text file to contain serialization.

Parameters:
filepath Text file path
version Version to write
ERRVALUE SERIALIZER::Make ( RVC::OBJECT parent,
RVC::OBJTYPE  objtype,
RVC::DESCRIPTOR descriptor,
const RVC::SERIALIZE::MAKEPARMS makeparms 
)

Create object to contain serialization using parent and descriptor.

Parameters:
parent Parent object
objtype Object type
descriptor Descriptor for new object
ERRVALUE SERIALIZER::Make ( RVC::OBJITEM objitem,
const RVC::SERIALIZE::MAKEPARMS makeparms 
)

Create object to contain serialization using OBJITEM.

Parameters:
objitem Object item reference passed/returned
ERRVALUE SERIALIZER::Open ( const FILEPATH filepath  ) 

Open text file containing serialization to read.

Parameters:
filepath Text file path
ERRVALUE SERIALIZER::Open ( const RVC::OBJITEM objitem  ) 

Open object containing serialization to read.

Parameters:
objitem RVC object item reference
ERRVALUE SERIALIZER::PutBegin ( const char *  tagname,
UINT16  version = 0 
)

Write beginning tag for starting a component.

Parameters:
tagname Tag name to write
version Optional version
ERRVALUE SERIALIZER::PutDouble ( const char *  tagname,
double  value 
)

Write floating-point value.

Parameters:
tagname Tag name
value Value to write
ERRVALUE SERIALIZER::PutEnd (  ) 

Write ending tag at end of a component.

ERRVALUE SERIALIZER::PutInt ( const char *  tagname,
int  value 
)

Write integer value.

Parameters:
tagname Tag name to write
value Value to write
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const SPATREF::COORDREFSYS crs 
)

Write SPATREF::COORDREFSYS item.

Parameters:
tagname Tag name to write
crs Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const OLDPROJPARM oldprojparm 
)

Write OLDPROJPARM item.

Parameters:
tagname Tag name to write
oldprojparm Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const DOUBLE_RANGE value 
)

Write DOUBLE_RANGE item.

Parameters:
tagname Tag name to write
value Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const LRECT2D rect 
)

Write LRECT2D item.

Parameters:
tagname Tag name to write
rect Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const LPOINT2D point2d 
)

Write LPOINT2D item.

Parameters:
tagname Tag name to write
point2d Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const DRECT3D rect 
)

Write DRECT3D item.

Parameters:
tagname Tag name to write
rect Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const DRECT2D rect 
)

Write DRECT2D item.

Parameters:
tagname Tag name to write
rect Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const DPOINT3D point3d 
)

Write DPOINT3D item.

Parameters:
tagname Tag name to write
point3d Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const DPOINT2D point2d 
)

Write DPOINT2D item.

Parameters:
tagname Tag name to write
point2d Item value
ERRVALUE SERIALIZER::PutItem ( const char *  tagname,
const COLOR color 
)

Write COLOR item.

Parameters:
tagname Tag name to write
color Item value
ERRVALUE SERIALIZER::PutStr ( const char *  tagname,
const MIUNICODE str 
)

Write a single-line Unicode string.

Parameters:
tagname Tag name to write
str String
ERRVALUE SERIALIZER::PutStrML ( const char *  tagname,
const MIUNICODE str 
)

Write a Multi-line Unicode String.

Parameters:
tagname Tag name to write
str String
ERRVALUE SERIALIZER::PutUnsigned ( const char *  tagname,
unsigned int  value 
)

Write unsigned integer value.

Parameters:
tagname Tag name to write
value Item value
ERRVALUE SERIALIZER::Read ( OLDPROJPARM oldprojparm  ) 

Read OLDPROJPARM from serialization.

ERRVALUE SERIALIZER::Read ( const char *  tagname,
const SERIALIZERITEM itemdef,
void *  data 
)

Read items from serialization.

Parameters:
tagname Tag name to match
itemdef Item definition array
data Serialization data
ERRVALUE SERIALIZER::Read ( const SERIALIZERITEM itemdef,
void *  data 
)

Read items from serialization.

Parameters:
itemdef Item definition array
data Serialization data
ERRVALUE SERIALIZER::Read ( const char *  tagname,
SERIALIZABLE object 
)

Read SERIALIZABLE object.

Parameters:
tagname Tag name to match
object Object to read
ERRVALUE SERIALIZER::Read ( SERIALIZABLE object  ) 

Read SERIALIZABLE object.

Parameters:
object Object to read
ERRVALUE SERIALIZER::Rewind (  ) 

Rewind file to beginning.

void SERIALIZER::SetIgnoreSkippable ( bool  IgnoreSkippable = true  )  [inline]

Set whether to ignore "skippable" items.

Parameters:
IgnoreSkippable Ignore skippable mode
void SERIALIZER::SetScanOnly ( bool  ScanOnly  )  [inline]

Set scan-only mode.

Parameters:
ScanOnly Scan only mode
void SERIALIZER::SetVersion ( UINT16  Version  )  [inline]

Set version (for overriding).

Parameters:
Version Version
ERRVALUE SERIALIZER::SkipStruct (  ) 

Skip remainder of current structure (for use in item callback).

ERRVALUE SERIALIZER::StatusTextUpdate ( const MISTRING string  ) 

Update status text from Unicode string.

ERRVALUE SERIALIZER::Write ( const SERIALIZABLE object,
const char *  tagname = 0 
)

Write SERIALIZABLE object.

Parameters:
object Object to write
tagname Name to tag object with
ERRVALUE SERIALIZER::Write ( const char *  tagname,
const SERIALIZERITEM itemdef,
const void *  data,
UINT16  version = 0 
)

Write items to serialized output.

Parameters:
tagname Name to tag object with
itemdef Item definition array
data Data to write
version Version to set if top level object
ERRVALUE SERIALIZER::Write ( const SERIALIZERITEM itemdef,
const void *  data 
)

Write items without begin/end tags.

Parameters:
itemdef Item definition array
data Data to write

The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:33:50 2012 for TNTsdk 2012 by  doxygen 1.6.1