SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // Utility methods for initialising, closing and using the XML-subsystem 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef XMLSubSys_h 00022 #define XMLSubSys_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <vector> 00035 #include <xercesc/sax2/SAX2XMLReader.hpp> 00036 #include <utils/common/UtilExceptions.h> 00037 00038 00039 // =========================================================================== 00040 // class declarations 00041 // =========================================================================== 00042 class GenericSAXHandler; 00043 class SUMOSAXHandler; 00044 00045 00046 // =========================================================================== 00047 // class definitions 00048 // =========================================================================== 00073 class XMLSubSys { 00074 public: 00089 static void init(bool enableValidation) ; 00090 00091 00097 static void close() ; 00098 00099 00111 static XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader* getSAXReader(SUMOSAXHandler& handler) ; 00112 00113 00121 static void setHandler(GenericSAXHandler& handler); 00122 00123 00141 static bool runParser(GenericSAXHandler& handler, 00142 const std::string& file) ; 00143 00144 00145 protected: 00156 static XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader* getSAXReader() ; 00157 00158 00168 static void setFeature(XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader& reader, 00169 const std::string& feature, bool value) ; 00170 00171 00172 private: 00174 static std::vector<XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader*> myReaders; 00175 00177 static unsigned int myNextFreeReader; 00178 00180 static bool myEnableValidation; 00181 00182 }; 00183 00184 00185 #endif 00186 00187 /****************************************************************************/ 00188