BVB Source Codes

CRYENGINE Show XMLCPB_AttrReader.h Source code

Return Download CRYENGINE: download XMLCPB_AttrReader.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4. *************************************************************************/
  5.  
  6. #pragma once
  7. #ifndef XMLCPB_ATTRREADER_H
  8.         #define XMLCPB_ATTRREADER_H
  9.  
  10.         #include "../XMLCPB_Common.h"
  11.  
  12. namespace XMLCPB {
  13.  
  14. class CReader;
  15.  
  16. class CAttrReader
  17. {
  18.         friend class CReader;
  19. public:
  20.  
  21.         CAttrReader(CReader& Reader);
  22.         CAttrReader(const CAttrReader& other) : m_Reader(other.m_Reader) { *this = other; }
  23.         ~CAttrReader() {}
  24.  
  25.         CAttrReader& operator=(const CAttrReader& other)
  26.         {
  27.                 if (this != &other)
  28.                 {
  29.                         CRY_ASSERT (&m_Reader == &other.m_Reader);
  30.                         m_type = other.m_type;
  31.                         m_nameId = other.m_nameId;
  32.                         m_addr = other.m_addr;
  33.                 }
  34.                 return *this;
  35.         }
  36.  
  37.         void          InitFromCompact(FlatAddr offset, uint16 header);
  38.  
  39.         FlatAddr      GetAddrNextAttr() const;
  40.         const char*   GetName() const;
  41.         eAttrDataType GetBasicDataType() const { return XMLCPB::GetBasicDataType(m_type); }
  42.  
  43.         void          Get(int32& val) const;
  44.         void          Get(int64& val) const;
  45.         void          Get(uint64& val) const;
  46.         void          Get(int16& val) const;
  47.         void          Get(int8& val) const;
  48.         void          Get(uint8& val) const;
  49.         void          Get(uint16& val) const;
  50.         void          Get(uint& val) const;
  51.         void          Get(bool& val) const;
  52.         void          Get(float& val) const;
  53.         void          Get(Vec2& val) const;
  54.         void          Get(Ang3& val) const;
  55.         void          Get(Vec3& val) const;
  56.         void          Get(Quat& val) const;
  57.         void          Get(const char*& pStr) const;
  58.         void          Get(uint8*& rdata, uint32& outSize) const;
  59.  
  60.         void          GetValueAsString(string& str) const;
  61.  
  62.         #ifndef _RELEASE
  63.         StringID GetNameId() const { return m_nameId; }    // debug help
  64.         #endif
  65.  
  66. private:
  67.  
  68.         FlatAddr GetDataAddr() const { return m_addr;  }
  69.         float    UnpackFloatInSemiConstType(uint8 mask, uint32 ind, FlatAddr& addr) const;
  70.  
  71.         template<class T>
  72.         void ValueToString(string& str, const char* formatString) const;
  73.  
  74.         eAttrDataType m_type;
  75.         StringID      m_nameId;
  76.         FlatAddr      m_addr;
  77.         CReader&      m_Reader;
  78.  
  79. };
  80.  
  81. template<class T>
  82. void CAttrReader::ValueToString(string& str, const char* formatString) const
  83. {
  84.         T val;
  85.         Get(val);
  86.         str.Format(formatString, val);
  87. }
  88.  
  89. } // end namespace
  90. #endif
  91.  
downloadXMLCPB_AttrReader.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