glc_attributes.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023  *****************************************************************************/
00025 
00026 #ifndef GLC_ATTRIBUTES_H_
00027 #define GLC_ATTRIBUTES_H_
00028 
00029 #include <QString>
00030 #include <QList>
00031 #include <QHash>
00032 
00033 #include "../glc_config.h"
00034 
00037 
00038 
00039 class GLC_LIB_EXPORT GLC_Attributes
00040 {
00041 
00043 
00045 
00046 public:
00048         GLC_Attributes();
00049 
00051         GLC_Attributes(const GLC_Attributes&);
00052 
00054         GLC_Attributes& operator=(const GLC_Attributes&);
00055 
00057         virtual ~GLC_Attributes();
00058 
00060 
00062 
00064 
00065 public:
00067         inline bool isEmpty() const
00068         {return m_AttributesHash.isEmpty();}
00069 
00071         inline int size() const
00072         {return m_AttributesHash.size();}
00073 
00075         bool contains(const QString& name) const
00076         {return m_AttributesHash.contains(name);}
00077 
00079         inline QList<QString> names() const
00080         {return m_AttributesHash.keys();}
00081 
00083 
00084         inline QString value(const QString& name) const
00085         {return m_AttributesHash.value(name);}
00086 
00088 
00090 
00092 
00093 public:
00095         inline void insert(const QString& name, const QString& value)
00096         {m_AttributesHash.insert(name, value);}
00097 
00099         inline void remove(const QString& name)
00100         {m_AttributesHash.remove(name);}
00101 
00103 
00105 
00107 
00108 public:
00109 
00111         inline bool operator==(const GLC_Attributes& attr) const
00112         {return m_AttributesHash == attr.m_AttributesHash;}
00113 
00115 
00116 // Private members
00118 private:
00120         QHash<QString, QString> m_AttributesHash;
00121 };
00122 
00123 #endif /* GLC_ATTRIBUTES_H_ */

SourceForge.net Logo

©2005 Laurent Ribon