BVB Source Codes

CRYENGINE Show BlockyXml.h Source code

Return Download CRYENGINE: download BlockyXml.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef __BlockyXml_h__
  4. #define __BlockyXml_h__
  5.  
  6. #pragma once
  7.  
  8. /*
  9.    This file implements a simple "lazy" XML reference resolver.
  10.  
  11.    It works by collecting all the available reference-able XML nodes
  12.    and as a first step. Then it will resolve references while iterating through nodes.
  13.  
  14.    It supports 1 level of scoping, meaning it will look for references first in the specified scope
  15.    and then on the global scope shall that fail.
  16.  */
  17.  
  18. class BlockyXmlBlocks :
  19.         public _reference_target_t
  20. {
  21. public:
  22.         typedef _smart_ptr<BlockyXmlBlocks> Ptr;
  23.  
  24.         struct Block
  25.         {
  26.                 Block()
  27.                 {
  28.                 }
  29.  
  30.                 Block(const char* _fileName, const XmlNodeRef& _blockNode)
  31.                         : fileName(_fileName)
  32.                         , blockNode(_blockNode)
  33.                 {
  34.                 }
  35.  
  36.                 string     fileName;
  37.                 XmlNodeRef blockNode;
  38.         };
  39.  
  40.         bool  AddBlock(const char* scopeName, const char* name, const XmlNodeRef& node, const char* fileName = "<unknownFile>");
  41.         Block GetBlock(const char* scopeName, const char* blockName);
  42.  
  43. private:
  44.         typedef std::map<string, Block>  Blocks;
  45.         typedef std::map<string, Blocks> BlockScopes;
  46.         BlockScopes m_scopes;
  47. };
  48.  
  49. class BlockyXmlNodeRef
  50. {
  51. public:
  52.         BlockyXmlNodeRef();
  53.         BlockyXmlNodeRef(const BlockyXmlBlocks::Ptr& blocks, const char* scopeName, const XmlNodeRef& rootNode, const char* fileName = "<unknownFile>");
  54.         BlockyXmlNodeRef(const BlockyXmlBlocks::Ptr& blocks, const char* scopeName, const BlockyXmlBlocks::Block& block);
  55.         BlockyXmlNodeRef(const BlockyXmlNodeRef& other);
  56.  
  57.         void       first();
  58.         XmlNodeRef next();
  59.  
  60. private:
  61.         XmlNodeRef                        m_rootNode;
  62.         string                            m_scopeName;
  63.         string                            m_fileName;
  64.         BlockyXmlBlocks::Ptr              m_blocks;
  65.         std::unique_ptr<BlockyXmlNodeRef> m_currRef;
  66.         uint16                            m_currIdx;
  67. };
  68.  
  69. #endif
  70.  
downloadBlockyXml.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