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 <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 throw(EmptyData, BoolFormatException);
100 
115  bool getBoolSecure(int id, bool def) const throw(EmptyData);
116 
117 
133  int getInt(int id) const;
134 
152  int getIntSecure(int id, int def) const;
153 
154 
170  SUMOLong getLong(int id) const;
171 
172 
185  std::string getString(int id) const throw(EmptyData);
186 
199  std::string getStringSecure(int id,
200  const std::string& def) const throw(EmptyData);
201 
202 
218  SUMOReal getFloat(int id) const;
219 
237  SUMOReal getFloatSecure(int id, SUMOReal def) const;
238 
239 
243  bool hasAttribute(const std::string& id) const;
244 
245 
261  SUMOReal getFloat(const std::string& id) const;
262 
263 
273  std::string getStringSecure(const std::string& id,
274  const std::string& def) const;
275  //}
276 
277 
284  SumoXMLEdgeFunc getEdgeFunc(bool& ok) const;
285 
286 
293  SumoXMLNodeType getNodeType(bool& ok) const;
294 
295 
302  RGBColor getColorReporting(const char* objectid, bool& ok) const;
303 
304 
318  PositionVector getShapeReporting(int attr, const char* objectid, bool& ok,
319  bool allowEmpty) const;
320 
321 
335  Boundary getBoundaryReporting(int attr, const char* objectid, bool& ok) const;
336 
337 
345  std::string getName(int attr) const;
346 
347 
352  void serialize(std::ostream& os) const;
353 
354 
355 private:
362  const XMLCh* getAttributeValueSecure(int id) const;
363 
364 
365 private:
367  const XERCES_CPP_NAMESPACE::Attributes& myAttrs;
368 
370  typedef std::map<int, XMLCh*> AttrMap;
373 
375  const std::map<int, std::string>& myPredefinedTagsMML;
376 
377 
378 private:
381 
384 
385 
386 };
387 
388 
389 #endif
390 
391 /****************************************************************************/
392