SUMO - Simulation of Urban MObility

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 (C) 2001-2011 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();
00065 
00066 
00068     ~OptionsLoader();
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;
00132 
00133 
00134 private:
00143     void setValue(const std::string& key, std::string& value);
00144 
00145 
00155     bool setSecure(const std::string& name, const std::string& value) const;
00156 
00157 
00158 private:
00160     OptionsLoader(const OptionsLoader& s);
00161 
00162 
00164     OptionsLoader& operator=(const OptionsLoader& s);
00165 
00166 
00167 private:
00169     bool myError;
00170 
00172     OptionsCont& myOptions;
00173 
00175     std::string myItem;
00176 
00178     std::string myValue;
00179 
00180 };
00181 
00182 
00183 #endif
00184 
00185 /****************************************************************************/
00186 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines