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

libkdeedu/keduvocdocument

keduvoctranslation.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                         Vocabulary Expression Translation for KDE Edu
00003     -----------------------------------------------------------------------
00004     copyright      :(C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
00005  ***************************************************************************/
00006 
00007 /***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 
00017 #include "keduvoctranslation.h"
00018 
00019 #include <QtCore/QMap>
00020 
00021 #include <KDebug>
00022 
00023 #include "keduvocgrade.h"
00024 // #include "keduvocdeclination.h"
00025 
00026 class KEduVocTranslation::KEduVocTranslationPrivate
00027 {
00028 public:
00030     QString m_translation;
00031 
00033     QString m_type;
00035     QString m_subType;
00037     QString m_comment;
00039     QString m_hint;
00041     QString m_paraphrase;
00043     QString m_synonym;
00045     QString m_example;
00047     QString m_antonym;
00049     QString m_pronunciation;
00051     KUrl m_imageUrl;
00053     KUrl m_soundUrl;
00055     QSet<QString> m_usages;
00057     KEduVocMultipleChoice m_multipleChoice;
00058 
00060     QMap <QString, KEduVocConjugation> m_conjugations;
00062     KEduVocComparison m_comparison;
00063 
00064 //     KEduVocDeclination* m_declination;
00065 
00066     // Here come all int indexFrom grades. (If you want, imagine the TO grades as int indexFrom of the other translation. That is where they belong. )
00067     // User is asked to give THIS here as answer, than the grades go here.
00068     // User answers, this is the source, grades go to the other translation.
00069     // Grades go to the translation the user has to type/choose/whatever.
00070     // not all have to be supplied
00071     QMap<int, KEduVocGrade> m_grades;
00072 
00074     QMap<int, QString> m_falseFriends;
00075 };
00076 
00077 
00078 KEduVocTranslation::KEduVocTranslation() : d( new KEduVocTranslationPrivate )
00079 {}
00080 
00081 
00082 KEduVocTranslation::KEduVocTranslation( const QString &translation ) : d( new KEduVocTranslationPrivate )
00083 {
00084     d->m_translation = translation.simplified();
00085 }
00086 
00087 KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other ) : d( new KEduVocTranslationPrivate )
00088 {
00089     d->m_translation = other.d->m_translation;
00090     d->m_type = other.d->m_type;
00091     d->m_subType = other.d->m_subType;
00092     d->m_usages = other.d->m_usages;
00093     d->m_comment = other.d->m_comment;
00094     d->m_paraphrase = other.d->m_paraphrase;
00095     d->m_synonym = other.d->m_synonym;
00096     d->m_example = other.d->m_example;
00097     d->m_antonym = other.d->m_antonym;
00098     d->m_pronunciation = other.d->m_pronunciation;
00099     d->m_conjugations = other.d->m_conjugations;
00100     d->m_comparison = other.d->m_comparison;
00101     d->m_multipleChoice = other.d->m_multipleChoice;
00102     d->m_grades = other.d->m_grades;
00103     d->m_falseFriends = other.d->m_falseFriends;
00104     d->m_imageUrl = other.d->m_imageUrl;
00105     d->m_soundUrl = other.d->m_soundUrl;
00106 }
00107 
00108 KEduVocTranslation::~KEduVocTranslation()
00109 {
00110     delete d;
00111 }
00112 
00113 
00114 bool KEduVocTranslation::operator == ( const KEduVocTranslation & translation ) const
00115 {
00116     return d->m_translation == translation.d->m_translation &&
00117            d->m_type == translation.d->m_type &&
00118            d->m_subType == translation.d->m_subType &&
00119            d->m_usages == translation.d->m_usages &&
00120            d->m_comment == translation.d->m_comment &&
00121            d->m_paraphrase == translation.d->m_paraphrase &&
00122            d->m_synonym == translation.d->m_synonym &&
00123            d->m_example == translation.d->m_example &&
00124            d->m_antonym == translation.d->m_antonym &&
00125            d->m_pronunciation == translation.d->m_pronunciation &&
00126            d->m_imageUrl == translation.d->m_imageUrl &&
00127            d->m_soundUrl == translation.d->m_soundUrl &&
00128            d->m_comparison == translation.d->m_comparison &&
00129            d->m_multipleChoice == translation.d->m_multipleChoice &&
00130            d->m_falseFriends == translation.d->m_falseFriends &&
00131            d->m_conjugations == translation.d->m_conjugations &&
00132            d->m_grades == translation.d->m_grades;
00133 }
00134 
00135 
00136 KEduVocTranslation & KEduVocTranslation::operator = ( const KEduVocTranslation & translation )
00137 {
00138     d->m_translation = translation.d->m_translation;
00139     d->m_type = translation.d->m_type;
00140     d->m_subType = translation.d->m_subType;
00141     d->m_usages = translation.d->m_usages;
00142     d->m_comment = translation.d->m_comment;
00143     d->m_paraphrase = translation.d->m_paraphrase;
00144     d->m_synonym = translation.d->m_synonym;
00145     d->m_example = translation.d->m_example;
00146     d->m_antonym = translation.d->m_antonym;
00147     d->m_pronunciation = translation.d->m_pronunciation;
00148     d->m_imageUrl = translation.d->m_imageUrl;
00149     d->m_soundUrl = translation.d->m_soundUrl;
00150     d->m_comparison = translation.d->m_comparison;
00151     d->m_multipleChoice = translation.d->m_multipleChoice;
00152     d->m_falseFriends = translation.d->m_falseFriends;
00153     d->m_grades == translation.d->m_grades;
00154     d->m_conjugations = translation.d->m_conjugations;
00155     return *this;
00156 }
00157 
00158 
00159 QString KEduVocTranslation::text() const
00160 {
00161     return d->m_translation;
00162 }
00163 
00164 
00165 void KEduVocTranslation::setText( const QString & expr )
00166 {
00167     d->m_translation = expr.simplified();
00168 }
00169 
00170 
00171 QString KEduVocTranslation::comment() const
00172 {
00173     return d->m_comment;
00174 }
00175 
00176 
00177 void KEduVocTranslation::setComment( const QString & expr )
00178 {
00179     d->m_comment = expr.simplified();
00180 }
00181 
00182 
00183 void KEduVocTranslation::setFalseFriend( int indexFrom, const QString & expr )
00184 {
00185     d->m_falseFriends[indexFrom] = expr.simplified();
00186 }
00187 
00188 
00189 QString KEduVocTranslation::falseFriend( int indexFrom ) const
00190 {
00191     return d->m_falseFriends.value( indexFrom );
00192 }
00193 
00194 
00195 void KEduVocTranslation::setSynonym( const QString & expr )
00196 {
00197     d->m_synonym = expr.simplified();
00198 }
00199 
00200 
00201 QString KEduVocTranslation::synonym() const
00202 {
00203     return d->m_synonym;
00204 }
00205 
00206 
00207 void KEduVocTranslation::setExample( const QString & expr )
00208 {
00209     d->m_example = expr.simplified();
00210 }
00211 
00212 
00213 QString KEduVocTranslation::example() const
00214 {
00215     return d->m_example;
00216 }
00217 
00218 
00219 void KEduVocTranslation::setUsages( const QSet<QString> & usages )
00220 {
00221     d->m_usages = usages;
00222 }
00223 
00224 
00225 QSet<QString>& KEduVocTranslation::usages()
00226 {
00227     return d->m_usages;
00228 }
00229 
00230 
00231 void KEduVocTranslation::setParaphrase( const QString & expr )
00232 {
00233     d->m_paraphrase = expr.simplified();
00234 }
00235 
00236 
00237 QString KEduVocTranslation::paraphrase() const
00238 {
00239     return d->m_paraphrase;
00240 }
00241 
00242 
00243 void KEduVocTranslation::setAntonym( const QString & expr )
00244 {
00245     d->m_antonym = expr.simplified();
00246 }
00247 
00248 
00249 QString KEduVocTranslation::antonym() const
00250 {
00251     return d->m_antonym;
00252 }
00253 
00254 
00255 void KEduVocTranslation::setConjugation( const QString& tense, const KEduVocConjugation& con )
00256 {
00257     d->m_conjugations[tense] = con;
00258 }
00259 
00260 
00261 KEduVocConjugation& KEduVocTranslation::conjugation( const QString& tense )
00262 {
00263     return d->m_conjugations[tense];
00264 }
00265 
00266 
00267 void KEduVocTranslation::setComparison( const KEduVocComparison &con )
00268 {
00269     d->m_comparison = con;
00270 }
00271 
00272 
00273 KEduVocComparison & KEduVocTranslation::comparison()
00274 {
00275     return d->m_comparison;
00276 }
00277 
00278 
00279 void KEduVocTranslation::setMultipleChoice( const KEduVocMultipleChoice &mc )
00280 {
00281     d->m_multipleChoice = mc;
00282 }
00283 
00284 
00285 KEduVocMultipleChoice & KEduVocTranslation::multipleChoice()
00286 {
00287     return d->m_multipleChoice;
00288 }
00289 
00290 
00291 QString KEduVocTranslation::pronunciation() const
00292 {
00293     return d->m_pronunciation;
00294 }
00295 
00296 
00297 void KEduVocTranslation::setPronunciation( const QString & expr )
00298 {
00299     d->m_pronunciation = expr.simplified();
00300 }
00301 
00302 
00303 QString KEduVocTranslation::type() const
00304 {
00305     return d->m_type;
00306 }
00307 
00308 
00309 void KEduVocTranslation::setType( const QString &type )
00310 {
00311     d->m_type = type;
00312 }
00313 
00314 QString KEduVocTranslation::subType() const
00315 {
00316     return d->m_subType;
00317 }
00318 
00319 
00320 void KEduVocTranslation::setSubType( const QString &type )
00321 {
00322     d->m_subType = type;
00323 }
00324 
00325 void KEduVocTranslation::resetGrades()
00326 {
00327     d->m_grades.clear();
00328 }
00329 
00330 KEduVocGrade& KEduVocTranslation::gradeFrom( int indexFrom )
00331 {
00332     return d->m_grades[indexFrom];
00333 }
00334 
00335 QStringList KEduVocTranslation::conjugationTenses() const
00336 {
00337     return d->m_conjugations.keys();
00338 }
00339 
00340 QMap< QString, KEduVocConjugation > KEduVocTranslation::conjugations() const
00341 {
00342     return d->m_conjugations;
00343 }
00344 
00345 void KEduVocTranslation::setConjugations(const QMap< QString, KEduVocConjugation > & conjugations)
00346 {
00347     d->m_conjugations = conjugations;
00348 }
00349 
00351 KUrl KEduVocTranslation::soundUrl()
00352 {
00353     return d->m_soundUrl;
00354 }
00355 
00358 void KEduVocTranslation::setSoundUrl(const KUrl &url)
00359 {
00360     d->m_soundUrl = url;
00361 }
00362 
00364 KUrl KEduVocTranslation::imageUrl()
00365 {
00366     return d->m_imageUrl;
00367 }
00368 
00372 void KEduVocTranslation::setImageUrl(const KUrl &url)
00373 {
00374     d->m_imageUrl = url;
00375 }

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