NLMISC::COXml Class Reference

#include <o_xml.h>

Inheritance diagram for NLMISC::COXml:

NLMISC::IStream

Detailed Description

Output xml stream

This class is an xml formated output stream.

This stream use an internal stream to output final xml code.

// Check exceptions try { // File stream COFile file; // Open the file file.open ("output.xml"); // Create the XML stream COXml output; // Init if (output.init (&file, "1.0")) { // Serial the class myClass.serial (output); // Flush the stream, write all the output file output.flush (); } // Close the file file.close (); } catch (Exception &e) { }

Author:
Cyril 'Hulud' Corvazier

Nevrax France

Date:
2001

Definition at line 85 of file o_xml.h.

Seek fonctionnality

enum  TSeekOrigin { begin, current, end }
virtual sint32 getPos ()
virtual std::string getStreamName () const
virtual bool seek (sint32 offset, TSeekOrigin origin)

standard STL containers serialisation.

Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<>, map<>, multimap<> Support up to sint32 length containers.
See also:
serialContPtr() serialContPolyPtr()


virtual void serialCont (std::vector< bool > &cont)
 Specialisation of serialCont() for vector<bool>.

virtual void serialCont (std::vector< sint8 > &cont)
 Specialisation of serialCont() for vector<sint8>.

virtual void serialCont (std::vector< uint8 > &cont)
 Specialisation of serialCont() for vector<uint8>.

template<class K, class T> void serialCont (std::multimap< K, T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class K, class T> void serialCont (std::map< K, T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::multiset< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::set< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::deque< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::list< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T, class Allocator> void serialCont (std::vector< T, Allocator > &cont)
 Specialisation of serialCont() for vector<bool>.


XML implementation interface

void resetPtrTable ()
void setInOut (bool inputStream)
void setXMLMode (bool on)

Public Types


Public Member Functions

 COXml ()
void flush ()
xmlDocPtr getDocument ()
const char * getErrorString () const
bool init (IStream *stream, const char *version="1.0")
bool isReading () const
 Is this stream a Read/Input stream?

bool isXML () const
template<class T> void serial (T &obj)
virtual void serialBufferWithSize (uint8 *buf, uint32 len)
template<class T> void serialEnum (T &em)
 Template enum serialisation. Serialized as a sint32.

virtual void serialMemStream (CMemStream &b)
 Serial memstream, bitmemstream...

virtual ~COXml ()
Multiple serialisation.
Template for easy multiple serialisation.

template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)
Multiple serialisation.
Template for easy multiple serialisation.

template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)
Multiple serialisation.
Template for easy multiple serialisation.

template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)
Multiple serialisation.
Template for easy multiple serialisation.

template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)
Multiple serialisation.
Template for easy multiple serialisation.

template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)
Multiple serialisation.
Template for easy multiple serialisation.

template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)

Static Public Member Functions

void getVersionException (bool &throwOnOlder, bool &throwOnNewer)
bool isStringValidForProperties (const char *str)
void setVersionException (bool throwOnOlder, bool throwOnNewer)

Protected Member Functions

template<class T> void serialVector (T &cont)

Private Member Functions

void flushContentString ()
virtual void serial (ucstring &b)
virtual void serial (std::string &b)
virtual void serial (char &b)
virtual void serial (bool &b)
virtual void serial (double &b)
virtual void serial (float &b)
virtual void serial (sint64 &b)
virtual void serial (uint64 &b)
virtual void serial (sint32 &b)
virtual void serial (uint32 &b)
virtual void serial (sint16 &b)
virtual void serial (uint16 &b)
virtual void serial (sint8 &b)
virtual void serial (uint8 &b)
 From IStream.

virtual void serialBit (bool &bit)
virtual void serialBuffer (uint8 *buf, uint len)
void serialSeparatedBufferOut (const char *value)
virtual bool xmlBreakLineInternal ()
 xmlBreakLine implementation

virtual bool xmlCommentInternal (const char *comment)
 xmlComment implementation

virtual bool xmlPopInternal ()
 xmlPop implementation

virtual bool xmlPushBeginInternal (const char *nodeName)
 xmlPushBegin implementation

virtual bool xmlPushEndInternal ()
 xmlPushEnd implementation

virtual bool xmlSetAttribInternal (const char *attribName)
 xmlBreakLine implementation


Private Attributes

std::string _AttribName
bool _AttribPresent
std::string _ContentString
xmlNodePtr _CurrentNode
xmlDocPtr _Document
std::string _ErrorString
IStream_InternalStream
bool _PushBegin
std::string _Version

Friends

void xmlGenericErrorFuncWrite (void *ctx, const char *msg,...)
int xmlOutputCloseCallbackForNeL (void *context)
int xmlOutputWriteCallbackForNeL (void *context, const char *buffer, int len)


Member Enumeration Documentation

enum NLMISC::IStream::TSeekOrigin [inherited]
 

Parameters for seek(). begin seek from the begining of the stream. current seek from the current location of the stream pointer. end seek from the end of the stream.

Enumeration values:
begin 
current 
end 

Definition at line 549 of file stream.h.

00549 { begin, current, end };


Constructor & Destructor Documentation

NLMISC::COXml::COXml  ) 
 

Stream ctor

Definition at line 75 of file o_xml.cpp.

References _ContentString, _CurrentNode, _Document, _InternalStream, _PushBegin, and NLMISC::IStream::setXMLMode().

00075               : IStream (false /* Output mode */)
00076 {
00077         // Set XML mode
00078         setXMLMode (true);
00079 
00080         // Set the stream
00081         _InternalStream = NULL;
00082 
00083         // Set the version
00084         _Version = "1.0";
00085 
00086         // Initialise the document
00087         _Document = NULL;
00088 
00089         // Current node
00090         _CurrentNode = NULL;
00091 
00092         // Content string
00093         _ContentString = "";
00094 
00095         // Push begin
00096         _PushBegin = false;
00097 }

NLMISC::COXml::~COXml  )  [virtual]
 

Default dstor

Flush the stream.

Definition at line 152 of file o_xml.cpp.

References flush().

00153 {
00154         // Flush document to the internal stream
00155         flush ();
00156 }


Member Function Documentation

void NLMISC::COXml::flush  ) 
 

Flush the stream.

You can only flush the stream when all xmlPushBegin - xmlPop have been closed.

Definition at line 620 of file o_xml.cpp.

References _Document, nlassert, res, xmlOutputCloseCallbackForNeL, and xmlOutputWriteCallbackForNeL.

Referenced by NLSOUND::CSoundAnimation::save(), and ~COXml().

00621 {
00622         if (_Document)
00623         {
00624                 // Generate indentation
00625                 xmlKeepBlanksDefault (0);
00626 
00627                 // Create a output context
00628                 xmlOutputBufferPtr outputBuffer = xmlOutputBufferCreateIO  ( xmlOutputWriteCallbackForNeL, xmlOutputCloseCallbackForNeL, this, NULL );
00629 
00630                 // Save the file
00631                 int res = xmlSaveFormatFileTo (outputBuffer, _Document, NULL, 1);
00632 
00633                 // No error should be returned because, exception should be raised by the internal stream
00634                 nlassert (res!=-1);
00635 
00636                 // Free the document
00637                 xmlFreeDoc (_Document);
00638                 _Document = NULL;
00639         }
00640 }

void NLMISC::COXml::flushContentString  )  [inline, private]
 

Definition at line 53 of file o_xml.cpp.

References _ContentString, _CurrentNode, nlassert, size, and uint.

Referenced by xmlPopInternal(), and xmlPushBeginInternal().

00054 {
00055         // Current node must exist here
00056         nlassert (_CurrentNode);
00057 
00058         // String size
00059         uint size=_ContentString.length();
00060 
00061         // Some content to write ?
00062         if (size)
00063         {
00064                 // Write it in the current node
00065                 xmlNodePtr textNode = xmlNewText ((const xmlChar *)_ContentString.c_str());
00066                 xmlAddChild (_CurrentNode, textNode);
00067 
00068                 // Empty the string
00069                 _ContentString.erase ();
00070         }
00071 }

xmlDocPtr NLMISC::COXml::getDocument  ) 
 

Get root XML document pointer

Definition at line 673 of file o_xml.cpp.

References _Document.

Referenced by NLSOUND::CSoundAnimation::save(), and NLGEORGES::CForm::write().

00674 {
00675         if (_Document)
00676                 return _Document;
00677 
00678         // Initialise the document
00679         _Document = xmlNewDoc ((const xmlChar *)_Version.c_str());
00680 
00681         return _Document;
00682 }

const char * NLMISC::COXml::getErrorString  )  const
 

Return the error string. if not empty, something wrong appends

Definition at line 699 of file o_xml.cpp.

00700 {
00701         return _ErrorString.c_str ();
00702 }

sint32 NLMISC::IStream::getPos  )  [virtual, inherited]
 

Get the location of the stream pointer.

NB: If the stream doesn't support the seek fonctionnality, it throw ESeekNotSupported. Default implementation: { throw ESeekNotSupported; }

Parameters:
offset is the wanted offset from the origin.
origin is the origin of the seek
Returns:
the new offset regarding from the origin.
See also:
ESeekNotSupported SeekOrigin seek

Reimplemented in NLAIAGENT::CMsgIStream, NLMISC::CIFile, NLMISC::COFile, and NLMISC::CMemStream.

Definition at line 407 of file stream.cpp.

References sint32.

Referenced by NLMISC::CBitmap::readTGA().

00408 {
00409         throw ESeekNotSupported(*this);
00410 }

string NLMISC::IStream::getStreamName  )  const [virtual, inherited]
 

Get a name for this stream. maybe a fileName if FileStream. Default is to return "".

Reimplemented in NLMISC::CIFile, and NLMISC::COFile.

Definition at line 420 of file stream.cpp.

Referenced by NLMISC::EStream::EStream().

00421 {
00422         return "";
00423 }

void NLMISC::IStream::getVersionException bool &  throwOnOlder,
bool &  throwOnNewer
[static, inherited]
 

Get the behavior of IStream regarding input stream that are older/newer than the class.

See also:
serialVersion() setVersionException()

Definition at line 78 of file stream.cpp.

References NLMISC::IStream::_ThrowOnNewer, and NLMISC::IStream::_ThrowOnOlder.

00079 {
00080         throwOnOlder=_ThrowOnOlder;
00081         throwOnNewer=_ThrowOnNewer;
00082 }

bool NLMISC::COXml::init IStream stream,
const char *  version = "1.0"
 

Stream initialisation

Parameters:
stream is the stream the class will use to output xml code. this pointer is held by the class but won't be deleted.
version is the version to write in the XML header. Default is 1.0.
Returns:
true if initialisation is successful, false if the stream passed is not an output stream.

Definition at line 111 of file o_xml.cpp.

References _ContentString, _CurrentNode, _Document, _InternalStream, _PushBegin, NLMISC::IStream::isReading(), NLMISC::IStream::resetPtrTable(), NLMISC::IStream::setXMLMode(), and NLMISC::xmlGenericErrorFuncWrite().

Referenced by NLLIGO::CZoneBank::debugSaveInit(), NLSOUND::CSoundAnimation::save(), and NLGEORGES::CForm::write().

00112 {
00113         resetPtrTable();
00114 
00115         // Output stream ?
00116         if (!stream->isReading())
00117         {
00118                 // Set error handler
00119                 _ErrorString = "";
00120                 xmlSetGenericErrorFunc  (this, xmlGenericErrorFuncWrite);
00121 
00122                 // Set XML mode
00123                 setXMLMode (true);
00124 
00125                 // Set the stream
00126                 _InternalStream = stream;
00127 
00128                 // Set the version
00129                 _Version = version;
00130 
00131                 // Initialise the document
00132                 _Document = NULL;
00133 
00134                 // Current node
00135                 _CurrentNode = NULL;
00136 
00137                 // Content string
00138                 _ContentString = "";
00139 
00140                 // Push begin
00141                 _PushBegin = false;
00142 
00143                 // Ok
00144                 return true;
00145         }
00146         else
00147                 return false;
00148 }

bool NLMISC::IStream::isReading  )  const [inline, inherited]
 

Is this stream a Read/Input stream?

Definition at line 64 of file stream_inline.h.

References NLMISC::IStream::_InputStream.

Referenced by NLNET::CMessage::assignFromSubMessage(), NLMISC::CMemStream::bufferToFill(), NL3D::CParticleSystemShape::buildFromPS(), NLNET::CMessage::clear(), NLMISC::CMemStream::clear(), NLNET::CMessage::CMessage(), NLMISC::CBitMemStream::displayStream(), NLMISC::CMemStream::fastSerial(), NLMISC::CMemStream::fill(), NL3D::CParticleSystemShape::flushTextures(), NLMISC::CBitMemStream::getSerialItem(), NLMISC::CBitMemStream::increaseBufferIfNecessary(), init(), NL3D::CParticleSystemShape::instanciatePS(), NLMISC::CBitMemStream::internalSerial(), NLNET::CMessage::invert(), NLMISC::CMemStream::invert(), NLMISC::CBitMemStream::invert(), NLNET::CMessage::length(), NLMISC::CMemStream::length(), NLMISC::CBitMemStream::length(), NLMISC::CBitmap::load(), NLMISC::CBitmap::loadSize(), NLNET::CMessage::lockSubMessage(), NLNET::CMessage::operator=(), NLMISC::CBitMemStream::pointNextByte(), NLMISC::CMemStream::poke(), NLMISC::CBitMemStream::poke(), NLMISC::CBitMemStream::pokeBits(), NLMISC::CBitMemStream::readBits(), NLMISC::CBitmap::readTGA(), NLNET::CMessage::readTypeAtCurrentPos(), NLMISC::CMemStream::reserve(), NLMISC::CBitMemStream::reserveBits(), NLMISC::CBitMemStream::resetBufPos(), NLPACS::CGlobalRetriever::CLrLoader::run(), NL3D::CZone::serial(), NL3D::CVegetableShape::serial(), NLPACS::CSurfaceQuadTree::serial(), NLPACS::CQuadBranch::serial(), NL3D::CSurfaceLightGrid::CCellCorner::serial(), NLMISC::CStringStream::serial(), NLMISC::IStream::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NL3D::CPSAttrib< T >::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamed::serial(), NL3D::CPointLight::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), serial(), NLNET::TMessageRecord::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NLMISC::CMemStream::serial(), NLMISC::CMatrix::serial(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NLNET::CInetAddress::serial(), NL3D::CHLSTextureBank::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CEdgeQuad::serial(), NL3D::CCluster::serial(), NLPACS::CChainQuad::serial(), NLPACS::COrderedChain::serial(), NLMISC::CBitSet::serial(), NLMISC::CBitMemStream::serial(), NL3D::CMaterialBase::CAnimatedTexture::serial(), NLMISC::CAABBoxExt::serial(), NL3D::CMaterial::CLightMap::serial2(), NLMISC::CStringStream::serialBit(), NLMISC::CMemStream::serialBit(), NLMISC::CBitMemStream::serialBit(), NLMISC::CMemStream::serialBuffer(), NLMISC::CBitMemStream::serialBuffer(), NLMISC::IStream::serialCheck(), NLMISC::CStringStream::serialCont(), NLMISC::IStream::serialCont(), NLMISC::CBitMemStream::serialCont(), NLMISC::IStream::serialEnum(), NL3D::CVertexBuffer::serialHeader(), NLMISC::CStringStream::serialHex(), NLMISC::CMemStream::serialHex(), NLMISC::IStream::serialIStreamable(), NL3D::CMeshMRMGeom::serialLodVertexData(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMemStream(), NLMISC::CBitMemStream::serialMemStream(), NLNET::CMessage::serialMessage(), NLMISC::IStream::serialMultimap(), NL3D::CVertexBuffer::serialOldV1Minus(), NLMISC::IStream::serialPtr(), NLMISC::CStringStream::serialSeparatedBufferIn(), NLMISC::CMemStream::serialSeparatedBufferIn(), NLMISC::CStringStream::serialSeparatedBufferOut(), serialSeparatedBufferOut(), NLMISC::CMemStream::serialSeparatedBufferOut(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialSTLContLenPolyPtr(), NLMISC::IStream::serialSTLContLenPtr(), NLMISC::IStream::serialSTLContPolyPtr(), NLMISC::IStream::serialSTLContPtr(), NL3D::CVertexBuffer::serialSubset(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), NLMISC::IStream::serialVectorPtr(), NLMISC::IStream::serialVersion(), NLNET::CMessage::setType(), NLNET::CMessage::unlockSubMessage(), NLMISC::CBitmap::writeTGA(), xmlBreakLineInternal(), xmlCommentInternal(), xmlPopInternal(), xmlPushBeginInternal(), xmlPushEndInternal(), and xmlSetAttribInternal().

00065 {
00066         return _InputStream;
00067 }

bool NLMISC::COXml::isStringValidForProperties const char *  str  )  [static]
 

Return true if the string is valid to be stored in a XML property without modification.

Definition at line 686 of file o_xml.cpp.

Referenced by NLGEORGES::CFormElmAtom::write().

00687 {
00688         while (*str)
00689         {
00690                 if (*str == '\n')
00691                         return false;
00692                 str++;
00693         }
00694         return true;
00695 }

bool NLMISC::IStream::isXML  )  const [inline, inherited]
 

Definition at line 221 of file stream.h.

References NLMISC::IStream::_XML.

Referenced by NLMISC::CMemStream::serial().

00221 { return _XML; }        

void NLMISC::IStream::resetPtrTable  )  [protected, inherited]
 

for Deriver: reset the PtrTable in the stream. If Derived stream provide reset()-like methods, they must call this method in their reset() methods. For example, CFile::close() must call it, so it will work correctly with next serialPtr()

Reimplemented in NLMISC::CMemStream.

Definition at line 253 of file stream.cpp.

References NLMISC::IStream::_IdMap, and NLMISC::IStream::_NextSerialPtrId.

Referenced by NLMISC::CIFile::close(), init(), NLMISC::COFile::internalClose(), NLMISC::IStream::IStream(), and NLMISC::IStream::operator=().

00254 {
00255         _IdMap.clear();
00256         _NextSerialPtrId = 1;           // Start at 1 because 0 is the NULL pointer
00257 }

bool NLMISC::IStream::seek sint32  offset,
TSeekOrigin  origin
[virtual, inherited]
 

Moves the stream pointer to a specified location.

NB: If the stream doesn't support the seek fonctionnality, it throw ESeekNotSupported. Default implementation: { throw ESeekNotSupported; }

Parameters:
offset is the wanted offset from the origin.
origin is the origin of the seek
Returns:
true if seek sucessfull.
See also:
ESeekNotSupported SeekOrigin getPos

Reimplemented in NLMISC::CMemStream.

Definition at line 401 of file stream.cpp.

References offset, and sint32.

Referenced by NLMISC::CBitmap::load(), NL3D::CMeshMRMGeom::loadNextLod(), NLMISC::CBitmap::loadSize(), NLMISC::CBitmap::readDDS(), and NLMISC::CBitmap::readTGA().

00402 {
00403         throw ESeekNotSupported(*this);
00404         return false;
00405 }

template<class T0, class T1, class T2, class T3, class T4, class T5>
void NLMISC::IStream::serial T0 &  a,
T1 &  b,
T2 &  c,
T3 &  d,
T4 &  e,
T5 &  f
[inline, inherited]
 

Reimplemented in NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 313 of file stream.h.

References NLMISC::IStream::serial().

00314         { serial(a); serial(b); serial(c); serial(d); serial(e); serial(f);}

template<class T0, class T1, class T2, class T3, class T4>
void NLMISC::IStream::serial T0 &  a,
T1 &  b,
T2 &  c,
T3 &  d,
T4 &  e
[inline, inherited]
 

Reimplemented in NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 310 of file stream.h.

References NLMISC::IStream::serial().

00311         { serial(a); serial(b); serial(c); serial(d); serial(e);}

template<class T0, class T1, class T2, class T3>
void NLMISC::IStream::serial T0 &  a,
T1 &  b,
T2 &  c,
T3 &  d
[inline, inherited]
 

Reimplemented in NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 307 of file stream.h.

References NLMISC::IStream::serial().

00308         { serial(a); serial(b); serial(c); serial(d);}

template<class T0, class T1, class T2>
void NLMISC::IStream::serial T0 &  a,
T1 &  b,
T2 &  c
[inline, inherited]
 

Reimplemented in NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 304 of file stream.h.

References NLMISC::IStream::serial().

00305         { serial(a); serial(b); serial(c);}

template<class T0, class T1>
void NLMISC::IStream::serial T0 &  a,
T1 &  b
[inline, inherited]
 

Reimplemented in NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 301 of file stream.h.

References NLMISC::IStream::serial().

00302         { serial(a); serial(b);}

template<class T>
void NLMISC::IStream::serial T &  obj  )  [inline, inherited]
 

Template Object serialisation.

Parameters:
obj any object providing a "void serial(IStream&)" method. The object doesn't have to derive from IStreamable.
the VC++ error "error C2228: left of '.serial' must have class/struct/union type" means you don't provide a serial() method to your object. Or you may have use serial with a int / uint / sint type. REMEMBER YOU CANNOT do this, since those type have unspecified length.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 232 of file stream.h.

