• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

libkdeedu/keduvocdocument

keduvocconjugation.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002 
00003     C++ Implementation: keduvocconjugation
00004 
00005     -----------------------------------------------------------------------
00006 
00007     begin         : Di Aug 28 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 
00024 #include "keduvocconjugation.h"
00025 #include "keduvoccommon_p.h"
00026 #include <KLocalizedString>
00027 #include <KDebug>
00028 
00029 class KEduVocConjugation::Private
00030 {
00031 public:
00032     KEduVocGrade m_grade;
00033     QMap<int, QString> m_conjugations;
00034 };
00035 
00036 
00037 KEduVocConjugation::KEduVocConjugation()
00038         : d( new Private )
00039 {}
00040 
00041 
00042 KEduVocConjugation::KEduVocConjugation( const KEduVocConjugation& other )
00043         : d( new Private )
00044 {
00045     d->m_grade = other.d->m_grade;
00046     d->m_conjugations = other.d->m_conjugations;
00047 }
00048 
00049 
00050 KEduVocConjugation::~KEduVocConjugation()
00051 {
00052     delete d;
00053 }
00054 
00055 
00056 KEduVocConjugation& KEduVocConjugation::operator = ( const KEduVocConjugation& other )
00057 {
00058     d->m_grade = other.d->m_grade;
00059     d->m_conjugations = other.d->m_conjugations;
00060     return *this;
00061 }
00062 
00063 bool KEduVocConjugation::operator ==(const KEduVocConjugation& other) const
00064 {
00065     return d->m_conjugations == other.d->m_conjugations &&
00066            d->m_grade == other.d->m_grade;
00067 }
00068 
00069 
00070 QString KEduVocConjugation::conjugation(int index) const
00071 {
00072     if ( d->m_conjugations.contains(index) ) {
00073         return d->m_conjugations.value(index);
00074     }
00075     return QString();
00076 }
00077 
00078 
00079 QString KEduVocConjugation::conjugation(ConjugationPerson person, ConjugationNumber number) const
00080 {
00081     return conjugation(indexOf(person, number));
00082 }
00083 
00084 void KEduVocConjugation::setConjugation(const QString & conjugation, ConjugationPerson person, ConjugationNumber number)
00085 {
00086     if ( !conjugation.isEmpty() ) {
00087         d->m_conjugations[indexOf(person, number)] = conjugation;
00088     } else {
00089         // if we received an empty string, remove the element.
00090         if ( d->m_conjugations.contains(indexOf(person, number)) ) {
00091             d->m_conjugations.remove(indexOf(person, number));
00092         }
00093     }
00094 }
00095 
00096 
00097 int KEduVocConjugation::indexOf(ConjugationPerson person, ConjugationNumber number)
00098 {
00099     return person + PersonMAX * number;
00100 }
00101 
00102 
00103 bool KEduVocConjugation::isEmpty()
00104 {
00105     return d->m_conjugations.count() == 0;
00106 }
00107 
00108 
00109 KEduVocGrade & KEduVocConjugation::grade()
00110 {
00111     return d->m_grade;
00112 }
00113 

libkdeedu/keduvocdocument

Skip menu "libkdeedu/keduvocdocument"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal