krita

kis_id.h

00001 /* 
00002  * This file is part of the KDE project
00003  * 
00004  * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef _KIS_ID_H_
00022 #define _KIS_ID_H_
00023 
00024 #include <qvaluelist.h>
00025 #include <qstring.h>
00026 
00057 class KisID {
00058 
00059 
00060 public:
00061 
00062     KisID() : m_id(QString::null), m_name(QString::null) {}
00063 
00064     KisID(const QString & id, const QString & name = QString::null)
00065         : m_id(id),
00066           m_name(name) {};
00067 
00068     QString id() const { return m_id; };
00069     QString name() const { return m_name; };
00070 
00071     friend inline bool operator==(const KisID &, const KisID &);
00072     friend inline bool operator!=(const KisID &, const KisID &);
00073     friend inline bool operator<(const KisID &, const KisID &);
00074     friend inline bool operator>(const KisID &, const KisID &);
00075 
00076 private:
00077 
00078     QString m_id;
00079     QString m_name;
00080 
00081 };
00082 
00083 inline bool operator==(const KisID &v1, const KisID &v2)
00084 {
00085      return v1.m_id == v2.m_id;
00086 }
00087 
00088 inline bool operator!=(const KisID &v1, const KisID &v2)
00089 {
00090     return v1.m_id != v2.m_id;
00091 }
00092 
00093 
00094 inline bool operator<(const KisID &v1, const KisID &v2)
00095 {
00096     return v1.m_id < v2.m_id;
00097 }
00098 
00099 
00100 inline bool operator>(const KisID &v1, const KisID &v2)
00101 {
00102     return v1.m_id < v2.m_id;
00103 }
00104 
00105 
00106 typedef QValueList<KisID> KisIDList;
00107 
00108 #endif // _KIS_ID_H_
KDE Home | KDE Accessibility Home | Description of Access Keys