Referenced by NLSOUND::CAudioMixerUser::buildSampleBankList(), NLMISC::CEntityId::CEntityId(), NLAIAGENT::CIdent::CIdent(), NLAIAGENT::IConnectIA::connectLoadStream(), H_AUTO_DECL(), NL3D::H_AUTO_DECL(), NLAISCRIPT::CVarPStackParam::load(), NLAISCRIPT::CVarPStack::load(), NLAILOGIC::CVarSet::load(), NLAILOGIC::CVar::load(), NLAILOGIC::CValueSet::load(), NL3D::CShapeBank::load(), NLAISCRIPT::CScriptDebugSourceMemory::load(), NLAISCRIPT::CScriptDebugSourceFile::load(), NLSOUND::CSampleBank::load(), NLAIC::CBinaryType::load(), NLAILOGIC::IBaseOperator::load(), NLAISCRIPT::CLdbRefOpCode::load(), NLAISCRIPT::CLdbHeapMemberiOpCode::load(), NLAISCRIPT::CLdbMemberOpCode::load(), NLAISCRIPT::CLdbOpCode::load(), NLAISCRIPT::CCallMethodi::load(), NLAISCRIPT::CCallStackMethodi::load(), NLAISCRIPT::CCallHeapMethodi::load(), NLAISCRIPT::CCallMethod::load(), NLAISCRIPT::CLibHeapMemberMethod::load(), NLAISCRIPT::CLibStackMemberMethod::load(), NLAISCRIPT::CLibCallMethodi::load(), NLAISCRIPT::CLibCallInheritedMethod::load(), NLAISCRIPT::CLibCallMethod::load(), NLAISCRIPT::CLibMemberMethodi::load(), NLAISCRIPT::CLibMemberInheritedMethod::load(), NLAISCRIPT::CLibMemberMethod::load(), NLAISCRIPT::CMarkMsg::load(), NLAISCRIPT::CAffMemberOpCode::load(), NLAISCRIPT::CAffHeapMemberiOpCode::load(), NLAISCRIPT::CAffOpCode::load(), NLAISCRIPT::CJmpOpCode::load(), NLAISCRIPT::CJFalseOpCode::load(), NLAISCRIPT::CAddParamNameDebug::load(), NLAISCRIPT::CFindRunMsg::load(), NLAISCRIPT::CAffOpCodeDebug::load(), NLAISCRIPT::CLoadHeapObject::load(), NLAIAGENT::CMessageGroup::load(), NLAIAGENT::IMessageBase::load(), NLAIAGENT::CLocalMailBox::load(), NLAIAGENT::IListBasicManager::load(), NLAISCRIPT::CAgentClass::load(), NLAISCRIPT::CComponent::load(), NLAISCRIPT::CMethodeName::load(), NLAISCRIPT::CParam::load(), NLAIAGENT::CIdent::load(), NLAIAGENT::CIndexVariant< T, indexMax, maxT >::load(), NLAIAGENT::CVectorGroupType::load(), NLAIAGENT::CGroupType::load(), NLAIFUZZY::CFuzzyVar::load(), NLAIFUZZY::FuzzyType::load(), NLAIFUZZY::CTriangleFuzzySet::load(), NLAIFUZZY::CFuzzyRule::load(), NLAILOGIC::CFactBase::load(), NLMISC::CEntityId::load(), NLAISCRIPT::CCodeBrancheRunDebug::load(), NLAISCRIPT::CCodeBrancheRun::load(), NLAICHARACTER::CCharacterChild::load(), NLAILOGIC::CBoolOperator::load(), NLAILOGIC::CBoolAssert::load(), NLMISC::CBitmap::load(), NLAIAGENT::IAgentComposite::load(), NLSOUND::CBackgroundSoundManager::load(), NLAIAGENT::CStringVarName::load(), NLAIAGENT::CAgentScript::load(), NLAIAGENT::CStringType::load(), NLAIAGENT::INombre< sint32 >::load(), NLAIAGENT::IAgentInput::load(), NLAIAGENT::IVector::load(), NLAIAGENT::CActorScript::load(), NLAIAGENT::CIndexedVarName::loadClass(), NL3D::CMeshMRMGeom::loadFirstLod(), loadForm(), NL3D::CDriverUser::loadHLSBank(), NLAISCRIPT::IOpType::loadIOpType(), NL3D::CMeshMRMGeom::loadNextLod(), NLMISC::CBitmap::loadSize(), NL3D::CTileSet::loadTileVegetableDesc(), NLMISC::CBitmap::readDDS(), NLMISC::CBitmap::readTGA(), NLAIAGENT::IRefrence::refLoadStream(), NL3D::CAsyncFileManager3D::CMeshLoad::run(), NLAISCRIPT::CVarPStackParam::save(), NLAISCRIPT::CVarPStack::save(), NLAILOGIC::CVarSet::save(), NLAILOGIC::CVar::save(), NLAILOGIC::CValueSet::save(), NLAISCRIPT::CScriptDebugSourceMemory::save(), NLAISCRIPT::CScriptDebugSourceFile::save(), NLAIC::CBinaryType::save(), NLAILOGIC::IBaseOperator::save(), NLAISCRIPT::CLdbRefOpCode::save(), NLAISCRIPT::CLdbHeapMemberiOpCode::save(), NLAISCRIPT::CLdbMemberOpCode::save(), NLAISCRIPT::CLdbOpCode::save(), NLAISCRIPT::CCallMethodi::save(), NLAISCRIPT::CCallStackMethodi::save(), NLAISCRIPT::CCallHeapMethodi::save(), NLAISCRIPT::CCallMethod::save(), NLAISCRIPT::CLibHeapMemberMethod::save(), NLAISCRIPT::CLibStackMemberMethod::save(), NLAISCRIPT::CLibCallMethodi::save(), NLAISCRIPT::CLibCallInheritedMethod::save(), NLAISCRIPT::CLibCallMethod::save(), NLAISCRIPT::CLibMemberMethodi::save(), NLAISCRIPT::CLibMemberInheritedMethod::save(), NLAISCRIPT::CLibMemberMethod::save(), NLAISCRIPT::CMarkMsg::save(), NLAISCRIPT::CAffMemberOpCode::save(), NLAISCRIPT::CAffHeapMemberiOpCode::save(), NLAISCRIPT::CAffOpCode::save(), NLAISCRIPT::CJmpOpCode::save(), NLAISCRIPT::CJFalseOpCode::save(), NLAISCRIPT::CLdbNewOpCode::save(), NLAISCRIPT::CAddParamNameDebug::save(), NLAISCRIPT::CFindRunMsg::save(), NLAISCRIPT::CAffOpCodeDebug::save(), NLAISCRIPT::CLoadHeapObject::save(), NLAIAGENT::CMessageGroup::save(), NLAIAGENT::IMessageBase::save(), NLAIAGENT::CLocalMailBox::save(), NLAIAGENT::IListBasicManager::save(), NLAISCRIPT::CAgentClass::save(), NLAISCRIPT::CComponent::save(), NLAISCRIPT::CMethodeName::save(), NLAISCRIPT::CParam::save(), NLAIAGENT::CIdent::save(), NLAIAGENT::CIndexVariant< T, indexMax, maxT >::save(), NLAIAGENT::CVectorGroupType::save(), NLAIAGENT::CGroupType::save(), NLAIFUZZY::CFuzzyVar::save(), NLAIFUZZY::FuzzyType::save(), NLAIFUZZY::CTrapezeFuzzySet::save(), NLAIFUZZY::CLeftFuzzySet::save(), NLAIFUZZY::CTriangleFuzzySet::save(), NLAIFUZZY::CRightFuzzySet::save(), NLAIFUZZY::CFuzzyInterval::save(), NLAILOGIC::CFactBase::save(), NLMISC::CEntityId::save(), NLAISCRIPT::CCodeBrancheRunDebug::save(), NLAISCRIPT::CCodeBrancheRun::save(), NLAICHARACTER::CCharacterNoeud::save(), NLAICHARACTER::CCharacterChild::save(), NLAILOGIC::CBoolType::save(), NLAILOGIC::CBoolOperator::save(), NLAILOGIC::CBoolAssert::save(), NLAIAGENT::IAgentComposite::save(), NLAIAGENT::IRefrence::save(), NLAIAGENT::IConnectIA::save(), NLAIAGENT::CStringVarName::save(), NLAIAGENT::CIndexedVarName::save(), NLAIAGENT::CAgentScript::save(), NLAIAGENT::CStringType::save(), NLAIAGENT::INombre< sint32 >::save(), NLAIAGENT::CLocalAgentMail::save(), NLAIAGENT::IAgentInput::save(), NLAIAGENT::IVector::save(), NLAIAGENT::CActorScript::save(), NLAIAGENT::CActor::save(), NLAIAGENT::CIndexedVarName::saveClass(), NLPACS::CRetrieverBank::saveRetrievers(), NL3D::CZone::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CPaletteSkin::serial(), NL3D::CVegetableShape::serial(), NL3D::CVegetable::serial(), NLMISC::CVectorD::serial(), NLMISC::CVector::serial(), NLPACS::CVector2s::serial(), NLMISC::CVector2f::serial(), NLMISC::CVector2d::serial(), NLMISC::CUVW::serial(), NLMISC::CUV::serial(), NL3D::CTrackSampledVector::serial(), NL3D::CTrackSampledQuat::CQuatPack::serial(), NL3D::CTrackSampledQuat::serial(), NL3D::CTrackSampledCommon::CTimeBlock::serial(), NL3D::CTileVegetableDesc::serial(), NL3D::CTileLightInfluence::serial(), NL3D::CTileNoise::serial(), NLPACS::IQuadNode::serial(), NLPACS::CSurfaceQuadTree::serial(), NLPACS::CQuadBranch::serial(), NL3D::CSurfaceLightGrid::CCellCorner::serial(), NL3D::CSurfaceLightGrid::serial(), NLMISC::IStream::serial(), NL3D::CSkeletonWeight::CNode::serial(), CHashKey::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::CLink::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NLPACS::CRetrievableSurface::CSurfaceLink::serial(), NLPACS::CRetrievableSurface::TLoop::serial(), NLPACS::CRetrievableSurface::serial(), NLMISC::CQuatT< float >::serial(), NLMISC::CAngleAxis::serial(), NL3D::CPSAttrib< T >::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamedArray::CPointLightGroupV0::serial(), NL3D::CPointLightNamedArray::CPointLightGroup::serial(), NL3D::CPointLightNamed::serial(), NL3D::CPointLight::serial(), NLMISC::CPlane::serial(), NL3D::CVector3s::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::CNoiseColorGradient::serial(), NLMISC::CNoiseValue::serial(), NL3D::CMRMWedgeGeom::serial(), NL3D::CMeshMRMSkinnedGeom::CVertexBlock::serial(), NL3D::CMeshMRMSkinnedGeom::CRdrPass::serial(), NL3D::CMeshMRMSkinnedGeom::CShadowVertex::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NL3D::CMeshMRMGeom::CLodInfo::serial(), NL3D::CMeshMRMGeom::CVertexBlock::serial(), NL3D::CMeshMRMGeom::CRdrPass::serial(), NL3D::CMeshMRMGeom::CShadowVertex::serial(), NL3D::CMeshBase::CLightMapInfoList::serial(), NL3D::CMeshBase::CLightMapInfoList::CMatStage::serial(), NL3D::CMeshBase::CMatStageV7::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMeshGeom::CRdrPass::serial(), NLMISC::CMatrix::serial(), NL3D::CMaterial::CTexEnv::serial(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NL3D::CLodCharacterTexture::CTUVQ::serial(), NL3D::CLodCharacterTexture::serial(), NL3D::CLodCharacterShape::CVertexInf::serial(), NL3D::CLodCharacterShape::CVector3s::serial(), NL3D::CLodCharacterShapeBuild::CPixelInfo::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShape::CBoneInfluence::serial(), NL3D::CLodCharacterShape::CAnim::serial(), NL3D::CLodCharacterShapeBuild::serial(), NLPACS::CLocalRetriever::CInteriorFace::serial(), NLPACS::CLocalRetriever::CTip::serial(), NLPACS::CLocalRetriever::CTip::CChainTip::serial(), NLPACS::CLocalRetriever::serial(), NL3D::CIGSurfaceLight::CRetrieverLightGrid::serial(), NL3D::CIGSurfaceLight::serial(), NL3D::CHLSTextureBank::CTextureInstance::serial(), NL3D::CHLSColorTexture::serial(), NL3D::CHLSColorTexture::CMask::serial(), NL3D::CHLSColorDelta::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::CLink::serial(), NLPACS::CExteriorMesh::COrderedEdges::serial(), NLPACS::CExteriorMesh::CEdge::serial(), NLPACS::CExteriorMesh::serial(), NLPACS::CEdgeQuad::serial(), NLMISC::CSerialCommand::serial(), NLPACS::CExteriorEdgeEntry::serial(), NLPACS::CCollisionFace::serial(), NLPACS::CSurfaceIdent::serial(), NL3D::CCluster::serial(), NLPACS::CChainQuad::serial(), NLPACS::CChain::serial(), NLPACS::COrderedChain::serial(), NLPACS::COrderedChain3f::serial(), NL3D::CBoneBase::serial(), NLMISC::CBitSet::serial(), CAutomataDesc::CState::serial(), NL3D::CAnimationPlaylist::serial(), NL3D::CAnimation::serial(), NL3D::CMorphBase::serial(), NL3D::CMaterialBase::CTexAnimTracks::serial(), NL3D::CMaterialBase::serial(), NLMISC::CAABBox::serial(), NL3D::CMaterial::CLightMap::serial2(), NLMISC::IStream::serialBitField16(), NLMISC::IStream::serialBitField32(), NLMISC::IStream::serialBitField8(), NLMISC::IStream::serialBufferWithSize(), NLMISC::IStream::serialCheck(), NL3D::CTrackSampledCommon::serialCommon(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialEnum(), NL3D::CVertexBuffer::serialHeader(), NLMISC::IStream::serialIStreamable(), NL3D::CMeshMRMGeom::serialLodVertexData(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMemStream(), NLMISC::IStream::serialMultimap(), NL3D::CVertexBuffer::serialOldV1Minus(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialSTLContPolyPtr(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), NLMISC::IStream::serialVectorPtr(), NLMISC::IStream::serialVersion(), NLMISC::CBitmap::writeTGA(), and NLMISC::IStream::xmlSerial().

00232 { obj.serial(*this); }

void NLMISC::COXml::serial ucstring b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 340 of file o_xml.cpp.

References NLMISC::IStream::isReading(), nlassert, nlwarning, serial(), size, and uint.

00341 {
00342         nlassert( ! isReading() );
00343 
00344         // Iniput size
00345         uint size=b.length();
00346 
00347         // Output string
00348         string output;
00349         output.resize (b.length());
00350 
00351         // For each character
00352         for (uint i=0; i<size; i++)
00353         {
00354                 // 7 bits code ?
00355                 if (b[i]<0x7F)
00356                 {
00357                         output[i]=(char)b[i];
00358                 }
00359                 else
00360                 {
00362                         nlwarning ("XML: handle ucstring to utf-8");
00363                         output[i]=(b[i]&0xff);
00364                 }
00365         }
00366 
00367         // Serial this string
00368         serial (output);
00369 }

void NLMISC::COXml::serial std::string &  b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 315 of file o_xml.cpp.

References _PushBegin, NLMISC::IStream::isReading(), nlassert, serialSeparatedBufferOut(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00316 {
00317         nlassert( ! isReading() );
00318 
00319         // Attibute ?
00320         if (_PushBegin)
00321         {
00322                 // Only serial the string
00323                 serialSeparatedBufferOut( b.c_str() );
00324         }
00325         else
00326         {
00327                 // Open a string node
00328                 xmlPush ("S");
00329 
00330                 // Serial the string
00331                 serialSeparatedBufferOut( b.c_str() );
00332 
00333                 // Close the node
00334                 xmlPop ();
00335         }
00336 }

void NLMISC::COXml::serial char &  b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 306 of file o_xml.cpp.

References serialSeparatedBufferOut().

00307 {
00308         char tmp[2] = {b , 0};
00309         serialSeparatedBufferOut( tmp );
00310 }

void NLMISC::COXml::serial bool &  b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 290 of file o_xml.cpp.

References serialBit().

00291 {
00292         serialBit(b);
00293 }

void NLMISC::COXml::serial double &  b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 283 of file o_xml.cpp.

References writenumber.

00284 {
00285         writenumber( b, "%f", 128 );
00286 }

void NLMISC::COXml::serial float &  b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 276 of file o_xml.cpp.

References writenumber.

00277 {
00278         writenumber( (double)b, "%f", 128 );
00279 }

void NLMISC::COXml::serial sint64 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 269 of file o_xml.cpp.

References NL_I64, sint64, and writenumber.

00270 {
00271         writenumber( b, "%"NL_I64"d", 20 );
00272 }

void NLMISC::COXml::serial uint64 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 262 of file o_xml.cpp.

References NL_I64, uint64, and writenumber.

00263 {
00264         writenumber( b, "%"NL_I64"u", 20 );
00265 }

void NLMISC::COXml::serial sint32 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 255 of file o_xml.cpp.

References sint32, and writenumber.

00256 {
00257         writenumber( b, "%d", 11 );
00258 }

void NLMISC::COXml::serial uint32 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 248 of file o_xml.cpp.

References uint32, and writenumber.

00249 {
00250         writenumber( b, "%u", 10 );
00251 }

void NLMISC::COXml::serial sint16 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 241 of file o_xml.cpp.

References sint16, and writenumber.

00242 {
00243         writenumber( b, "%hd", 6 );
00244 }

void NLMISC::COXml::serial uint16 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 234 of file o_xml.cpp.

References uint16, and writenumber.

00235 {
00236         writenumber( b, "%hu", 5 );
00237 }

void NLMISC::COXml::serial sint8 b  )  [private, virtual]
 

Reimplemented from NLMISC::IStream.

Definition at line 227 of file o_xml.cpp.

References sint16, sint8, and writenumber.

00228 {
00229         writenumber( (sint16)b, "%hd", 4 );
00230 }

void NLMISC::COXml::serial uint8 b  )  [private, virtual]
 

From IStream.

Reimplemented from NLMISC::IStream.

Definition at line 219 of file o_xml.cpp.

References uint16, uint8, and writenumber.

Referenced by serial(), serialBit(), and serialBuffer().

00220 {
00221         // Write the number
00222         writenumber( (uint16)b,"%hu", 3 );
00223 }

void NLMISC::COXml::serialBit bool &  bit  )  [private, virtual]
 

Implements NLMISC::IStream.

Definition at line 297 of file o_xml.cpp.

References serial(), and uint8.

Referenced by serial().

00298 {
00299         uint8 u = (uint8)bit;
00300         serial( u );
00301 }

uint16 NLMISC::IStream::serialBitField16 uint16  bf  )  [inline, inherited]
 

Serialisation of bitfield <=16 bits.

Definition at line 332 of file stream_inline.h.

References NLMISC::IStream::serial(), and uint16.

00333 {
00334         serial(bf);
00335         return bf;
00336 }

uint32 NLMISC::IStream::serialBitField32 uint32  bf  )  [inline, inherited]
 

