libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
moXmlConfig.h
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moXmlConfig.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30 *******************************************************************************/
31 
32 
33 
34 #ifndef __MO_XMLCONFIG_H__
35 #define __MO_XMLCONFIG_H__
36 
37 #include <stdlib.h>
38 #include "moParam.h"
39 #include "moText.h"
40 #include "moArray.h"
41 #include "moConfig.h"
42 #include "tinyxml.h"
43 
44 /*
45 NOTES:
46 
47  config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue( );
48 
49  config.GetParam( paramindex ).GetValue( valueindex ).GetSubValue( );
50 
51  moXmlConfig
52  +moXmlParam
53  +moXmlValue
54  +moXmlSubValue
55  +moXmlSubValue
56  +moXmlSubValue
57  +moXmlValue
58  +moXmlSubValue
59  +moXmlSubValue
60  +moXmlParam
61  +moXmlValue
62  +moXmlSubValue
63  +moXmlParam
64  +moXmlValue
65  +moXmlSubValue
66  +moXmlSubValue
67  +moXmlValue
68  +moXmlSubValue
69 
70 */
71 
72 
73 /*
74 
75 class moValueData {
76 
77 }
78 
79 
80 class moValueType {
81 
82 }
83 
84 class LIBMOLDEO_API moValue {
85 
86  public:
87 
88  moText Get(); // Devuelve el parametro como fue guardado.
89  moText GetStr( int i=0) ; // Los distintos sub-valuees dentro del value...
90  char GetChr( int i=0); // se pueden obtener convertidos a distintos...
91  long GetInt( int i=0); // tipos.
92  double GetFlt( int i=0);
93 
94  int GetSubCount() { return subcount; }
95 
96  private:
97 
98  moValueType m_Type;
99  moValueData m_Data;
100 
101 };
102 
103 */
104 /*
105 class LIBMOLDEO_API moXmlParam : public moParam {
106 
107 public:
108  moXmlParam();
109  moXmlParam( char*);
110  virtual ~moXmlParam();
111 
112  //Version param extendida para interpolaciones
113 
114  MOint GetType();//tipo del parametro(principio de implementacion del XMLConfig //
115  moParam* GetFromParam();//puntero al parametro origen para calcular value interpolado
116  void SetFromParam(moParam *Prev);//setea el parametro origen para calcular el next
117  //los calculos de valuees interpolados, se hacen aqui, o bien, por ejemplo en la funcion movimiento
118 
119  //ESTO CORRESPONDE EN REALIDAD AL moXmlValue!!!!, aquí puede tener aplicacion asignandoselo al extyendido
120  void SetValue( char*); // Guarda el value en el parametro.
121  moText GetValue(); // Devuelve el parametro como fue guardado.
122  moText GetValueStr( int i=0); // Los distintos sub-valuees dentro del value...
123  char GetValueChr( int i=0); // se pueden obtener convertidos a distintos...
124  long GetValueInt( int i=0); // tipos.
125  double GetValueFlt( int i=0);
126 
127  int GetSubCount() { return subcount; }
128 
129 private:
130  moText value; // el value de parametro entero.
131  moText subvalue[MO_MAX_SUBVALOR]; // los sub-valuees parseados.
132  int subcount; // la cantidad de sub-valuees.
133 
134  //moValues m_Values;
135 
136 };
137 
138 template class LIBMOLDEO_API moDynamicArray<moXmlParam>;
139 typedef moDynamicArray<moXmlParam> moXmlParams;
140 
141 class moXmlConfig : public moConfig {
142 
143  public:
144 
145  moXmlConfig();
146  virtual ~moXmlConfig();
147 
148  MOboolean IsConfigLoaded();
149 
150  int LoadConfig( char*); // lee la configuracion de un archivo.
151  int SaveConfig( char*); // guarda la configuracion en un archivo.
152  void DeleteConfig(); // borra la configuracion que tiene armada.
153 
154  void AddParam( char*); // agrega un parametro a la config actual.
155  moParam& GetParam( int, int); // devuelve el contenido del parametro indicado y el value indicado.
156  moParam& GetParam( int); // devuelve el contenido del parametro indicado y el value actual del parametro.
157  moParam& GetParam(); // devuelve el contenido del parametro actual y el value actual del parametro.
158  void SetParam( int, int, moParam&); // cambia el contenido del value indicado para el parametro indicado.
159  int GetParamCount(); // devuelve la cantidad de parametros en la config.
160  int GetCurrentParam(); // devuelve el indice del parametro actual.
161  void SetCurrentParam( int); // mueve el indice del parametro actual al value indicado.
162  void FirstParam(); // mueve el indice del parametro actual al primer parametro.
163  void NextParam(); // mueve el indice del parametro actual al next parametro.
164  void PrevParam(); // mueve el indice del parametro actual al previous parametro.
165  int GetParamIndex( char*); // busca un parametro por el nombre y devuelve su numero de indice.
166  moText GetParamName( int); // devuelve el nombre del parametro indicado.
167 
168  void AddValue( int, char*); // agrega un value al parametro indicado,
169  int GetValueCount( int); // devuelve la cantidad de valuees que tiene el parametro indicado.
170  int GetCurrentValue( int); // devuelve el indice de value actual para el parametro indicado.
171  void SetCurrentValue( int, int); // mueve el indice de value actual para el parametro indicado a la posicion indicada.
172  void FirstValue(); // mueve el indice de value actual a la primera posicion para el parametro actual.
173  void NextValue(); // mueve el indice de value actual a la next posicion para el parametro actual.
174  void PreviousValue(); // mueve el indice de value actual a la previous posicion para el parametro actual.
175 
176 
177  private:
178 
179  TiXmlDocument m_XMLDocument;
180  moXmlParams m_Params;
181  MOboolean m_ConfigLoaded;
182 
183  moText *m_ParamNameIndex; // los nombres de los parametros.
184 
185  int m_ParamIndex; // el indice que indica cual es el parametro actual.
186  int* m_ValuesIndex; //los indices que indican cual es el value actual para cada parametro.
187 
188  moParam emptyparam; // un parametro vacio para devolver en algunos casos de operaciones invalidas.
189 
190 };
191 */
192 #endif