XMLSubSys.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Utility methods for initialising, closing and using the XML-subsystem
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef XMLSubSys_h
00020 #define XMLSubSys_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <vector>
00033 #include <xercesc/sax2/SAX2XMLReader.hpp>
00034 #include <utils/common/UtilExceptions.h>
00035 
00036 
00037 // ===========================================================================
00038 // class declarations
00039 // ===========================================================================
00040 class GenericSAXHandler;
00041 class SUMOSAXHandler;
00042 
00043 
00044 // ===========================================================================
00045 // class definitions
00046 // ===========================================================================
00071 class XMLSubSys {
00072 public:
00087     static void init(bool enableValidation) throw(ProcessError);
00088 
00089 
00095     static void close() throw();
00096 
00097 
00109     static XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader * getSAXReader(SUMOSAXHandler &handler) throw();
00110 
00111 
00119     static void setHandler(GenericSAXHandler &handler);
00120 
00121 
00139     static bool runParser(GenericSAXHandler &handler,
00140                           const std::string &file) throw();
00141 
00142 
00143 protected:
00154     static XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader * getSAXReader() throw();
00155 
00156 
00166     static void setFeature(XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader &reader,
00167                            const std::string &feature, bool value) throw();
00168 
00169 
00170 private:
00172     static std::vector<XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader *> myReaders;
00173 
00175     static unsigned int myNextFreeReader;
00176 
00178     static bool myEnableValidation;
00179 
00180 };
00181 
00182 
00183 #endif
00184 
00185 /****************************************************************************/
00186 

Generated on Wed May 5 00:06:37 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6