Serialisation of bitfield <=32 bits.

Definition at line 338 of file stream_inline.h.

References NLMISC::IStream::serial(), and uint32.

00339 {
00340         serial(bf);
00341         return bf;
00342 }

uint8 NLMISC::IStream::serialBitField8 uint8  bf  )  [inline, inherited]
 

Serialisation of bitfield <=8 bits.

Definition at line 326 of file stream_inline.h.

References NLMISC::IStream::serial(), and uint8.

Referenced by NL3D::CMaterial::CTexEnv::serial().

00327 {
00328         serial(bf);
00329         return bf;
00330 }

void NLMISC::COXml::serialBuffer uint8 buf,
uint  len
[private, virtual]
 

Method to be specified by the Deriver.

Warning:
Do not call these methods from outside, unless you really know what you are doing. Using them instead of serial() can lead to communication problems between different platforms !

Implements NLMISC::IStream.

Definition at line 373 of file o_xml.cpp.

References len, serial(), uint, uint8, NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00374 {
00375         // Open a node
00376         xmlPush ("BUFFER");
00377 
00378         // Serialize the buffer
00379         for (uint i=0; i<len; i++)
00380         {
00381                 xmlPush ("ELM");
00382 
00383                 serial (buf[i]);
00384 
00385                 xmlPop ();
00386         }
00387 
00388         // Close the node
00389         xmlPop ();
00390 }

virtual void NLMISC::IStream::serialBufferWithSize uint8 buf,
uint32  len
[inline, virtual, inherited]
 

This method first serializes the size of the buffer and after the buffer itself, it enables the possibility to serial with a serialCont() on the other side.

Definition at line 877 of file stream.h.

References len, NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), uint32, and uint8.

00878         {
00879                 serial (len);
00880                 serialBuffer (buf, len);
00881         }

template<class T>
void NLMISC::IStream::serialCheck const T &  value  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 520 of file stream.h.

References NLMISC::IStream::isReading(), NLMISC::IStream::serial(), value, NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

Referenced by NLNET::cbPacsAnswer(), NLNET::CPacsClient::initMessage(), loadForm(), NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CVegetableShape::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShapeBuild::serial(), NL3D::CAnimationSet::serial(), and NL3D::CAnimation::serial().

00521         {
00522                 // Open a node
00523                 xmlPush ("CHECK");
00524 
00525                 if (isReading()) 
00526                 { 
00527                         T read;
00528                         serial (read); 
00529                         if (read!=value) 
00530                                 throw EInvalidDataStream(*this); 
00531                 } 
00532                 else 
00533                 { 
00534                         serial (const_cast<T&>(value)); 
00535                 }
00536 
00537                 // Close the node 
00538                 xmlPop ();
00539         }

void NLMISC::IStream::serialCont std::vector< bool > &  cont  )  [virtual, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 356 of file stream.cpp.

References NLMISC::IStream::isReading(), len, NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), sint, sint32, uint, and uint8.

