UniSet  2.0.0
ObjectIndex_idXML.h
00001 // -------------------------------------------------------------------------- 
00002 #ifndef ObjectIndex_idXML_H_
00003 #define ObjectIndex_idXML_H_
00004 // --------------------------------------------------------------------------
00005 #include <map>
00006 #include <string>
00007 #include "ObjectIndex.h"
00008 #include "UniXML.h"
00009 // --------------------------------------------------------------------------
00010 class ObjectIndex_idXML:
00011     public UniSetTypes::ObjectIndex
00012 {
00013     public:
00014         ObjectIndex_idXML( const std::string& xmlfile );
00015         ObjectIndex_idXML( const std::shared_ptr<UniXML>& xml );
00016         virtual ~ObjectIndex_idXML();
00017 
00018         virtual const UniSetTypes::ObjectInfo* getObjectInfo( const UniSetTypes::ObjectId ) override;
00019         virtual const UniSetTypes::ObjectInfo* getObjectInfo( const std::string& name ) override;
00020         virtual UniSetTypes::ObjectId getIdByName( const std::string& name ) override;
00021         virtual std::string getMapName( const UniSetTypes::ObjectId id ) override;
00022         virtual std::string getTextName( const UniSetTypes::ObjectId id ) override;
00023 
00024         virtual std::ostream& printMap( std::ostream& os ) override;
00025         friend std::ostream& operator<<(std::ostream& os, ObjectIndex_idXML& oi );
00026 
00027     protected:
00028         void build( const std::shared_ptr<UniXML>& xml );
00029         void read_section( const std::shared_ptr<UniXML>& xml, const std::string& sec );
00030         void read_nodes( const std::shared_ptr<UniXML>& xml, const std::string& sec );
00031 
00032     private:
00033         typedef std::map<UniSetTypes::ObjectId, UniSetTypes::ObjectInfo> MapObjects;
00034         MapObjects omap;
00035 
00036         typedef std::map<std::string, UniSetTypes::ObjectId> MapObjectKey;
00037         MapObjectKey mok; // для обратного писка
00038 };
00039 // -----------------------------------------------------------------------------------------
00040 #endif