OptionsLoader.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A SAX-Handler for loading options
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 OptionsLoader_h
00020 #define OptionsLoader_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 <xercesc/sax/HandlerBase.hpp>
00033 #include <xercesc/sax/AttributeList.hpp>
00034 #include <xercesc/sax/SAXParseException.hpp>
00035 #include <xercesc/sax/SAXException.hpp>
00036 #include <string>
00037 
00038 
00039 // ===========================================================================
00040 // xerces 2.2 compatibility
00041 // ===========================================================================
00042 #if defined(XERCES_HAS_CPP_NAMESPACE)
00043 using namespace XERCES_CPP_NAMESPACE;
00044 #endif
00045 
00046 
00047 // ===========================================================================
00048 // class declarations
00049 // ===========================================================================
00050 class OptionsCont;
00051 
00052 
00053 // ===========================================================================
00054 // class definitions
00055 // ===========================================================================
00060 class OptionsLoader : public HandlerBase {
00061 public:
00064     OptionsLoader() throw();
00065 
00066 
00068     ~OptionsLoader() throw();
00069 
00070 
00071 
00072 
00075 
00080     virtual void startElement(const XMLCh* const name,
00081                               AttributeList& attributes);
00082 
00083 
00091     void characters(const XMLCh* const chars, const XERCES3_SIZE_t length);
00092 
00093 
00098     void endElement(const XMLCh* const name);
00100 
00101 
00102 
00103 
00106 
00111     void warning(const SAXParseException& exception);
00112 
00113 
00118     void error(const SAXParseException& exception);
00119 
00120 
00125     void fatalError(const SAXParseException& exception);
00127 
00128 
00129 
00131     bool errorOccured() const throw();
00132 
00133 
00134 private:
00143     void setValue(const std::string &key, std::string &value);
00144 
00145 
00155     bool setSecure(const std::string &name, bool value) const throw();
00156 
00157 
00167     bool setSecure(const std::string &name, const std::string &value) const throw();
00168 
00169 
00170 private:
00172     OptionsLoader(const OptionsLoader &s);
00173 
00174 
00176     OptionsLoader &operator=(const OptionsLoader &s);
00177 
00178 
00179 private:
00181     bool myError;
00182 
00184     OptionsCont &myOptions;
00185 
00187     std::string myItem;
00188 
00190     std::string myValue;
00191 
00192 };
00193 
00194 
00195 #endif
00196 
00197 /****************************************************************************/
00198 

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