BVB Source Codes

CRYENGINE Show XmlSerializeHelper.h Source code

Return Download CRYENGINE: download XmlSerializeHelper.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: Manages one-off reader/writer usages for Xml serialization
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 02:06:2010: Created by Kevin Kirst
  12.  
  13. *************************************************************************/
  14.  
  15. #ifndef __XMLREADERWRITER_H__
  16. #define __XMLREADERWRITER_H__
  17.  
  18. #include <CryNetwork/ISerializeHelper.h>
  19.  
  20. class CXmlSerializedObject : public ISerializedObject
  21. {
  22. public:
  23.         CXmlSerializedObject(const char* szSection);
  24.         virtual ~CXmlSerializedObject() {}
  25.  
  26.         enum { GUID = 0xD6BEE847 };
  27.         virtual uint32    GetGUID() const { return GUID; }
  28.         virtual void      GetMemoryUsage(ICrySizer* pSizer) const;
  29.  
  30.         virtual void      AddRef()  { ++m_nRefCount; }
  31.         virtual void      Release() { if (--m_nRefCount <= 0) delete this; }
  32.  
  33.         virtual bool      IsEmpty() const;
  34.         virtual void      Reset();
  35.         virtual void      Serialize(TSerialize& serialize);
  36.  
  37.         void              CreateRootNode();
  38.  
  39.         XmlNodeRef&       GetXmlNode()       { return m_XmlNode; }
  40.         const XmlNodeRef& GetXmlNode() const { return m_XmlNode; }
  41.  
  42. private:
  43.         string     m_sTag;
  44.         XmlNodeRef m_XmlNode;
  45.         int        m_nRefCount;
  46. };
  47.  
  48. class CXmlSerializeHelper : public ISerializeHelper
  49. {
  50. public:
  51.         CXmlSerializeHelper();
  52.         virtual ~CXmlSerializeHelper();
  53.  
  54.         virtual void                          GetMemoryUsage(ICrySizer* pSizer) const;
  55.  
  56.         virtual void                          AddRef()  { ++m_nRefCount; }
  57.         virtual void                          Release() { if (--m_nRefCount <= 0) delete this; }
  58.  
  59.         virtual _smart_ptr<ISerializedObject> CreateSerializedObject(const char* szSection);
  60.         virtual bool                          Write(ISerializedObject* pObject, TSerializeFunc serializeFunc, void* pArgument = NULL);
  61.         virtual bool                          Read(ISerializedObject* pObject, TSerializeFunc serializeFunc, void* pArgument = NULL);
  62.  
  63.         // Local versions which work with XmlNodes directly
  64.         ISerialize* GetWriter(XmlNodeRef& node);
  65.         ISerialize* GetReader(XmlNodeRef& node);
  66.  
  67. private:
  68.         static CXmlSerializedObject* GetXmlSerializedObject(ISerializedObject* pObject);
  69.  
  70. private:
  71.         int                        m_nRefCount;
  72.         _smart_ptr<IXmlSerializer> m_pSerializer;
  73. };
  74.  
  75. #endif //__XMLREADERWRITER_H__
  76.  
downloadXmlSerializeHelper.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top