#ifndef XMLCACHE_H_ #define XMLCACHE_H_ #include #include #include "../Component.h" #include "../Unit.h" #include "../Building.h" #include "../SceneElement.h" #include "../TerrainElement.h" namespace xml { /// Element cache, An XML Element is completely read and cached, then returned when as for class XmlElementCache { protected: /// Temporary vector storage of Components before sending to Element std::vector _components; /*** Base values all Element can have, not configurable ***/ // , vector, later copied to an element std::vector < graphic::Image * > _views; // , default SOUTH int _direction; // , default F_NO_FACTION int _faction; // , element row position, default 1 int _rowpos; // , element row size on the map, default 1 int _rowsize; // , element colon position, default 1 int _colpos; // , element colon size on the map, default 1 int _colsize; // What kind of Element this is std::string _type; // Elements Unit * _unit; Building * _build; SceneElement * _scene; TerrainElement * _terra; Element * _base; void ResetCache() { _views.clear(); _direction = SOUTH; _faction = F_NO_FACTION; _rowpos = 1; _rowsize = 1; _colpos = 1; _colsize = 1; _unit = NULL; _build = NULL; _scene = NULL; _terra = NULL; _base = NULL; _type.clear(); _components.clear(); }; public: XmlElementCache(){ResetCache();}; ~XmlElementCache(){ResetCache();}; /// Returns the finshed loaded element Element * GetElement() { return _base; }; /// Return the Col posision of current element int GetColPos() { return _colpos; }; /// Return the Row posision of current element int GetRowPos() { return _rowpos; }; }; } #endif /*XMLCACHE_H_*/