libkdeedu/keduvocdocument
keduvocpersonalpronoun.cpp
Go to the documentation of this file.00001 /*************************************************************************** 00002 Copyright 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 00003 ***************************************************************************/ 00004 00005 /*************************************************************************** 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 ***************************************************************************/ 00013 00014 #include "keduvocpersonalpronoun.h" 00015 #include "keduvoccommon_p.h" 00016 #include <KLocalizedString> 00017 #include <KDebug> 00018 00019 class KEduVocPersonalPronoun::Private 00020 { 00021 public: 00022 Private(); 00023 00024 bool m_maleFemaleDifferent; 00025 bool m_neutralExists; 00026 bool m_dualExists; 00027 QMap<int, QString> m_personalpronouns; 00028 }; 00029 00030 00031 KEduVocPersonalPronoun::Private::Private() 00032 { 00033 m_maleFemaleDifferent = false; 00034 m_neutralExists = false; 00035 m_dualExists = false; 00036 } 00037 00038 KEduVocPersonalPronoun::KEduVocPersonalPronoun() 00039 : d( new Private ) 00040 {} 00041 00042 00043 KEduVocPersonalPronoun::KEduVocPersonalPronoun( const KEduVocPersonalPronoun& other ) 00044 : d( new Private ) 00045 { 00046 d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent; 00047 d->m_neutralExists = other.d->m_neutralExists; 00048 d->m_personalpronouns = other.d->m_personalpronouns; 00049 d->m_dualExists = other.d->m_dualExists; 00050 } 00051 00052 00053 KEduVocPersonalPronoun::~KEduVocPersonalPronoun() 00054 { 00055 delete d; 00056 } 00057 00058 00059 KEduVocPersonalPronoun& KEduVocPersonalPronoun::operator = ( const KEduVocPersonalPronoun& other ) 00060 { 00061 d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent; 00062 d->m_neutralExists = other.d->m_neutralExists; 00063 d->m_personalpronouns = other.d->m_personalpronouns; 00064 d->m_dualExists = other.d->m_dualExists; 00065 return *this; 00066 } 00067 00068 00069 bool KEduVocPersonalPronoun::operator ==(const KEduVocPersonalPronoun& other) const 00070 { 00071 return d->m_personalpronouns == other.d->m_personalpronouns && 00072 d->m_maleFemaleDifferent == other.d->m_maleFemaleDifferent && 00073 d->m_neutralExists == other.d->m_neutralExists && 00074 d->m_dualExists == other.d->m_dualExists; 00075 } 00076 00077 00078 QString KEduVocPersonalPronoun::personalPronoun(KEduVocConjugation::ConjugationPerson person, KEduVocConjugation::ConjugationNumber number) const 00079 { 00080 int index = indexOf(person, number); 00081 if ( d->m_personalpronouns.contains(index) ) { 00082 return d->m_personalpronouns.value(index); 00083 } 00084 return QString(); 00085 } 00086 00087 void KEduVocPersonalPronoun::setPersonalPronoun(const QString & personalpronoun, KEduVocConjugation::ConjugationPerson person, KEduVocConjugation::ConjugationNumber number) 00088 { 00089 d->m_personalpronouns[indexOf(person, number)] = personalpronoun; 00090 } 00091 00092 00093 int KEduVocPersonalPronoun::indexOf(KEduVocConjugation::ConjugationPerson person, KEduVocConjugation::ConjugationNumber number) const 00094 { 00095 return person + KEduVocConjugation::PersonMAX * number; 00096 } 00097 00098 bool KEduVocPersonalPronoun::maleFemaleDifferent() const 00099 { 00100 return d->m_maleFemaleDifferent; 00101 } 00102 00103 void KEduVocPersonalPronoun::setMaleFemaleDifferent(bool different) 00104 { 00105 d->m_maleFemaleDifferent = different; 00106 } 00107 00108 bool KEduVocPersonalPronoun::neutralExists() const 00109 { 00110 return d->m_neutralExists; 00111 } 00112 00113 void KEduVocPersonalPronoun::setNeutralExists(bool exists) 00114 { 00115 d->m_neutralExists = exists; 00116 } 00117 00118 bool KEduVocPersonalPronoun::dualExists() const 00119 { 00120 return d->m_dualExists; 00121 } 00122 00123 void KEduVocPersonalPronoun::setDualExists(bool exists) 00124 { 00125 d->m_dualExists = exists; 00126 } 00127
KDE 4.0 API Reference