]> Git trees. - libqmvoc.git/commitdiff
port from Q3ValueList to QList, operator== added, API doc
authorMartin Pfeiffer <hubipete@gmx.net>
Sat, 22 Oct 2005 01:01:55 +0000 (01:01 +0000)
committerMartin Pfeiffer <hubipete@gmx.net>
Sat, 22 Oct 2005 01:01:55 +0000 (01:01 +0000)
svn path=/trunk/KDE/kdeedu/kwordquiz/src/keduvocexpression.h; revision=472807

kwordquiz/keduvocexpression.cpp
kwordquiz/keduvocexpression.h
kwordquiz/keduvocgrammar.cpp
kwordquiz/keduvocgrammar.h
kwordquiz/leitnerbox.h

index 7f2a42dc6b48935c960dc00f1f07dbfe6005d964..95af8cad7cded0617634b0c7efb8c2ad45277712 100644 (file)
@@ -403,67 +403,67 @@ void KEduVocExpression::removeTranslation (int idx)
      return;
 
    if (idx <= numTranslations())
-     m_translations.remove(m_translations.at(idx - 1));
+     m_translations.removeAll(m_translations.at(idx - 1));
 
    if (idx < (int)m_remarks.size() )
-     m_remarks.remove(m_remarks.at(idx - 1));
+     m_remarks.removeAll(m_remarks.at(idx - 1));
 
    if (idx < (int)m_conjugations.size() )
-     m_conjugations.remove(m_conjugations.at(idx -1));
+     m_conjugations.removeAll(m_conjugations.at(idx -1));
 
    if (idx < (int)m_comparisons.size() )
-     m_comparisons.remove(m_comparisons.at(idx - 1));
+     m_comparisons.removeAll(m_comparisons.at(idx - 1));
 
    if (idx < (int)m_fauxAmi.size() )
-     m_fauxAmi.remove(m_fauxAmi.at(idx -  1));
+     m_fauxAmi.removeAll(m_fauxAmi.at(idx -  1));
 
    if (idx < (int)m_reverseFauxAmi.size() )
-     m_reverseFauxAmi.remove(m_reverseFauxAmi.at(idx - 1));
+     m_reverseFauxAmi.removeAll(m_reverseFauxAmi.at(idx - 1));
 
    if (idx < (int)m_synonym.size() )
-     m_synonym.remove(m_synonym.at(idx - 1));
+     m_synonym.removeAll(m_synonym.at(idx - 1));
 
    if (idx < (int)m_example.size() )
-     m_example.remove(m_example.at(idx - 1));
+     m_example.removeAll(m_example.at(idx - 1));
 
    if (idx < (int)m_usageLabels.size() )
-     m_usageLabels.remove(m_usageLabels.at(idx - 1));
+     m_usageLabels.removeAll(m_usageLabels.at(idx - 1));
 
    if (idx < (int)m_paraphrases.size() )
-     m_paraphrases.remove(m_paraphrases.at(idx - 1));
+     m_paraphrases.removeAll(m_paraphrases.at(idx - 1));
 
    if (idx < (int)m_antonym.size() )
-     m_antonym.remove(m_antonym.at(idx - 1));
+     m_antonym.removeAll(m_antonym.at(idx - 1));
 
    if (idx < (int)m_expressionTypes.size() )
-     m_expressionTypes.remove(m_expressionTypes.at(idx - 1));
+     m_expressionTypes.removeAll(m_expressionTypes.at(idx - 1));
 
    if (idx < (int)m_pronounciations.size() )
-     m_pronounciations.remove(m_pronounciations.at(idx - 1));
+     m_pronounciations.removeAll(m_pronounciations.at(idx - 1));
 
    if (idx < (int)m_grades.size() )
-     m_grades.remove(m_grades.at(idx - 1));
+     m_grades.removeAll(m_grades.at(idx - 1));
 
    if (idx < (int)m_reverseGrades.size() )
-     m_reverseGrades.remove(m_reverseGrades.at(idx - 1));
+     m_reverseGrades.removeAll(m_reverseGrades.at(idx - 1));
 
    if (idx < (int)m_queryCounts.size() )
-     m_queryCounts.remove(m_queryCounts.at(idx - 1));
+     m_queryCounts.removeAll(m_queryCounts.at(idx - 1));
 
    if (idx < (int)m_reverseQueryCounts.size() )