00357 {
00358         sint32  len=0;
00359         vector<uint8>   vec;
00360 
00361         if(isReading())
00362         {
00363                 serial(len);
00364                 cont.resize(len);
00365 
00366                 if (len != 0)
00367                 {
00368                         // read as uint8*.
00369                         sint    lb= (len+7)/8;
00370                         vec.resize(lb);
00371                         serialBuffer( (uint8*)&(*vec.begin()) ,  lb);
00372                         for(sint i=0;i<len;i++)
00373                         {
00374                                 uint    bit= (vec[i>>3]>>(i&7)) & 1;
00375                                 cont[i]= bit?true:false;
00376                         }
00377                 }
00378         }
00379         else
00380         {
00381                 len= cont.size();
00382                 serial(len);
00383 
00384                 if (len != 0)
00385                 {
00386                         // write as uint8*.
00387                         sint    lb= (len+7)/8;
00388                         vec.resize(lb);
00389                         fill_n(vec.begin(), lb, 0);
00390                         for(sint i=0;i<len;i++)
00391                         {
00392                                 uint    bit= cont[i]?1:0;
00393                                 vec[i>>3]|= bit<<(i&7);
00394                         }
00395                         serialBuffer( (uint8*)&(*vec.begin()) ,  lb);
00396                 }
00397         }
00398 
00399 }

void NLMISC::IStream::serialCont std::vector< sint8 > &  cont  )  [virtual, inherited]
 

Specialisation of serialCont() for vector<sint8>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 337 of file stream.cpp.

References NLMISC::IStream::isReading(), len, NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), sint32, and uint8.

00338 {
00339         sint32  len=0;
00340         if(isReading())
00341         {
00342                 serial(len);
00343                 cont.resize(len);
00344                 if (len != 0)
00345                         serialBuffer( (uint8*)&(*cont.begin()) , len);
00346         }
00347         else
00348         {
00349                 len= cont.size();
00350                 serial(len);
00351                 if (len != 0)
00352                         serialBuffer( (uint8*)&(*cont.begin()) ,  len);
00353         }
00354 }

void NLMISC::IStream::serialCont std::vector< uint8 > &  cont  )  [virtual, inherited]
 

Specialisation of serialCont() for vector<uint8>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 318 of file stream.cpp.

References NLMISC::IStream::isReading(), len, NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), sint32, and uint8.

00319 {
00320         sint32  len=0;
00321         if(isReading())
00322         {
00323                 serial(len);
00324                 cont.resize(len);
00325                 if (len != 0)
00326                         serialBuffer( (uint8*)&(*cont.begin()) , len);
00327         }
00328         else
00329         {
00330                 len= cont.size();
00331                 serial(len);
00332                 if (len != 0)
00333                         serialBuffer( (uint8*)&(*cont.begin()) ,  len);
00334         }
00335 }

template<class K, class T>
void NLMISC::IStream::serialCont std::multimap< K, T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 336 of file stream.h.

References NLMISC::IStream::serialMultimap().

00336 {serialMultimap(cont);}

template<class K, class T>
void NLMISC::IStream::serialCont std::map< K, T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 334 of file stream.h.

References NLMISC::IStream::serialMap().

00334 {serialMap(cont);}

template<class T>
void NLMISC::IStream::serialCont std::multiset< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 332 of file stream.h.

References NLMISC::IStream::serialSTLCont().

00332 {serialSTLCont(cont);}

template<class T>
void NLMISC::IStream::serialCont std::set< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 330 of file stream.h.

References NLMISC::IStream::serialSTLCont().

00330 {serialSTLCont(cont);}

template<class T>
void NLMISC::IStream::serialCont std::deque< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 328 of file stream.h.

References NLMISC::IStream::serialSTLCont().

00328 {serialSTLCont(cont);}

template<class T>
void NLMISC::IStream::serialCont std::list< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CBitMemStream, NLMISC::CMemStream, and NLMISC::CStringStream.

Definition at line 326 of file stream.h.

References NLMISC::IStream::serialSTLCont().

00326 {serialSTLCont(cont);}

template<class T, class Allocator>
void NLMISC::IStream::serialCont std::vector< T, Allocator > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Definition at line 324 of file stream.h.

References NLMISC::IStream::serialVector().

Referenced by NL3D::H_AUTO_DECL(), NLAISCRIPT::CLdbHeapMemberiOpCode::load(), NLAISCRIPT::CLdbStackMemberiOpCode::load(), NLAISCRIPT::CLdbMemberiOpCode::load(), NLAISCRIPT::CCallMethodi::load(), NLAISCRIPT::CCallStackMethodi::load(), NLAISCRIPT::CCallHeapMethodi::load(), NLAISCRIPT::CLibStackMemberMethod::load(), NLAISCRIPT::CLibCallMethodi::load(), NLAISCRIPT::CLibMemberMethodi::load(), NLAISCRIPT::CAffMemberiOpCode::load(), NLAISCRIPT::CAffHeapMemberiOpCode::load(), NLAISCRIPT::CLoadHeapObject::load(), NLAISCRIPT::CLoadStackObject::load(), NLAISCRIPT::CLoadSelfObject::load(), NLMISC::CEntityIdTranslator::load(), NLSOUND::CBackgroundSoundManager::load(), loadForm(), NLAISCRIPT::CLdbHeapMemberiOpCode::save(), NLAISCRIPT::CLdbStackMemberiOpCode::save(), NLAISCRIPT::CLdbMemberiOpCode::save(), NLAISCRIPT::CCallMethodi::save(), NLAISCRIPT::CCallStackMethodi::save(), NLAISCRIPT::CCallHeapMethodi::save(), NLAISCRIPT::CLibStackMemberMethod::save(), NLAISCRIPT::CLibCallMethodi::save(), NLAISCRIPT::CLibMemberMethodi::save(), NLAISCRIPT::CAffMemberiOpCode::save(), NLAISCRIPT::CAffHeapMemberiOpCode::save(), NLAISCRIPT::CLoadHeapObject::save(), NLAISCRIPT::CLoadStackObject::save(), NLAISCRIPT::CLoadSelfObject::save(), NLMISC::CEntityIdTranslator::save(), NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CVegetableShape::serial(), NL3D::CTileVegetableDesc::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NLPACS::CRetrievableSurface::TLoop::serial(), NLPACS::CRetrievableSurface::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamedArray::serial(), NL3D::CPatch::serial(), NLMISC::CNoiseColorGradient::serial(), NL3D::CMeshMRMSkinnedGeom::CRdrPass::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NL3D::CMeshBase::CLightMapInfoList::serial(), NL3D::CMeshBase::CLightInfoMapListV7::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMaterial::serial(), NL3D::CLodCharacterTexture::serial(), NL3D::CLodCharacterShapeBank::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShape::CBoneInfluence::serial(), NL3D::CLodCharacterShape::CAnim::serial(), NL3D::CLodCharacterShapeBuild::serial(), NLPACS::CLocalRetriever::CTopology::serial(), NLPACS::CLocalRetriever::CTip::serial(), NLPACS::CLocalRetriever::serial(), NL3D::CIGSurfaceLight::serial(), NL3D::CHLSTextureBank::serial(), NL3D::CHLSColorTexture::serial(), NL3D::CHLSColorTexture::CMask::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::serial(), NLPACS::CEdgeQuad::serial(), NLPACS::CCollisionMeshBuild::serial(), NL3D::CCluster::serial(), NLPACS::CChain::serial(), NLPACS::COrderedChain::serial(), NLPACS::COrderedChain3f::serial(), NLMISC::CBitSet::serial(), CAutomataDesc::CState::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimation::serial(), NL3D::CMaterialBase::serial(), and NLMISC::ICommand::serialCommands().

00324 {serialVector(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::multiset< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 379 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00379 {serialSTLContPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::set< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 377 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00377 {serialSTLContPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::deque< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 375 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00375 {serialSTLContPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::list< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 373 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00373 {serialSTLContPolyPtr(cont);}

template<class T, class Allocator>
void NLMISC::IStream::serialContPolyPtr std::vector< T, Allocator > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 371 of file stream.h.

References NLMISC::IStream::serialVectorPolyPtr().

Referenced by NL3D::CAnimation::serial().

00371 {serialVectorPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::multiset< T > &  cont  )  [inline, inherited]
 

Definition at line 362 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00362 {serialSTLContPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::set< T > &  cont  )  [inline, inherited]
 

Definition at line 360 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00360 {serialSTLContPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::deque< T > &  cont  )  [inline, inherited]
 

Definition at line 358 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00358 {serialSTLContPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::list< T > &  cont  )  [inline, inherited]
 

Definition at line 356 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00356 {serialSTLContPtr(cont);}

template<class T, class Allocator>
void NLMISC::IStream::serialContPtr std::vector< T, Allocator > &  cont  )  [inline, inherited]
 

Definition at line 354 of file stream.h.

References NLMISC::IStream::serialVectorPtr().

Referenced by NL3D::CAnimationSet::serial().

00354 {serialVectorPtr(cont);}

template<class T>
void NLMISC::IStream::serialEnum T &  em  )  [inline, inherited]
 

Template enum serialisation. Serialized as a sint32.

Definition at line 261 of file stream.h.

References NLMISC::IStream::isReading(), NLMISC::IStream::serial(), and sint32.

Referenced by NLNET::cbTCReceiveOtherSideClass(), NL3D::CVegetableShape::serial(), NL3D::CVegetable::serial(), NLPACS::CRetrieverInstance::serial(), NL3D::CPointLight::serial(), NL3D::CMaterial::serial(), NLPACS::CLocalRetriever::serial(), NLMISC::CSerialCommand::serial(), and NL3D::CAnimationPlaylist::serial().

00262         {
00263                 sint32  i;
00264                 if(isReading())
00265                 {
00266                         serial(i);
00267                         em = (T)i;
00268                 }
00269                 else
00270                 {
00271                         i = em;
00272                         serial(i);
00273                 }
00274         }

void NLMISC::IStream::serialMemStream CMemStream b  )  [virtual, inherited]
 

Serial memstream, bitmemstream...

Definition at line 436 of file stream.cpp.

References NLMISC::CMemStream::buffer(), NLMISC::CMemStream::bufferToFill(), NLMISC::IStream::isReading(), len, NLMISC::CMemStream::length(), NLMISC::CMemStream::resetBufPos(), NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), uint32, and uint8.

00437 {
00438         uint32 len=0;
00439 
00440         // Serialize length
00441         if ( isReading() )
00442         {
00443                 // fill b with data from this
00444                 serial (len);
00445                 serialBuffer (b.bufferToFill (len), len);
00446                 b.resetBufPos ();
00447         }
00448         else
00449         {
00450                 // fill this with data from b
00451                 len = b.length();
00452 
00453                 serial( len );
00454                 serialBuffer( (uint8*) b.buffer (), len );
00455         }
00456 }

template<class T>
void NLMISC::IStream::serialPolyPtr T *&  ptr  )  [inline, inherited]
 

