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 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 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<SumoXMLAttr, XMLCh*> &predefinedTags,
00066                                  const std::map<SumoXMLAttr, std::string> &predefinedTagsMML) throw();
00067 
00068 
00070     virtual ~SUMOSAXAttributesImpl_Xerces() throw();
00071 
00072 
00073 
00074 
00077 
00083     bool hasAttribute(SumoXMLAttr id) const throw();
00084 
00085 
00101     bool getBool(SumoXMLAttr id) const throw(EmptyData, BoolFormatException);
00102 
00117     bool getBoolSecure(SumoXMLAttr id, bool def) const throw(EmptyData);
00118 
00119 
00135     int getInt(SumoXMLAttr id) const throw(EmptyData, NumberFormatException);
00136 
00154     int getIntSecure(SumoXMLAttr id, int def) const throw(EmptyData, NumberFormatException);
00155 
00156 
00169     std::string getString(SumoXMLAttr id) const throw(EmptyData);
00170 
00183     std::string getStringSecure(SumoXMLAttr id,
00184                                 const std::string &def) const throw(EmptyData);
00185 
00186 
00202     SUMOReal getFloat(SumoXMLAttr id) const throw(EmptyData, NumberFormatException);
00203 
00221     SUMOReal getFloatSecure(SumoXMLAttr id, SUMOReal def) const throw(EmptyData, NumberFormatException);
00222 
00223 
00227     bool hasAttribute(const std::string &id) const throw();
00228 
00229 
00245     SUMOReal getFloat(const std::string &id) const throw(EmptyData, NumberFormatException);
00246 
00247 
00257     std::string getStringSecure(const std::string &id,
00258                                 const std::string &def) const throw();
00259     //}
00260 
00261 
00269     std::string getName(SumoXMLAttr attr) const throw();
00270 
00271 
00272 private:
00279     const XMLCh *getAttributeValueSecure(SumoXMLAttr id) const throw();
00280 
00281 
00282 private:
00284     const Attributes &myAttrs;
00285 
00287     typedef std::map<SumoXMLAttr, XMLCh*> AttrMap;
00289     const AttrMap &myPredefinedTags;
00290 
00292     const std::map<SumoXMLAttr, std::string> &myPredefinedTagsMML;
00293 
00294 
00295 private:
00297     SUMOSAXAttributesImpl_Xerces(const SUMOSAXAttributesImpl_Xerces &src);
00298 
00300     SUMOSAXAttributesImpl_Xerces &operator=(const SUMOSAXAttributesImpl_Xerces &src);
00301 
00302 
00303 };
00304 
00305 
00306 #endif
00307 
00308 /****************************************************************************/
00309 

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