-     m_reverseQueryCounts.remove(m_reverseQueryCounts.at(idx - 1));
+     m_reverseQueryCounts.removeAll(m_reverseQueryCounts.at(idx - 1));
 
    if (idx < (int)m_badCounts.size() )
-     m_badCounts.remove(m_badCounts.at(idx - 1));
+     m_badCounts.removeAll(m_badCounts.at(idx - 1));
 
    if (idx < (int)m_reverseBadCounts.size() )
-     m_reverseBadCounts.remove(m_reverseBadCounts.at(idx - 1));
+     m_reverseBadCounts.removeAll(m_reverseBadCounts.at(idx - 1));
 
    if (idx < (int)m_queryDates.size() )
-     m_queryDates.remove(m_queryDates.at(idx - 1));
+     m_queryDates.removeAll(m_queryDates.at(idx - 1));
 
    if (idx < (int)m_reverseQueryDates.size() )
-     m_reverseQueryDates.remove(m_reverseQueryDates.at(idx - 1));
+     m_reverseQueryDates.removeAll(m_reverseQueryDates.at(idx - 1));
 }
 
 
index 1a81a510542d725d2b50f387aa037c6546e4a010..2e3087d77dc6e6457e69e165551ba6b45624b9f1 100644 (file)
@@ -47,9 +47,9 @@
 #define KV_LEV7_GRADE      7
 #define KV_LEV7_TEXT       I18N_NOOP("Level 7")
 
-#include <q3valuelist.h>
-#include <qstringlist.h>
-#include <qdatetime.h>
+#include <QList>
+#include <QStringList>
+#include <QDateTime>
 
 #include "keduvocgrammar.h"
 #include "keduvocmultiplechoice.h"
@@ -446,17 +446,17 @@ class KEduVocExpression
   QStringList m_example;
   QStringList m_antonym;
   QStringList m_pronounciations;
-  Q3ValueList<grade_t> m_grades;
-  Q3ValueList<grade_t> m_reverseGrades;
-  Q3ValueList<count_t> m_queryCounts;
-  Q3ValueList<count_t> m_reverseQueryCounts;
-  Q3ValueList<count_t> m_badCounts;
-  Q3ValueList<count_t> m_reverseBadCounts;
-  Q3ValueList<QDateTime> m_queryDates;
-  Q3ValueList<QDateTime> m_reverseQueryDates;
-  Q3ValueList<KEduVocConjugation> m_conjugations;
-  Q3ValueList<KEduVocComparison> m_comparisons;
-  Q3ValueList<KEduVocMultipleChoice> m_multipleChoices;
+  QList<grade_t> m_grades;
+  QList<grade_t> m_reverseGrades;
+  QList<count_t> m_queryCounts;
+  QList<count_t> m_reverseQueryCounts;
+  QList<count_t> m_badCounts;
+  QList<count_t> m_reverseBadCounts;
+  QList<QDateTime> m_queryDates;
+  QList<QDateTime> m_reverseQueryDates;
+  QList<KEduVocConjugation> m_conjugations;
+  QList<KEduVocComparison> m_comparisons;
+  QList<KEduVocMultipleChoice> m_multipleChoices;
 
   QString m_leitnerBox;
   int m_lesson;
index a55c6f05fb3f09b33e58628ee158ca71f9d2f4a3..4a648b8f9b8a5dabf58bb5b00feffbdece35b590 100644 (file)
@@ -26,8 +26,6 @@
 #include "keduvocgrammar.h"
 
 #include <klocale.h>
-//Added by qt3to4:
-#include <Q3ValueList>
 
 KEduVocConjugation::conjug_name_t
 KEduVocConjugation::names [] =
@@ -76,6 +74,14 @@ void KEduVocComparison::clear()
   ls3 = "";
 }
 
+bool KEduVocComparison::operator ==( const KEduVocComparison& a ) const
+{
+       if ( ls1 == a.l1() && ls2 == a.l2() && ls3 == a.l3() )
+               return true;
+       else
+               return false;
+}
+
 
 //=================================================================
 
@@ -138,15 +144,29 @@ void KEduVocArticle::natural(QString &def, QString &indef) const
 //==============================================================
 
 