Serialize Polymorphic Objet Ptr. Works with NULL pointers. If the same object is found mutliple time in the stream, ONLY ONE instance is written! NB: The ptr is serialised as a uint64 (64 bit compliant).

Parameters:
ptr a pointer on a IStreamable object.
See also:
resetPtrTable()

Definition at line 492 of file stream.h.

References NLMISC::IStream::serialIStreamable().

Referenced by NL3D::CAnimationOptimizer::cloneTrack(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NL3D::CMaterialBase::CAnimatedTexture::serial(), NL3D::CMaterial::CLightMap::serial2(), and NLMISC::IStream::serialSTLContLenPolyPtr().

00493         { IStreamable *p=ptr; serialIStreamable(p); ptr= static_cast<T*>(p);}

template<class T>
void NLMISC::IStream::serialPtr T *&  ptr  )  [inline, inherited]
 

Serialize Non Polymorphic Objet Ptr. Works with NULL pointers. If the same object is found mutliple time in the stream, ONLY ONE instance is written! NB: The ptr is serialised as a uint64 (64 bit compliant).

Parameters:
ptr a pointer on a base type or an object.
See also:
resetPtrTable()

Definition at line 390 of file stream.h.

References NLMISC::IStream::_IdMap, NLMISC::IStream::_NextSerialPtrId, NLMISC::IStream::isReading(), NLMISC::IStream::ItIdMap, NLMISC::IStream::serial(), uint, uint64, NLMISC::IStream::ValueIdMap, NLMISC::IStream::xmlPop(), NLMISC::IStream::xmlPushBegin(), NLMISC::IStream::xmlPushEnd(), and NLMISC::IStream::xmlSetAttrib().

Referenced by NL3D::CParticleSystemShape::buildFromPS(), NL3D::CParticleSystemShape::flushTextures(), NL3D::CParticleSystemShape::instanciatePS(), and NLMISC::IStream::serialSTLContLenPtr().

00391         {
00392                 uint64  node;
00393 
00394                 // Open the node header
00395                 xmlPushBegin ("PTR");
00396 
00397                 xmlSetAttrib ("id");
00398 
00399                 if(isReading())
00400                 {
00401                         serial(node);
00402 
00403                         // Close the header
00404                         xmlPushEnd ();
00405 
00406                         if(node==0)
00407                                 ptr=NULL;
00408                         else
00409                         {
00410                                 ItIdMap it;
00411                                 it= _IdMap.find(node);
00412 
00413                                 // Test if object already created/read.
00414                                 if( it==_IdMap.end() )
00415                                 {
00416                                         // Construct object.                                    
00417                                         ptr= new T;
00418                                         if(ptr==NULL)
00419                                                 throw EStream();
00420 
00421                                         // Insert the node.
00422                                         _IdMap.insert( ValueIdMap(node, ptr) );
00423 
00424                                         // Read the object!
00425                                         serial(*ptr);
00426                                 }
00427                                 else
00428                                         ptr= static_cast<T*>(it->second);
00429                         }
00430                 }
00431                 else
00432                 {
00433                         if(ptr==NULL)
00434                         {
00435                                 node= 0;
00436                                 serial(node);
00437 
00438                                 // Close the header
00439                                 xmlPushEnd ();
00440                         }
00441                         else
00442                         {
00443                                 ItIdMap it;
00444                                 it = _IdMap.find((uint64)(uint)ptr);
00445 
00446                                 // Test if object has been already written
00447                                 if( it==_IdMap.end() )
00448                                 {
00449                                         // Not yet written
00450 
00451                                         // Get the next available ID
00452                                         node = _NextSerialPtrId++;
00453 
00454                                         // Serial the id
00455                                         serial(node);
00456 
00457                                         // Insert the pointer in the map with the id
00458                                         _IdMap.insert( ValueIdMap((uint64)(uint)ptr, (void*)(uint)node) );
00459 
00460                                         // Close the header
00461                                         xmlPushEnd ();
00462 
00463                                         // Write the object
00464                                         serial(*ptr);
00465                                 }
00466                                 else
00467                                 {
00468                                         // Write only the object id
00469                                         node = (uint64)(uint)(it->second);
00470 
00471                                         serial(node);
00472                 
00473                                         // Close the header
00474                                         xmlPushEnd ();
00475                                 }
00476                         }
00477                 }
00478 
00479                 // Close the node
00480                 xmlPop ();
00481         }

void NLMISC::COXml::serialSeparatedBufferOut const char *  value  )  [private]
 

Definition at line 160 of file o_xml.cpp.

References _AttribName, _AttribPresent, _ContentString, _CurrentNode, _InternalStream, _PushBegin, NLMISC::IStream::isReading(), nlassert, nlerror, NLMISC::SEPARATOR, size, uint, and value.

Referenced by serial().

00161 {
00162         nlassert( ! isReading() );
00163 
00164         // Output stream has been setuped ?
00165         if ( _InternalStream )
00166         {
00167                 // Current node presents ?
00168                 if (_CurrentNode)
00169                 {
00170                         // Write a push attribute ?
00171                         if (_PushBegin)
00172                         {
00173                                 // Current attrib is set ?
00174                                 if (_AttribPresent)
00175                                 {
00176                                         // Set the attribute
00177                                         xmlSetProp (_CurrentNode, (const xmlChar*)_AttribName.c_str(), (const xmlChar*)value);
00178 
00179                                         // The attribute has been used 
00180                                         _AttribPresent = false;
00181                                 }
00182                                 else
00183                                 {
00184                                         // * Error, the stream don't use XML streaming properly
00185                                         // * You must take care of this in your last serial call:
00186                                         // * - Between xmlPushBegin() and xmlPushEnd(), before each serial, you must set the attribute name with xmlSetAttrib.
00187                                         // * - Between xmlPushBegin() and xmlPushEnd(), you must serial only basic objects (numbers and strings).
00188                                         nlerror ( "Error, the stream don't use XML streaming properly" );
00189                                 }
00190                         }
00191                         else
00192                         {
00193                                 // Get the content buffer size
00194                                 uint size=_ContentString.length();
00195 
00196                                 // Add a separator
00197                                 if ((size) && (_ContentString[size-1]!='\n'))
00198                                         _ContentString += SEPARATOR;
00199 
00200                                 // Concat the strings
00201                                 _ContentString += value;
00202                         }
00203                 }
00204                 else
00205                 {
00206                         // * Error, no current node present.
00207                         // * Check that your serial is initialy made between a xmlPushBegin and xmlPushEnd calls.
00208                         nlerror ( "Error, the stream don't use XML streaming properly" );
00209                 }
00210         }
00211         else
00212         {
00213                 nlerror ( "Output stream has not been setuped" );
00214         }
00215 }

template<class T>
void NLMISC::IStream::serialVector T &  cont  )  [inline, protected, inherited]
 

special version for serializing a vector. Support up to sint32 length containers.

Definition at line 992 of file stream.h.

References NLMISC::contReset(), NLMISC::IStream::isReading(), len, NLMISC::IStream::serial(), sint, sint32, NLMISC::IStream::xmlPop(), NLMISC::IStream::xmlPush(), NLMISC::IStream::xmlPushBegin(), NLMISC::IStream::xmlPushEnd(), and NLMISC::IStream::xmlSetAttrib().

Referenced by NLMISC::CStringStream::serialCont(), NLMISC::IStream::serialCont(), and NLMISC::CBitMemStream::serialCont().

00993         {
00994                 typedef typename T::value_type __value_type;
00995                 typedef typename T::iterator __iterator;
00996 
00997                 // Open a node header
00998                 xmlPushBegin ("VECTOR");
00999 
01000                 // Attrib size
01001                 xmlSetAttrib ("size");
01002 
01003                 sint32  len=0;
01004                 if(isReading())
01005                 {
01006                         serial(len);
01007 
01008                         // Open a node header
01009                         xmlPushEnd ();
01010 
01011                         // special version for vector: adjut good size.
01012                         contReset(cont);
01013                         cont.resize (len);
01014 
01015                         // Read the vector
01016                         for(sint i=0;i<len;i++)
01017                         {
01018                                 xmlPush ("ELM");
01019 
01020                                 serial(cont[i]);
01021 
01022                                 xmlPop ();
01023                         }
01024                 }
01025                 else
01026                 {
01027                         len= cont.size();
01028                         serial(len);
01029 
01030                         // Close the node header
01031                         xmlPushEnd ();
01032 
01033                         // Write the vector
01034                         __iterator              it= cont.begin();
01035                         for(sint i=0;i<len;i++, it++)
01036                         {
01037                                 xmlPush ("ELM");
01038 
01039                                 serial(const_cast<__value_type&>(*it));
01040 
01041                                 xmlPop ();
01042                         }
01043                 }
01044 
01045                 // Close the node
01046                 xmlPop ();
01047         }

uint NLMISC::IStream::serialVersion uint  currentVersion  )  [inherited]
 

Serialize a version number. Each object should store/read first a version number, using this method. Then he can use the streamVersion returned to see how he should serialise himself.

NB: Version Number is read/store as a uint8, or uint32 if too bigger..

Parameters:
currentVersion the current version of the class, provided by user.
Returns:
the version of the stream. If the stream is an Output stream, currentVersion is returned.
See also:
setVersionException() getVersionException()

Definition at line 266 of file stream.cpp.

References NLMISC::IStream::_ThrowOnNewer, NLMISC::IStream::_ThrowOnOlder, NLMISC::IStream::isReading(), NLMISC::IStream::serial(), uint, uint32, uint8, v, NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

