1 | /*************************************************************************** |
---|
2 | * Copyright (C) 2008 by Daniel Wendt * |
---|
3 | * gentoo.murray@gmail.com * |
---|
4 | * * |
---|
5 | * This program is free software; you can redistribute it and/or modify * |
---|
6 | * it under the terms of the GNU General Public License as published by * |
---|
7 | * the Free Software Foundation; either version 2 of the License, or * |
---|
8 | * (at your option) any later version. * |
---|
9 | * * |
---|
10 | * This program is distributed in the hope that it will be useful, * |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
13 | * GNU General Public License for more details. * |
---|
14 | * * |
---|
15 | * You should have received a copy of the GNU General Public License * |
---|
16 | * along with this program; if not, write to the * |
---|
17 | * Free Software Foundation, Inc., * |
---|
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
---|
19 | ***************************************************************************/ |
---|
20 | |
---|
21 | #ifndef CONFIGURATION_H |
---|
22 | #define CONFIGURATION_H |
---|
23 | |
---|
24 | #include "Type.h" |
---|
25 | #include "Class.h" |
---|
26 | |
---|
27 | namespace osm |
---|
28 | { |
---|
29 | |
---|
30 | template< class Map > |
---|
31 | inline void ez_mapdelete( Map& c ) |
---|
32 | { |
---|
33 | typename Map::iterator it( c.begin() ); |
---|
34 | typename Map::iterator last( c.end() ); |
---|
35 | while( it!=last ) |
---|
36 | { |
---|
37 | delete (*it++).second; |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | template< class Vector > |
---|
42 | inline void ez_vectordelete( Vector& c ) |
---|
43 | { |
---|
44 | typename Vector::iterator it( c.begin() ); |
---|
45 | typename Vector::iterator last( c.end() ); |
---|
46 | while( it!=last ) |
---|
47 | { |
---|
48 | delete (*it++); |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | /** |
---|
54 | A configuration document. |
---|
55 | */ |
---|
56 | class Configuration |
---|
57 | { |
---|
58 | public: |
---|
59 | //! Map, which saves the parsed types |
---|
60 | std::map<std::string, Type*> m_Types; |
---|
61 | //std::map<long long, Type*> m_Types; |
---|
62 | public: |
---|
63 | |
---|
64 | //! Constructor |
---|
65 | Configuration(); |
---|
66 | //! Destructor |
---|
67 | virtual ~Configuration(); |
---|
68 | //! add node to the map |
---|
69 | void AddType( Type* t ); |
---|
70 | Type* FindType( std::string typeName ); |
---|
71 | Class* FindClass( std::string typeName, std::string className ); |
---|
72 | }; |
---|
73 | |
---|
74 | |
---|
75 | } // end namespace osm |
---|
76 | #endif |
---|