+bool KEduVocConjugation::operator ==( const KEduVocConjugation& a ) const
+{
+       if ( verbName == a.getVerbName() )
+               return true;
+       else
+               return false;
+}
+
+
+const QString& KEduVocConjugation::getVerbName() const
+{
+       return verbName;
+}
+
 int KEduVocConjugation::numEntries() const
 {
   return conjugations.size();
 }
 
 
-Q3ValueList<KEduVocTenseRelation> KEduVocConjugation::getRelation ()
+QList<KEduVocTenseRelation> KEduVocConjugation::getRelation ()
 {
-  Q3ValueList<KEduVocTenseRelation> vec;
+  QList<KEduVocTenseRelation> vec;
 
   for (int i = 0; i < numInternalNames(); i++) {
     vec.append(KEduVocTenseRelation(names[i].abbrev, i18n(names[i].name)));
@@ -285,7 +305,7 @@ void KEduVocConjugation::cleanUp ()
         && ctp->pers3_f_plur.stripWhiteSpace().isEmpty()
         && ctp->pers3_n_plur.stripWhiteSpace().isEmpty()
        )
-     conjugations.erase(conjugations.at(i));
+     conjugations.removeAt( i );
   }
 }
 
index 817a60d54d4f3d8c5f86ff5ede0b1abeac7f12c5..d3dd2e0a14bb4cf498204cdeb329ab79ffe0ec1b 100644 (file)
@@ -28,7 +28,7 @@
 #define grammarmanager_included
 
 #include <QString>
-#include <q3valuelist.h>
+#include <QList>
 #include <QStringList>
 
 #define CONJ_SIMPLE_PRESENT    "PrSi" // I live at home  what you frequently do
 
 #define UL_USER_TENSE          "#"   // designates number of user tense
 
+
+/**
+ * Class representing the articles of a language
+ * It contains all available articles of the language as QString
+ */
+
 class KEduVocArticle
 {
 
 public:
 
+  /**
+   * The constructor without arguments
+   */
   KEduVocArticle() {}
 
-  KEduVocArticle (
-   const QString &fem_def, const QString &fem_indef,
-   const QString &mal_def, const QString &mal_indef,
-   const QString &nat_def, const QString &nat_indef
-   );
-
+  /**
+   * The constructor with arguments
+   * @param fem_def reference to a QString with the definite female article
+   * @param fem_indef reference to a QString with the indefinite female article
+   * @param mal_def reference to a QString with the definite male article
+   * @param mal_indef reference to a QString with the indefinite male article
+   * @param nat_def reference to a QString with the definite neutral article
+   * @param nat_indef reference to a QString with the indefinite neutral article
+   */
+  KEduVocArticle ( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef,
+               const QString &nat_def, const QString &nat_indef );
+
+  /**
+   * Sets the female articles
+   * @param def const reference to a QString with the definite female article
+   * @param indef const reference to a QString with the indefinite female article
+   */
   void setFemale  (const QString &def, const QString &indef);
+
+  /**
+   * Sets the male articles
+   * @param def const reference to a QString with the definite male article
+   * @param indef const reference to a QString with the indefinite male article
+   */
   void setMale    (const QString &def, const QString &indef);
+
+  /**
+   * Sets the neutral articles
+   * @param def const reference to a QString with the definite neutral article
+   * @param indef const reference to a QString with the indefinite neutral article
+   */
   void setNatural (const QString &def, const QString &indef);
 
   void female  (QString &def, QString &indef) const;
@@ -79,13 +111,18 @@ class KEduVocComparison
 
 public:
 
+  /**
+   * The constructor without arguments
+   */
   KEduVocComparison() {}
 
-  KEduVocComparison (
-  const QString &l1,
-  const QString &l2,
-  const QString &l3
-  );
+  /**
+   * The constructor with arguments
+   * @param l1
+   * @param l2
+   * @param l3
+   */
+  KEduVocComparison ( const QString &l1, const QString &l2, const QString &l3 );
 
   void setL1 (const QString &s) { ls1 = s; }
   void setL2 (const QString &s) { ls2 = s; }
@@ -98,6 +135,8 @@ public:
   bool isEmpty() const;
   void clear();
 
+  bool operator == ( const KEduVocComparison& a ) const;
+
 protected:
 
   QString  ls1, ls2, ls3;
@@ -118,16 +157,32 @@ protected:
   QString  shortId, longId;
 };
 