Referenced by NL3D::H_AUTO_DECL(), NLMISC::CEntityIdTranslator::load(), loadForm(), NLMISC::CEntityIdTranslator::save(), NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneRegion::SZoneUnit2::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CPatchInfo::CBindInfo::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CBorderVertex::serial(), NL3D::CVertexBuffer::serial(), NL3D::CVegetableShape::serial(), NL3D::CVegetable::serial(), NL3D::CTrackSampledVector::serial(), NL3D::CTrackSampledQuat::serial(), NL3D::CTrackSampledCommon::CTimeBlock::serial(), NL3D::CTileVegetableDesc::serial(), NL3D::CTileNoiseMap::serial(), NL3D::CTileNoise::serial(), NLPACS::CSurfaceQuadTree::serial(), NL3D::CSurfaceLightGrid::CCellCorner::serial(), NL3D::CSurfaceLightGrid::serial(), NL3D::CSkeletonWeight::CNode::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NLPACS::CRetrievableSurface::serial(), NL3D::CPSAttrib< T >::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamedArray::CPointLightGroup::serial(), NL3D::CPointLightNamedArray::serial(), NL3D::CPointLightNamed::serial(), NL3D::CPointLight::serial(), NL3D::CPatch::serial(), NLMISC::CNoiseColorGradient::serial(), NLMISC::CNoiseValue::serial(), NL3D::CMeshMRMSkinnedGeom::CRdrPass::serial(), NL3D::CMeshMRMSkinnedGeom::CShadowVertex::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::serial(), NL3D::CMeshMRMSkinned::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NL3D::CMeshMRMGeom::CLodInfo::serial(), NL3D::CMeshMRMGeom::CRdrPass::serial(), NL3D::CMeshMRMGeom::CShadowVertex::serial(), NL3D::CMeshBase::CLightMapInfoList::serial(), NL3D::CMeshBase::CLightMapInfoList::CMatStage::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMeshGeom::CRdrPass::serial(), NLMISC::CMatrix::serial(), NL3D::CMaterial::serial(), NL3D::CLodCharacterTexture::serial(), NL3D::CLodCharacterShapeBank::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShape::CBoneInfluence::serial(), NL3D::CLodCharacterShape::CAnim::serial(), NL3D::CLodCharacterShapeBuild::serial(), NLPACS::CLocalRetriever::serial(), NL3D::CIGSurfaceLight::CRetrieverLightGrid::serial(), NL3D::CIGSurfaceLight::serial(), NL3D::CHLSTextureBank::CTextureInstance::serial(), NL3D::CHLSTextureBank::serial(), NL3D::CHLSColorTexture::serial(), NL3D::CHLSColorTexture::CMask::serial(), NL3D::CHLSColorDelta::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::serial(), NLPACS::CEdgeQuad::serial(), NL3D::CCluster::serial(), NLPACS::CChainQuad::serial(), NLPACS::CChain::serial(), NLPACS::COrderedChain::serial(), NLPACS::COrderedChain3f::serial(), NL3D::CBoneBase::serial(), NLMISC::CBitSet::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimationPlaylist::serial(), NL3D::CAnimation::serial(), NL3D::CMaterialBase::CTexAnimTracks::serial(), NL3D::CMaterialBase::serial(), NLMISC::CAABBox::serial(), NL3D::CMaterial::CLightMap::serial2(), NL3D::CTrackSampledCommon::serialCommon(), NL3D::CVertexBuffer::serialHeader(), NL3D::CMeshMRMGeom::serialLodVertexData(), and NL3D::CVertexBuffer::serialSubset().

00267 {
00268         uint8   b=0;
00269         uint32  v=0;
00270         uint    streamVersion;
00271 
00272         // Open the node
00273         xmlPush ("VERSION");
00274 
00275         if(isReading())
00276         {
00277                 serial(b);
00278                 if(b==0xFF)
00279                         serial(v);
00280                 else
00281                         v=b;
00282                 streamVersion=v;
00283 
00284                 // Exception test.
00285                 if(_ThrowOnOlder && streamVersion < currentVersion)
00286                         throw EOlderStream(*this);
00287                 if(_ThrowOnNewer && streamVersion > currentVersion)
00288                         throw ENewerStream(*this);
00289         }
00290         else
00291         {
00292                 v= streamVersion=currentVersion;
00293                 if(v>=0xFF)
00294                 {
00295                         b=0xFF;
00296                         serial(b);
00297                         serial(v);
00298                 }
00299                 else
00300                 {
00301                         b= (uint8)v;
00302                         serial(b);
00303                 }
00304         }
00305 
00306         // Close the node
00307         xmlPop ();
00308 
00309         return streamVersion;
00310 }

void NLMISC::IStream::setInOut bool  inputStream  )  [protected, inherited]
 

Change, in live, the state of the inputStream. This could be usefull in certain case. The deriver which would want to do such a thing must call this method, and implement his own behavior. In certain case, it should call resetPtrTable() if he want to reset the stream ptr info (maybe always)...

Definition at line 413 of file stream.cpp.

References NLMISC::IStream::_InputStream.

Referenced by NLMISC::CBitMemStream::getSerialItem(), and NLMISC::CMemStream::invert().

00414 {
00415         _InputStream= inputStream;
00416 }

void NLMISC::IStream::setVersionException bool  throwOnOlder,
bool  throwOnNewer
[static, inherited]
 

Set the behavior of IStream regarding input stream that are older/newer than the class. If throwOnOlder==true, IStream throws a EOlderStream when needed. If throwOnNewer==true, IStream throws a ENewerStream when needed.

By default, the behavior is throwOnOlder=false, throwOnNewer=true.

See also:
serialVersion() getVersionException()

Definition at line 71 of file stream.cpp.

References NLMISC::IStream::_ThrowOnNewer, and NLMISC::IStream::_ThrowOnOlder.

00072 {
00073         _ThrowOnOlder=throwOnOlder;
00074         _ThrowOnNewer=throwOnNewer;
00075 }

void NLMISC::IStream::setXMLMode bool  on  )  [protected, inherited]
 

Set the XML mode is true to enable XML mode else false

Definition at line 427 of file stream.cpp.

References NLMISC::IStream::_XML.

Referenced by COXml(), and init().

00428 {
00429         _XML = on;
00430 }

bool NLMISC::IStream::xmlBreakLine  )  [inline, inherited]
 

xmlBreakLine() insert a break line in the XML stream.

Returns:
true if the break line is added, return false if no node is opened.

Definition at line 794 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlBreakLineInternal().

00795         {
00796                 // XML Mode ?
00797                 if (_XML)
00798                 {
00799                         return xmlBreakLineInternal ();
00800                 }
00801 
00802                 // Return ok
00803                 return true;
00804         }

bool NLMISC::COXml::xmlBreakLineInternal  )  [private, virtual]
 

xmlBreakLine implementation

Reimplemented from NLMISC::IStream.

Definition at line 556 of file o_xml.cpp.

References _ContentString, _InternalStream, _PushBegin, NLMISC::IStream::isReading(), nlassert, and nlwarning.

00557 {
00558         nlassert( ! isReading() );
00559 
00560         // Check _InternalStream
00561         if ( _InternalStream )
00562         {
00563                 // Not in the push mode ?
00564                 if ( ! _PushBegin )
00565                 {
00566                         // Add a break line
00567                         _ContentString += '\n';
00568                 }
00569                 else
00570                 {
00571                         nlwarning ( "XML: You must call xmlNBreakLine after xmlPushEnd.");
00572                         return false;
00573                 }
00574         }
00575         else
00576         {
00577                 nlwarning ( "XML: Output stream has not been setuped.");
00578                 return false;
00579         }
00580 
00581         // Ok
00582         return true;
00583 }

bool NLMISC::IStream::xmlComment const char *  comment  )  [inline, inherited]
 

xmlComment() insert a comment line in the XML stream.

Returns:
true if the comment is added, return false if no node is opened.

Definition at line 811 of file stream.h.

References NLMISC::IStream::_XML, comment(), and NLMISC::IStream::xmlCommentInternal().

00812         {
00813                 // XML Mode ?
00814                 if (_XML)
00815                 {
00816                         return xmlCommentInternal (comment);
00817                 }
00818 
00819                 // Return ok
00820                 return true;
00821         }

bool NLMISC::COXml::xmlCommentInternal const char *  comment  )  [private, virtual]
 

xmlComment implementation

Reimplemented from NLMISC::IStream.

Definition at line 587 of file o_xml.cpp.

References _CurrentNode, _InternalStream, comment(), NLMISC::IStream::isReading(), nlassert, and nlwarning.

00588 {
00589         nlassert( ! isReading() );
00590 
00591         // Check _InternalStream
00592         if ( _InternalStream )
00593         {
00594                 // Not in the push mode ?
00595                 if ( _CurrentNode != NULL)
00596                 {
00597                         // Add a comment node
00598                         xmlNodePtr commentPtr = xmlNewComment ((const xmlChar *)comment);
00599 
00600                         // Add the node
00601                         xmlAddChild (_CurrentNode, commentPtr);
00602                 }
00603                 else
00604                 {
00605                         nlwarning ( "XML: You must call xmlCommentInternal between xmlPushBegin and xmlPushEnd.");
00606                         return false;
00607                 }
00608         }
00609         else
00610         {
00611                 nlwarning ( "XML: Output stream has not been setuped.");
00612                 return false;
00613         }
00614         // Ok
00615         return true;
00616 }

bool NLMISC::IStream::xmlPop  )  [inline, inherited]
 

xmlPop() close the node.

Returns:
true if you can close the node, false if the node can't be closed (its header is still opened) or if there is no node to close.

Definition at line 759 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlPopInternal().

Referenced by NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), serial(), serialBuffer(), NLMISC::IStream::serialCheck(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), NLMISC::IStream::serialVectorPtr(), NLMISC::IStream::serialVersion(), and NLMISC::IStream::xmlSerial().

00760         {
00761                 // XML Mode ?
00762                 if (_XML)
00763                 {
00764                         return xmlPopInternal ();
00765                 }
00766 
00767                 // Return ok
00768                 return true;
00769         }

bool NLMISC::COXml::xmlPopInternal  )  [private, virtual]
 

xmlPop implementation

Reimplemented from NLMISC::IStream.

Definition at line 488 of file o_xml.cpp.

References _CurrentNode, _InternalStream, _PushBegin, flushContentString(), NLMISC::IStream::isReading(), nlassert, and nlwarning.

00489 {
00490         nlassert( ! isReading() );
00491 
00492         // Check _InternalStream
00493         if ( _InternalStream )
00494         {
00495                 // Not in the push mode ?
00496                 if ( ! _PushBegin )
00497                 {
00498                         // Some content to write ?
00499                         flushContentString ();
00500 
00501                         // Get parent
00502                         _CurrentNode=_CurrentNode->parent;
00503                 }
00504                 else
00505                 {
00506                         nlwarning ( "XML: You must call xmlPop after xmlPushEnd.");
00507                         return false;
00508                 }
00509         }
00510         else
00511         {
00512                 nlwarning ( "XML: Output stream has not been setuped.");
00513                 return false;
00514         }
00515 
00516         // Ok
00517         return true;
00518 }

bool NLMISC::IStream::xmlPush const char *  name  )  [inline, inherited]
 

Definition at line 701 of file stream.h.

References NLMISC::IStream::_XML, res, NLMISC::IStream::xmlPushBeginInternal(), and NLMISC::IStream::xmlPushEndInternal().

Referenced by NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), serial(), serialBuffer(), NLMISC::IStream::serialCheck(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVersion(), and NLMISC::IStream::xmlSerial().

00702         {
00703                 // XML Mode ?
00704                 if (_XML)
00705                 {
00706                         // Open the header
00707                         bool res=xmlPushBeginInternal (name);
00708                         if (res)
00709                                 // close the header
00710                                 xmlPushEndInternal ();
00711                         // Return the result
00712                         return res;
00713                 }
00714 
00715                 // Return ok
00716                 return true;
00717         }

bool NLMISC::IStream::xmlPushBegin const char *  name  )  [inline, inherited]
 

xmlBreakLine() insert a break line in the XML stream.

Returns:
true if the break line is added, return false if no node is opened.

Definition at line 725 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlPushBeginInternal().

