SUMO - Simulation of Urban MObility

SUMOSAXAttributesImpl_Xerces.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Encapsulated Xerces-SAX-attributes
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 SUMOSAXAttributesImpl_Xerces_h
00020 #define SUMOSAXAttributesImpl_Xerces_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 <string>
00033 #include <utils/common/SUMOTime.h>
00034 #include "SUMOSAXAttributes.h"
00035 #include <xercesc/sax2/Attributes.hpp>
00036 #include <map>
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 definitions
00049 // ===========================================================================
00056 class SUMOSAXAttributesImpl_Xerces : public SUMOSAXAttributes {
00057 public:
00064     SUMOSAXAttributesImpl_Xerces(const Attributes& attrs,
00065                                  const std::map<int, XMLCh*> &predefinedTags,
00066                                  const std::map<int, std::string> &predefinedTagsMML,
00067                                  const std::string& objectType) throw();
00068 
00069 
00071     virtual ~SUMOSAXAttributesImpl_Xerces() throw();
00072 
00073 
00074 
00075 
00078 
00084     bool hasAttribute(int id) const throw();
00085 
00086 
00102     bool getBool(int id) const throw(EmptyData, BoolFormatException);
00103 
00118     bool getBoolSecure(int id, bool def) const throw(EmptyData);
00119 
00120 
00136     int getInt(int id) const throw(EmptyData, NumberFormatException);
00137 
00155     int getIntSecure(int id, int def) const throw(EmptyData, NumberFormatException);
00156 
00157 
00170     std::string getString(int id) const throw(EmptyData);
00171 
00184     std::string getStringSecure(int id,
00185                                 const std::string& def) const throw(EmptyData);
00186 
00187 
00203     SUMOReal getFloat(int id) const throw(EmptyData, NumberFormatException);
00204 
00222     SUMOReal getFloatSecure(int id, SUMOReal def) const throw(EmptyData, NumberFormatException);
00223 
00224 
00228     bool hasAttribute(const std::string& id) const throw();
00229 
00230 
00246     SUMOReal getFloat(const std::string& id) const throw(EmptyData, NumberFormatException);
00247 
00248 
00258     std::string getStringSecure(const std::string& id,
00259                                 const std::string& def) const throw();
00260     //}
00261 
00262 
00270     std::string getName(int attr) const throw();
00271 
00272 
00273 private:
00280     const XMLCh* getAttributeValueSecure(int id) const throw();
00281 
00282 
00283 private:
00285     const Attributes& myAttrs;
00286 
00288     typedef std::map<int, XMLCh*> AttrMap;
00290     const AttrMap& myPredefinedTags;
00291 
00293     const std::map<int, std::string> &myPredefinedTagsMML;
00294 
00295 
00296 private:
00298     SUMOSAXAttributesImpl_Xerces(const SUMOSAXAttributesImpl_Xerces& src);
00299 
00301     SUMOSAXAttributesImpl_Xerces& operator=(const SUMOSAXAttributesImpl_Xerces& src);
00302 
00303 
00304 };
00305 
00306 
00307 #endif
00308 
00309 /****************************************************************************/
00310 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines