1 /***************************************************************************
2 					propertymanager2.h  -  description
3 							-------------------
4 	begin                : january 28th, 2007
5 	copyright            : (C) 2007-2008 by Duong Khang NGUYEN
6 	email                : neoneurone @ gmail com
7 
8 	$Id: propertymanager2.h 375 2008-10-28 14:47:15Z neoneurone $
9  ***************************************************************************/
10 
11 /***************************************************************************
12  *                                                                         *
13  *   This program is free software; you can redistribute it and/or modify  *
14  *   it under the terms of the GNU General Public License as published by  *
15  *   the Free Software Foundation; either version 2 of the License, or     *
16  *   any later version.                                                    *
17  *                                                                         *
18  ***************************************************************************/
19 
20 #ifndef _OPENCITY_PROPERTYMANAGER2_H_
21 #define _OPENCITY_PROPERTYMANAGER2_H_ 1
22 
23 #include "main.h"
24 
25 #include <map>
26 
27 #include "property.h"
28 
29 
30 //========================================================================
31 /** This manager handles the in-game object properties. Each object comes
32 with metadata in a separated XML file. It uses TinyXML and TinyXPath
33 to parse the those XML.
34 */
35 class PropertyManager2
36 {
37 public:
38 	PropertyManager2();
39 	~PropertyManager2();
40 
41 
42 	const uint GetNumberProperty() const;
43 
44 
45 //========================================================================
46 /** Get the Property of the graphism file given as the key. If the
47 requested Property for the given key is not found then NULL is returned.
48 	\return The pointer to the requested Property of NULL if not found
49 	\remarks Use the indexed version instead for better performance
50 */
51 	const Property* const
52 	Get(const string& key) const;
53 
54 
55 //========================================================================
56 /** Get the Property of the graphism file given as the key. If the
57 requested Property for the given key is not found then NULL is returned.
58 	\param index The index of the requested Property
59 	\return The pointer to the requested Property of NULL if not found
60 	\remarks There is not out of index checking ! Please call
61 GetNumberProperty() to determine the upper bound of the index
62 */
63 	const Property* const
64 	Get(const uint index) const;
65 
66 
67 private:
68 	uint					_uiNumberProperty;	/// The total number of properties
69 	Property** 				_aProperty;			/// The property array
70 	std::map<string, uint>	_mapIndex;			/// The property index map
71 
72 
73 };
74 
75 #endif
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108