# CEGUIXMLAttributes.h

    00001 /************************************************************************
    00002     filename:   CEGUIXMLAttributes.h
    00003     created:    Sat Mar 12 2005
    00004     author:     Paul D Turner
    00005 *************************************************************************/
    00006 /*************************************************************************
    00007     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00008     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00009
    00010     This library is free software; you can redistribute it and/or
    00011     modify it under the terms of the GNU Lesser General Public
    00012     License as published by the Free Software Foundation; either
    00013     version 2.1 of the License, or (at your option) any later version.
    00014
    00015     This library is distributed in the hope that it will be useful,
    00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018     Lesser General Public License for more details.
    00019
    00020     You should have received a copy of the GNU Lesser General Public
    00021     License along with this library; if not, write to the Free Software
    00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00023 *************************************************************************/
    00024 #ifndef _CEGUIXMLAttributes_h_
    00025 #define _CEGUIXMLAttributes_h_
    00026
    00027 #include "CEGUIBase.h"
    00028 #include "CEGUIString.h"
    00029 #include <map>
    00030
    00031 #if defined(_MSC_VER)
    00032 #       pragma warning(push)
    00033 #       pragma warning(disable : 4251)
    00034 #endif
    00035
    00036 // Start of CEGUI namespace section
    00037 namespace CEGUI
    00038 {
    00043     class CEGUIEXPORT XMLAttributes
    00044     {
    00045     public:
    00050         XMLAttributes(void);
    00051
    00056         virtual ~XMLAttributes(void);
    00057
    00072         void add(const String& attrName, const String& attrValue);
    00073
    00084         void remove(const String& attrName);
    00085
    00097         bool exists(const String& attrName) const;
    00098
    00106         size_t getCount(void) const;
    00107
    00124         const String& getName(size_t index) const;
    00125
    00142         const String& getValue(size_t index) const;
    00143
    00156         const String& getValue(const String& attrName) const;
    00157
    00173         const String& getValueAsString(const String& attrName, const String& def = "") const;
    00174
    00192         bool getValueAsBool(const String& attrName, bool def = false) const;
    00193
    00211         int getValueAsInteger(const String& attrName, int def = 0) const;
    00212
    00230         float getValueAsFloat(const String& attrName, float def = 0.0f) const;
    00231
    00232     protected:
    00233         typedef std::map<String, String> AttributeMap;
    00234         AttributeMap    d_attrs;
    00235     };
    00236
    00237 } // End of  CEGUI namespace section
    00238
    00239
    00240 #if defined(_MSC_VER)
    00241 #       pragma warning(pop)
    00242 #endif
    00243
    00244 #endif  // end of guard _CEGUIXMLAttributes_h_