KNewStuff
ktranslatable.h
Go to the documentation of this file.00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (c) 2006, 2007 Josef Spillner <spillner@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 #ifndef KTRANSLATABLE_H 00019 #define KTRANSLATABLE_H 00020 00021 #include <knewstuff2/knewstuff_export.h> 00022 00023 #include <QtCore/QString> 00024 #include <QtCore/QMap> 00025 #include <QtCore/QStringList> 00026 00027 namespace KNS 00028 { 00029 00030 class KTranslatablePrivate; 00031 00041 class KNEWSTUFF_EXPORT KTranslatable 00042 { 00043 public: 00044 typedef QMap<QString, QString> Map; 00045 typedef QMapIterator<QString, QString> Iterator; 00046 00050 KTranslatable(); 00051 00056 KTranslatable(const QString& string); 00057 00058 KTranslatable& operator=(const KTranslatable&); 00059 KTranslatable(const KTranslatable&); 00060 ~KTranslatable(); 00061 00068 void addString(const QString& lang, const QString& string); 00069 00075 QString representation() const; 00076 00083 QString translated(const QString& lang) const; 00084 00090 QStringList strings() const; 00091 00097 QStringList languages() const; 00098 00104 QString language() const; 00105 00111 QMap<QString, QString> stringmap() const; 00112 00118 bool isTranslated() const; 00119 00125 bool isEmpty() const; 00126 private: 00127 class KTranslatablePrivate* const d; 00128 00129 QMap<QString, QString> m_strings; 00130 }; 00131 00132 } 00133 00134 #endif