]> Git trees. - libqmvoc.git/commitdiff
prepare keduvocidentifier to contain the tenses
authorFrederik Gladhorn <gladhorn@kde.org>
Fri, 15 Aug 2008 12:22:19 +0000 (12:22 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Fri, 15 Aug 2008 12:22:19 +0000 (12:22 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=847457

keduvocdocument/keduvocidentifier.cpp
keduvocdocument/keduvocidentifier.h

index 7339b52b9c9418462e71a30c469e9305907e71de..4df78fc1af37ab29b3bbff16e897b5b8919b3e38 100644 (file)
@@ -1,15 +1,5 @@
 /***************************************************************************
-
-    C++ Implementation: keduvocidentifier
-
-    -----------------------------------------------------------------------
-
-    begin         : Mi Aug 29 2007
-
-    copyright     : (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
-
-    -----------------------------------------------------------------------
-
+    Copyright 2007-2008 Frederik Gladhorn <gladhorn@kde.org>
  ***************************************************************************/
 
 /***************************************************************************
@@ -42,20 +32,16 @@ public:
     QString m_type;
 
     /** I, you, he, she, it... */
-    KEduVocPersonalPronoun  m_personalPronouns;
+    KEduVocPersonalPronoun m_personalPronouns;
 
     /** the for english ;)
        der, die, das ... in german */
-    KEduVocArticle      m_articles;
+    KEduVocArticle m_articles;
 
     /** Future, present and past... and many more */
-    QSet < QString >    m_tenses;
-
-    /** Size hint for the width of this column - has to go somewere. Here at least we have the headers... */
-    int m_sizeHint;
+    QStringList m_tenses;
 };
 
-
 KEduVocIdentifier::KEduVocIdentifier()
 : d( new Private )
 {
@@ -63,13 +49,11 @@ KEduVocIdentifier::KEduVocIdentifier()
     d->m_locale = "en";
 }
 
-
 KEduVocIdentifier::~KEduVocIdentifier()
 {
     delete d;
 }
 
-
 KEduVocIdentifier::KEduVocIdentifier( const KEduVocIdentifier &other )
 : d( new Private )
 {
@@ -78,22 +62,22 @@ KEduVocIdentifier::KEduVocIdentifier( const KEduVocIdentifier &other )
     d->m_articles = other.d->m_articles;
     d->m_personalPronouns = other.d->m_personalPronouns;
     d->m_comment = other.d->m_comment;
-    d->m_sizeHint = other.d->m_sizeHint;
     d->m_tenses = other.d->m_tenses;
     d->m_type = other.d->m_type;
 }
 
-
 KEduVocIdentifier& KEduVocIdentifier::operator= ( const KEduVocIdentifier &other )
 {
     d->m_locale = other.d->m_locale;
     d->m_name = other.d->m_name;
     d->m_articles = other.d->m_articles;
     d->m_personalPronouns = other.d->m_personalPronouns;
+    d->m_comment = other.d->m_comment;
+    d->m_tenses = other.d->m_tenses;
+    d->m_type = other.d->m_type;
     return *this;
 }
 
-
 QString KEduVocIdentifier::name() const
 {
     return d->m_name;
@@ -114,7 +98,6 @@ void KEduVocIdentifier::setLocale(const QString & locale)
     d->m_locale = locale;
 }
 
-
 void KEduVocIdentifier::setArticle( const KEduVocArticle& articles )
 {
     d->m_articles = articles;
@@ -134,3 +117,20 @@ void KEduVocIdentifier::setPersonalPronouns( const KEduVocPersonalPronoun & pron
 {
     d->m_personalPronouns = pronouns;
 }
+
+const QString& KEduVocIdentifier::tense(int tenseIndex) const
+{
+    Q_ASSERT(d->m_tenses.size() > tenseIndex);
+    return d->m_tenses.value(tenseIndex);
+}
+
+void KEduVocIdentifier::setTense(int tenseIndex, const QString& tense)
+{
+    Q_ASSERT(d->m_tenses.size() >= tenseIndex);
+    if (tenseIndex == d->m_tenses.size()) {
+        d->m_tenses.append(tense);
+    } else {
+        d->m_tenses[tenseIndex] = tense;
+    }
+}
+
index eef95df460a0ee4c7cbbd77b644d251bb2fb7a09..1212d2d03a08426e261bcf11cae4c5cd1fc41fd2 100644 (file)
@@ -1,15 +1,5 @@
 /***************************************************************************
-
-    C++ Interface: keduvocidentifier
-
-    -----------------------------------------------------------------------
-
-    begin         : Mi Aug 29 2007
-
-    copyright     : (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
-
-    -----------------------------------------------------------------------
-
+    Copyright 2007-2008 Frederik Gladhorn <gladhorn@kde.org>
  ***************************************************************************/
 
 /***************************************************************************
@@ -35,8 +25,6 @@
 
 /**
 Class to store meta information about a language or any other category in the vocabulary.
-
- @author
 */
 class KEDUVOCDOCUMENT_EXPORT KEduVocIdentifier
 {
@@ -87,7 +75,6 @@ public:
      */
     void setLocale( const QString& name );
 
-
     /**
      * Articles (a, the in English, el, la,... in Spanish)
      * @returns articles
@@ -100,7 +87,6 @@ public:
      */
     void setArticle( const KEduVocArticle& article );
 
-
     /**
      * Get the personal pronouns for this identifier
      * @returns a KEduVocPersonalPronoun containing the personal pronouns
@@ -113,10 +99,23 @@ public:
      */
     void setPersonalPronouns( const KEduVocPersonalPronoun &pronouns );
 
+    /**
+     * Returns the name of tense number @p tenseIndex
+     * @param tenseIndex desired tense
+     * @return name of the tense
+     */
+    const QString& tense(int tenseIndex) const;
+
+    /**
+     * Sets the name of a tense for this language
+     * @param tenseIndex 
+     * @param tense 
+     */
+    void setTense(int tenseIndex, const QString& tense);
+
 private:
     class Private;
     Private * const d;
-
 };
 
 #endif