SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XMLSubSys.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Utility methods for initialising, closing and using the XML-subsystem
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 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 XMLSubSys_h
22 #define XMLSubSys_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 <vector>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class GenericSAXHandler;
41 class SUMOSAXHandler;
42 class SUMOSAXReader;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
72 class XMLSubSys {
73 public:
82  static void init();
83 
84 
92  static void setValidation(bool enableValidation);
93 
94 
100  static void close();
101 
102 
114  static SUMOSAXReader* getSAXReader(SUMOSAXHandler& handler);
115 
116 
124  static void setHandler(GenericSAXHandler& handler);
125 
126 
144  static bool runParser(GenericSAXHandler& handler,
145  const std::string& file);
146 
147 
148 private:
150  static std::vector<SUMOSAXReader*> myReaders;
151 
153  static unsigned int myNextFreeReader;
154 
156  static bool myEnableValidation;
157 
158 };
159 
160 
161 #endif
162 
163 /****************************************************************************/
164 
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:57
static void close()
Closes the xml-subsystem.
Definition: XMLSubSys.cpp:74
static unsigned int myNextFreeReader
Information whether the reader is parsing.
Definition: XMLSubSys.h:153
SAX-reader encapsulation containing binary reader.
Definition: SUMOSAXReader.h:54
static bool runParser(GenericSAXHandler &handler, const std::string &file)
Runs the given handler on the given file; returns if everything&#39;s ok.
Definition: XMLSubSys.cpp:96
SAX-handler base for SUMO-files.
static bool myEnableValidation
Information whether built reader/parser shall validate XML-documents against schemata.
Definition: XMLSubSys.h:156
A handler which converts occuring elements and attributes into enums.
static SUMOSAXReader * getSAXReader(SUMOSAXHandler &handler)
Builds a reader and assigns the handler to it.
Definition: XMLSubSys.cpp:84
static void setHandler(GenericSAXHandler &handler)
Sets the given handler for the default reader.
Definition: XMLSubSys.cpp:90
static void setValidation(bool enableValidation)
Enables or disables validation.
Definition: XMLSubSys.cpp:68
Utility methods for initialising, closing and using the XML-subsystem.
Definition: XMLSubSys.h:72
static std::vector< SUMOSAXReader * > myReaders
The XML Readers used for repeated parsing.
Definition: XMLSubSys.h:150