libkdeedu/keduvocdocument
keduvocdeclination.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 00003 C++ Implementation: keduvocdeclination 00004 00005 ----------------------------------------------------------------------- 00006 00007 begin : Do Sep 20 2007 00008 00009 copyright : (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 00010 00011 ----------------------------------------------------------------------- 00012 00013 ***************************************************************************/ 00014 00015 /*************************************************************************** 00016 * * 00017 * This program is free software; you can redistribute it and/or modify * 00018 * it under the terms of the GNU General Public License as published by * 00019 * the Free Software Foundation; either version 2 of the License, or * 00020 * (at your option) any later version. * 00021 * * 00022 ***************************************************************************/ 00023 #include "keduvocdeclination.h" 00024 00025 #include <QtCore/QMap> 00026 00027 class KEduVocDeclination::Private 00028 { 00029 public: 00030 QMap<int, QString> m_declinations; 00031 }; 00032 00033 KEduVocDeclination::KEduVocDeclination() 00034 :d (new Private) 00035 { 00036 } 00037 00038 KEduVocDeclination::KEduVocDeclination(const KEduVocDeclination & other) 00039 :d (new Private) 00040 { 00041 d->m_declinations = other.d->m_declinations; 00042 } 00043 00044 KEduVocDeclination & KEduVocDeclination::operator =(const KEduVocDeclination & other) 00045 { 00046 d->m_declinations = other.d->m_declinations; 00047 return *this; 00048 } 00049 00050 KEduVocDeclination::~KEduVocDeclination() 00051 { 00052 delete d; 00053 } 00054 00055 QString KEduVocDeclination::declination(DeclinationNumber number, DeclinationCase decCase) 00056 { 00057 if ( d->m_declinations.contains(indexOf(number, decCase)) ) { 00058 return d->m_declinations.value(indexOf(number, decCase)); 00059 } else { 00060 return QString(); 00061 } 00062 } 00063 00064 void KEduVocDeclination::setDeclination(const QString & declination, DeclinationNumber number, DeclinationCase decCase) 00065 { 00066 d->m_declinations[indexOf(number, decCase)] = declination; 00067 } 00068 00069 int KEduVocDeclination::indexOf(DeclinationNumber number, DeclinationCase decCase) 00070 { 00071 return number * DeclinationCaseMAX + decCase; 00072 } 00073 00074 bool KEduVocDeclination::isEmpty() 00075 { 00076 return d->m_declinations.isEmpty(); 00077 } 00078 00079 00080
KDE 4.0 API Reference