SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OptionsLoader.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A SAX-Handler for loading options
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef OptionsLoader_h
22 #define OptionsLoader_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <xercesc/sax/HandlerBase.hpp>
35 #include <xercesc/sax/AttributeList.hpp>
36 #include <xercesc/sax/SAXParseException.hpp>
37 #include <xercesc/sax/SAXException.hpp>
38 #include <string>
39 
40 
41 // ===========================================================================
42 // xerces 2.2 compatibility
43 // ===========================================================================
44 #if defined(XERCES_HAS_CPP_NAMESPACE)
45 using namespace XERCES_CPP_NAMESPACE;
46 #endif
47 
48 
49 // ===========================================================================
50 // class declarations
51 // ===========================================================================
52 class OptionsCont;
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
62 class OptionsLoader : public HandlerBase {
63 public:
66  OptionsLoader();
67 
68 
70  ~OptionsLoader();
71 
72 
73 
74 
77 
82  virtual void startElement(const XMLCh* const name,
83  AttributeList& attributes);
84 
85 
93  void characters(const XMLCh* const chars, const XERCES3_SIZE_t length);
94 
95 
100  void endElement(const XMLCh* const name);
102 
103 
104 
105 
108 
113  void warning(const SAXParseException& exception);
114 
115 
120  void error(const SAXParseException& exception);
121 
122 
127  void fatalError(const SAXParseException& exception);
129 
130 
131 
133  bool errorOccured() const;
134 
135 
136 private:
145  void setValue(const std::string& key, std::string& value);
146 
147 
157  bool setSecure(const std::string& name, const std::string& value) const;
158 
159 
160 private:
162  OptionsLoader(const OptionsLoader& s);
163 
164 
166  OptionsLoader& operator=(const OptionsLoader& s);
167 
168 
169 private:
171  bool myError;
172 
175 
177  std::string myItem;
178 
180  std::string myValue;
181 
182 };
183 
184 
185 #endif
186 
187 /****************************************************************************/
188