+/**
+ * The conjugation of a verb
+ */
 class KEduVocConjugation
 {
 
 public:
 
+  /**
+   * The constructor
+   */
   KEduVocConjugation () {}
 
+  /**
+   * @return
+   */
   int numEntries() const;
 
-  static Q3ValueList<KEduVocTenseRelation> getRelation ();
+  /**
+   * @return 
+   */
+  static QList<KEduVocTenseRelation> getRelation ();
+
+  /**
+   * @param names
+   */
   static void setTenseNames (QStringList names);
 
   static QString getName (const QString &abbrev);
@@ -137,6 +192,8 @@ public:
   static int numInternalNames();
   static int numTenses();
 
+  const QString& getVerbName() const;
+  
   QString getType (int index);
   void setType (int index, const QString & type);
   void cleanUp();
@@ -170,36 +227,42 @@ public:
   void setPers3MalePlural(const QString &type, const QString &str);
   void setPers3NaturalPlural(const QString &type, const QString &str);
 
+  bool operator == ( const KEduVocConjugation& a ) const;
+
 private:
+  QString verbName;    // added to have something to compare in operator ==, assumes that there is always only one
+                       // KEduVocConjugation per verb
 
-  struct conjug_name_t {
+  struct conjug_name_t
+  {
     const char *abbrev;
     const char *name;
   };
-struct conjug_t
-{
-  conjug_t() {
-    p3common = false;
-    s3common = false;
-  }
-
-  QString type;
-  bool    p3common,
-          s3common;
-  QString pers1_sing,
-          pers2_sing,
-          pers3_m_sing,
-          pers3_f_sing,
-          pers3_n_sing,
-          pers1_plur,
-          pers2_plur,
-          pers3_m_plur,
-          pers3_f_plur,
-          pers3_n_plur;
-};
+  
+  struct conjug_t
+  {
+     conjug_t() {
+        p3common = false;
+        s3common = false;
+     }
+
+     QString type;
+     bool    p3common,
+             s3common;
+     QString pers1_sing,
+             pers2_sing,
+             pers3_m_sing,
+             pers3_f_sing,
+             pers3_n_sing,
+             pers1_plur,
+             pers2_plur,
+             pers3_m_plur,
+             pers3_f_plur,
+             pers3_n_plur;
+  };
 
 protected:
-  typedef Q3ValueList<conjug_t> conjug_tList;
+  typedef QList<conjug_t> conjug_tList;
   conjug_tList conjugations;
 
   static conjug_name_t names [];
index c238687c0f543b1fb0b0ef4c5ba94acb85fcd423..c32fa833d9dabcd86143c4fe794d37716830766b 100644 (file)
 #include <QString>
 
 /**
-@author Martin Pfeiffer
-*/
+ * A box in a LeitnerSystem - a LeitnerBox
+ * This box has a name and a certain number of vocabulars in it. This number changes continuosly
+ * as the vocab cards increase or decrease in box position. There is a determined order of LeitnerBoxes
+ * in a LeitnerSystem, therefore each LeitnerBox helds pointers to the LeitnerBox for wrong and correct
+ * cards of this LeitnerBox
+ * @author Martin Pfeiffer
+ */
 class LeitnerBox
 {
 public:
+       /**
+        * The constructor
+        */
        LeitnerBox();
 
        ~LeitnerBox();
 
-       void setCorrectWordBox( LeitnerBox* );  //sets the correct word box
-       void setWrongWordBox( LeitnerBox* );    //sets the wrong word box
+       /**
+        * Sets the LeitnerBox's pointer to the correct word LeitnerBox
+        * @param correctWordBox a pointer to the LeitnerBox to be set
+        */
+       void setCorrectWordBox( LeitnerBox* correctWordBox );
+
+       /**
+        * Sets the LeitnerBox's pointer to the wrong word LeitnerBox
+        * @param wrongWordBox a pointer to the LeitnerBox to be set
+        */
+       void setWrongWordBox( LeitnerBox* wrongWordBox );
        void setBoxName( const QString& );      //sets the boxes name
 
        void setVocabCount( int count );