Referenced by NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), and NLMISC::IStream::serialVectorPtr().

00726         {
00727                 // XML Mode ?
00728                 if (_XML)
00729                 {
00730                         return xmlPushBeginInternal (name);
00731                 }
00732 
00733                 // Return ok
00734                 return true;
00735         }

bool NLMISC::COXml::xmlPushBeginInternal const char *  nodeName  )  [private, virtual]
 

xmlPushBegin implementation

Reimplemented from NLMISC::IStream.

Definition at line 394 of file o_xml.cpp.

References _CurrentNode, _Document, _InternalStream, _PushBegin, flushContentString(), NLMISC::IStream::isReading(), nlassert, and nlwarning.

00395 {
00396         nlassert( ! isReading() );
00397 
00398         // Check _InternalStream
00399         if ( _InternalStream )
00400         {
00401                 // Can make a xmlPushBegin ?
00402                 if ( ! _PushBegin )
00403                 {
00404                         // Current node exist ?
00405                         if (_CurrentNode==NULL)
00406                         {
00407                                 // No document ?
00408                                 if (_Document == NULL)
00409                                 {
00410                                         // Initialise the document
00411                                         _Document = xmlNewDoc ((const xmlChar *)_Version.c_str());
00412 
00413                                         // Return NULL if error
00414                                         nlassert (_Document);
00415                                 }
00416 
00417                                 // Create the first node
00418                                 _CurrentNode=xmlNewDocNode (_Document, NULL, (const xmlChar*)nodeName, NULL);
00419                                 xmlDocSetRootElement (_Document, _CurrentNode);
00420 
00421                                 // Return NULL if error
00422                                 nlassert (_CurrentNode);
00423                         }
00424                         else
00425                         {
00426                                 // Flush current content string ?
00427                                 flushContentString ();
00428 
00429                                 // Create a new node
00430                                 _CurrentNode=xmlNewChild (_CurrentNode, NULL, (const xmlChar*)nodeName, NULL);
00431 
00432                                 // Return NULL if error
00433                                 nlassert (_CurrentNode);
00434                         }
00435 
00436                         // Push begun
00437                         _PushBegin = true;
00438                 }
00439                 else
00440                 {
00441                         nlwarning ( "XML: You must close your xmlPushBegin - xmlPushEnd before calling a new xmlPushBegin.");
00442                         return false;
00443                 }
00444         }
00445         else
00446         {
00447                 nlwarning ( "XML: Output stream has not been setuped.");
00448                 return false;
00449         }
00450 
00451         // Ok
00452         return true;
00453 }

bool NLMISC::IStream::xmlPushEnd  )  [inline, inherited]
 

xmlPushEnd() close the node header.

Returns:
true if you can close the node header, false if no node header have been opened with xmlPushBegin().

Definition at line 742 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlPushEndInternal().

Referenced by NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), and NLMISC::IStream::serialVectorPtr().

00743         {
00744                 // XML Mode ?
00745                 if (_XML)
00746                 {
00747                         return xmlPushEndInternal ();
00748                 }
00749 
00750                 // Return ok
00751                 return true;
00752         }

bool NLMISC::COXml::xmlPushEndInternal  )  [private, virtual]
 

xmlPushEnd implementation

Reimplemented from NLMISC::IStream.

Definition at line 457 of file o_xml.cpp.

References _InternalStream, _PushBegin, NLMISC::IStream::isReading(), nlassert, and nlwarning.

00458 {
00459         nlassert( ! isReading() );
00460 
00461         // Check _InternalStream
00462         if ( _InternalStream )
00463         {
00464                 // Can make a xmlPushEnd ?
00465                 if ( _PushBegin )
00466                 {
00467                         // Push begun
00468                         _PushBegin = false;
00469                 }
00470                 else
00471                 {
00472                         nlwarning ( "XML: You must call xmlPushBegin before calling xmlPushEnd.");
00473                         return false;
00474                 }
00475         }
00476         else
00477         {
00478                 nlwarning ( "XML: Output stream has not been setuped.");
00479                 return false;
00480         }
00481 
00482         // Ok
00483         return true;
00484 }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
T &  value1,
T &  value2,
T &  value3,
const char *  nodeName
[inline, inherited]
 

Definition at line 683 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00684         {
00685                 // Open the node
00686                 xmlPush (nodeName);
00687                 
00688                 // Serial the values
00689                 serial (value0, value1, value2, value3);
00690 
00691                 // Close the node
00692                 xmlPop ();
00693         }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
T &  value1,
T &  value2,
const char *  nodeName
[inline, inherited]
 

Definition at line 671 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00672         {
00673                 // Open the node
00674                 xmlPush (nodeName);
00675                 
00676                 // Serial the values
00677                 serial (value0, value1, value2);
00678 
00679                 // Close the node
00680                 xmlPop ();
00681         }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
T &  value1,
const char *  nodeName
[inline, inherited]
 

Definition at line 659 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00660         {
00661                 // Open the node
00662                 xmlPush (nodeName);
00663                 
00664                 // Serial the values
00665                 serial (value0, value1);
00666 
00667                 // Close the node
00668                 xmlPop ();
00669         }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
const char *  nodeName
[inline, inherited]
 

xmlSerial() serial a values into a node.

Definition at line 647 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

Referenced by NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneRegion::SZoneUnit2::serial(), NLLIGO::CZoneRegion::SZoneUnit::serial(), NL3D::CZone::serial(), NL3D::CPatchInfo::CBindInfo::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CBorderVertex::serial(), NL3D::CTileElement::serial(), NL3D::CTileColorOldPatchVersion6::serial(), NL3D::CTileColor::serial(), and NL3D::CPatch::serial().

00648         {
00649                 // Open the node
00650                 xmlPush (nodeName);
00651                 
00652                 // Serial the value
00653                 serial (value0);
00654 
00655                 // Close the node
00656                 xmlPop ();
00657         }

bool NLMISC::IStream::xmlSetAttrib const char *  name  )  [inline, inherited]
 

xmlSetAttrib() set the name of the next node header attribute serialised.

is the name of the node header attribute serialised.

Returns:
true if the attribute name have been set, false if the node header is not open (the call is not between xmlPushBegin and xmlPushEnd)

Definition at line 777 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlSetAttribInternal().

Referenced by NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), and NLMISC::IStream::serialVectorPtr().

00778         {
00779                 // XML Mode ?
00780                 if (_XML)
00781                 {
00782                         return xmlSetAttribInternal (name);
00783                 }
00784 
00785                 // Return ok
00786                 return true;
00787         }

bool NLMISC::COXml::xmlSetAttribInternal const char *  attribName  )  [private, virtual]
 

xmlBreakLine implementation

Reimplemented from NLMISC::IStream.

Definition at line 522 of file o_xml.cpp.

References _AttribName, _AttribPresent, _InternalStream, _PushBegin, NLMISC::IStream::isReading(), nlassert, and nlwarning.

00523 {
00524         nlassert( ! isReading() );
00525 
00526         // Check _InternalStream
00527         if ( _InternalStream )
00528         {
00529                 // Can make a xmlPushEnd ?
00530                 if ( _PushBegin )
00531                 {
00532                         // Set attribute name
00533                         _AttribName = attribName;
00534 
00535                         // Attribute name is present
00536                         _AttribPresent = true;
00537                 }
00538                 else
00539                 {
00540                         nlwarning ( "XML: You must call xmlSetAttrib between xmlPushBegin and xmlPushEnd calls.");
00541                         return false;
00542                 }
00543         }
00544         else
00545         {
00546                 nlwarning ( "XML: Output stream has not been setuped.");
00547                 return false;
00548         }
00549 
00550         // Ok
00551         return true;
00552 }


Friends And Related Function Documentation

void xmlGenericErrorFuncWrite void *  ctx,
const char *  msg,
... 
[friend]
 

Definition at line 101 of file o_xml.cpp.

00102 {
00103         // Get the error string
00104         string str;
00105         NLMISC_CONVERT_VARGS (str, msg, NLMISC::MaxCStringSize);
00106         ((COXml*)ctx)->_ErrorString += str;
00107 }

int xmlOutputCloseCallbackForNeL void *  context  )  [friend]
 

Definition at line 662 of file o_xml.cpp.

Referenced by flush().

00663 {
00664         // Get the object
00665         // COXml *object = (COXml*) context;
00666 
00667         // Does nothing
00668         return 1;
00669 }

int xmlOutputWriteCallbackForNeL void *  context,
const char *  buffer,
int  len
[friend]
 

Definition at line 648 of file o_xml.cpp.

Referenced by flush().

00649 {
00650         // Get the object
00651         COXml *object = (COXml*) context;
00652 
00653         // Serialise the buffer
00654         object->_InternalStream->serialBuffer ((uint8*)buffer, len);
00655 
00656         // Return the value
00657         return len;
00658 }


Field Documentation

std::string NLMISC::COXml::_AttribName [private]
 

Definition at line 171 of file o_xml.h.

Referenced by serialSeparatedBufferOut(), and xmlSetAttribInternal().

bool NLMISC::COXml::_AttribPresent [private]
 

Definition at line 168 of file o_xml.h.

Referenced by serialSeparatedBufferOut(), and xmlSetAttribInternal().

std::string NLMISC::COXml::_ContentString [private]
 

Definition at line 186 of file o_xml.h.

Referenced by COXml(), flushContentString(), init(), serialSeparatedBufferOut(), and xmlBreakLineInternal().

xmlNodePtr NLMISC::COXml::_CurrentNode [private]
 

Definition at line 183 of file o_xml.h.

Referenced by COXml(), flushContentString(), init(), serialSeparatedBufferOut(), xmlCommentInternal(), xmlPopInternal(), and xmlPushBeginInternal().

xmlDocPtr NLMISC::COXml::_Document [private]
 

Definition at line 177 of file o_xml.h.

Referenced by COXml(), flush(), getDocument(), init(), and xmlPushBeginInternal().

std::string NLMISC::COXml::_ErrorString [private]
 

Definition at line 189 of file o_xml.h.

IStream* NLMISC::COXml::_InternalStream [private]
 

Definition at line 174 of file o_xml.h.

Referenced by COXml(), init(), serialSeparatedBufferOut(), xmlBreakLineInternal(), xmlCommentInternal(), NLMISC::xmlOutputWriteCallbackForNeL(), xmlPopInternal(), xmlPushBeginInternal(), xmlPushEndInternal(), and xmlSetAttribInternal().

bool NLMISC::COXml::_PushBegin [private]
 

Definition at line 165 of file o_xml.h.

Referenced by COXml(), init(), serial(), serialSeparatedBufferOut(), xmlBreakLineInternal(), xmlPopInternal(), xmlPushBeginInternal(), xmlPushEndInternal(), and xmlSetAttribInternal().

std::string NLMISC::COXml::_Version [private]
 

Definition at line 180 of file o_xml.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:26:53 2004 for NeL by doxygen 1.3.6