SUMO - Simulation of Urban MObility
OptionsLoader.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // A SAX-Handler for loading options
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 OptionsLoader_h
00022 #define OptionsLoader_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 <xercesc/sax/HandlerBase.hpp>
00035 #include <xercesc/sax/AttributeList.hpp>
00036 #include <xercesc/sax/SAXParseException.hpp>
00037 #include <xercesc/sax/SAXException.hpp>
00038 #include <string>
00039 
00040 
00041 // ===========================================================================
00042 // xerces 2.2 compatibility
00043 // ===========================================================================
00044 #if defined(XERCES_HAS_CPP_NAMESPACE)
00045 using namespace XERCES_CPP_NAMESPACE;
00046 #endif
00047 
00048 
00049 // ===========================================================================
00050 // class declarations
00051 // ===========================================================================
00052 class OptionsCont;
00053 
00054 
00055 // ===========================================================================
00056 // class definitions
00057 // ===========================================================================
00062 class OptionsLoader : public HandlerBase {
00063 public:
00066     OptionsLoader();
00067 
00068 
00070     ~OptionsLoader();
00071 
00072 
00073 
00074 
00077 
00082     virtual void startElement(const XMLCh* const name,
00083                               AttributeList& attributes);
00084 
00085 
00093     void characters(const XMLCh* const chars, const XERCES3_SIZE_t length);
00094 
00095 
00100     void endElement(const XMLCh* const name);
00102 
00103 
00104 
00105 
00108 
00113     void warning(const SAXParseException& exception);
00114 
00115 
00120     void error(const SAXParseException& exception);
00121 
00122 
00127     void fatalError(const SAXParseException& exception);
00129 
00130 
00131 
00133     bool errorOccured() const;
00134 
00135 
00136 private:
00145     void setValue(const std::string& key, std::string& value);
00146 
00147 
00157     bool setSecure(const std::string& name, const std::string& value) const;
00158 
00159 
00160 private:
00162     OptionsLoader(const OptionsLoader& s);
00163 
00164 
00166     OptionsLoader& operator=(const OptionsLoader& s);
00167 
00168 
00169 private:
00171     bool myError;
00172 
00174     OptionsCont& myOptions;
00175 
00177     std::string myItem;
00178 
00180     std::string myValue;
00181 
00182 };
00183 
00184 
00185 #endif
00186 
00187 /****************************************************************************/
00188 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines