SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SUMOSAXAttributesImpl_Xerces.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Encapsulated Xerces-SAX-attributes
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef SUMOSAXAttributesImpl_Xerces_h
23 #define SUMOSAXAttributesImpl_Xerces_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <utils/common/SUMOTime.h>
37 #include "SUMOSAXAttributes.h"
38 #include <xercesc/sax2/Attributes.hpp>
39 #include <map>
40 
41 
42 // ===========================================================================
43 // xerces 2.2 compatibility
44 // ===========================================================================
45 #if defined(XERCES_HAS_CPP_NAMESPACE)
46 using namespace XERCES_CPP_NAMESPACE;
47 #endif
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
60 public:
67  SUMOSAXAttributesImpl_Xerces(const Attributes& attrs,
68  const std::map<int, XMLCh*> &predefinedTags,
69  const std::map<int, std::string> &predefinedTagsMML,
70  const std::string& objectType) ;
71 
72 
74  virtual ~SUMOSAXAttributesImpl_Xerces() ;
75 
76 
77 
78 
81 
87  bool hasAttribute(int id) const ;
88 
89 
105  bool getBool(int id) const throw(EmptyData, BoolFormatException);
106 
121  bool getBoolSecure(int id, bool def) const throw(EmptyData);
122 
123 
139  int getInt(int id) const throw(EmptyData, NumberFormatException);
140 
158  int getIntSecure(int id, int def) const throw(EmptyData, NumberFormatException);
159 
160 
176  long getLong(int id) const throw(EmptyData, NumberFormatException);
177 
178 
191  std::string getString(int id) const throw(EmptyData);
192 
205  std::string getStringSecure(int id,
206  const std::string& def) const throw(EmptyData);
207 
208 
224  SUMOReal getFloat(int id) const throw(EmptyData, NumberFormatException);
225 
243  SUMOReal getFloatSecure(int id, SUMOReal def) const throw(EmptyData, NumberFormatException);
244 
245 
249  bool hasAttribute(const std::string& id) const ;
250 
251 
267  SUMOReal getFloat(const std::string& id) const throw(EmptyData, NumberFormatException);
268 
269 
279  std::string getStringSecure(const std::string& id,
280  const std::string& def) const ;
281  //}
282 
283 
291  std::string getName(int attr) const ;
292 
293 
294 private:
301  const XMLCh* getAttributeValueSecure(int id) const ;
302 
303 
304 private:
306  const Attributes& myAttrs;
307 
309  typedef std::map<int, XMLCh*> AttrMap;
312 
314  const std::map<int, std::string> &myPredefinedTagsMML;
315 
316 
317 private:
320 
323 
324 
325 };
326 
327 
328 #endif
329 
330 /****************************************************************************/
331