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-sim.org/
12 // Copyright (C) 2007-2014 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 <map>
37 #include <iostream>
38 #include <xercesc/sax2/Attributes.hpp>
39 #include <utils/common/SUMOTime.h>
41 #include "SUMOSAXAttributes.h"
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
54 public:
61  SUMOSAXAttributesImpl_Xerces(const XERCES_CPP_NAMESPACE::Attributes& attrs,
62  const std::map<int, XMLCh*>& predefinedTags,
63  const std::map<int, std::string>& predefinedTagsMML,
64  const std::string& objectType);
65 
66 
69 
70 
71 
72 
75 
81  bool hasAttribute(int id) const;
82 
83 
99  bool getBool(int id) const;
100 
101 
117  int getInt(int id) const;
118 
119 
135  SUMOLong getLong(int id) const;
136 
137 
150  std::string getString(int id) const;
151 
164  std::string getStringSecure(int id,
165  const std::string& def) const;
166 
167 
183  SUMOReal getFloat(int id) const;
184 
185 
189  bool hasAttribute(const std::string& id) const;
190 
191 
207  SUMOReal getFloat(const std::string& id) const;
208 
209 
219  std::string getStringSecure(const std::string& id,
220  const std::string& def) const;
221  //}
222 
223 
230  SumoXMLEdgeFunc getEdgeFunc(bool& ok) const;
231 
232 
239  SumoXMLNodeType getNodeType(bool& ok) const;
240 
241 
248  RGBColor getColor() const;
249 
250 
256  PositionVector getShape(int attr) const;
257 
258 
264  Boundary getBoundary(int attr) const;
265 
271  std::vector<std::string> getStringVector(int attr) const;
272 
280  std::string getName(int attr) const;
281 
282 
287  void serialize(std::ostream& os) const;
288 
289 
290 private:
297  const XMLCh* getAttributeValueSecure(int id) const;
298 
299 
300 private:
302  const XERCES_CPP_NAMESPACE::Attributes& myAttrs;
303 
305  typedef std::map<int, XMLCh*> AttrMap;
308 
310  const std::map<int, std::string>& myPredefinedTagsMML;
311 
312 
313 private:
316 
319 
320 
321 };
322 
323 
324 #endif
325 
326 /****************************************************************************/
327