]> Git trees. - libqmvoc.git/commitdiff
added d-pointers to other classes in grammar file (tenserelation, and comparison
authorJeremy Paul Whiting <jpwhiting@kde.org>
Mon, 23 Jul 2007 03:27:03 +0000 (03:27 +0000)
committerJeremy Paul Whiting <jpwhiting@kde.org>
Mon, 23 Jul 2007 03:27:03 +0000 (03:27 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=691166

kdeeducore/keduvocgrammar.cpp
kdeeducore/keduvocgrammar.h

index 422d810f858e736631c7901bb9a7c1edc00975d9..9db98c76121408300f2732fa0bf795fe0f150ea3 100644 (file)
@@ -93,68 +93,94 @@ QStringList KEduVocConjugation::Private::userTenses;
 
 //================================================================
 
+class KEduVocComparison::Private
+{
+  public:
+    QString ls1;
+    QString ls2;
+    QString ls3;
+};
 
 KEduVocComparison::KEduVocComparison()
+: d(new Private)
 {
 }
 
+KEduVocComparison::KEduVocComparison(const KEduVocComparison &other)
+: d(new Private)
+{
+  setL1(other.l1());
+  setL2(other.l2());
+  setL3(other.l3());
+}
 
 KEduVocComparison::KEduVocComparison(const QString &l1, const QString &l2, const QString &l3)
+: d(new Private)
 {
   setL1(l1);
   setL2(l2);
   setL3(l3);
 }
 
+KEduVocComparison::~KEduVocComparison()
+{
+  delete d;
+}
+
+KEduVocComparison &KEduVocComparison::operator=(const KEduVocComparison& other)
+{
+  setL1(other.l1());
+  setL2(other.l2());
+  setL3(other.l3());
+  
+  return *this;
+}
 
 bool KEduVocComparison::isEmpty() const
 {
-  return   ls1.simplified().isEmpty() && ls2.simplified().isEmpty() && ls3.simplified().isEmpty();
+  return d->ls1.simplified().isEmpty() && d->ls2.simplified().isEmpty() && d->ls3.simplified().isEmpty();
 }
 
 
 void KEduVocComparison::clear()
 {
-  ls1 = "";
-  ls2 = "";
-  ls3 = "";
+  d->ls1 = "";
+  d->ls2 = "";
+  d->ls3 = "";
 }
 
 bool KEduVocComparison::operator ==(const KEduVocComparison& a) const
 {
-  if (ls1 == a.l1() && ls2 == a.l2() && ls3 == a.l3())
-    return true;
-  else
-  return false;
+  return (d->ls1 == a.l1() && d->ls2 == a.l2() && d->ls3 == a.l3());
 }
 
 void KEduVocComparison::setL1(const QString &s)
 { 
-    ls1 = s; 
+  d->ls1 = s; 
 }
 
 void KEduVocComparison::setL2(const QString &s) 
 { 
-    ls2 = s; 
+  d->ls2 = s; 
 }
 
 void KEduVocComparison::setL3(const QString &s) 
 { 
-    ls3 = s; 
+  d->ls3 = s; 
 }
 
 QString KEduVocComparison::l1() const 
 { 
-    return ls1; 
+  return d->ls1; 
 }
 QString KEduVocComparison::l2() const 
 { 
-    return ls2; 
+  return d->ls2; 
 }
 
 QString KEduVocComparison::l3() const 
 { 
-    return ls3; 
+  return d->ls3; 
 }
 
 
@@ -255,15 +281,44 @@ void KEduVocArticle::getNatural(QString *def, QString *indef) const
 }
 
 //==============================================================
+class KEduVocTenseRelation::Private
+{
+  public:
+    QString shortId;
+    QString longId;
+};
+
+KEduVocTenseRelation::KEduVocTenseRelation()
+: d(new Private)
+{
+}
+
+KEduVocTenseRelation::KEduVocTenseRelation (const QString & _short, const QString & _long)
+: d(new Private)
+{
+  d->shortId = _short;
+  d->longId = _long;
+}
+
+KEduVocTenseRelation::~KEduVocTenseRelation()
+{
+  delete d;
+}
+
+KEduVocTenseRelation &KEduVocTenseRelation::operator=(const KEduVocTenseRelation &other)
+{
+  d->shortId = other.shortStr();
+  d->longId = other.longStr();
+}
 
 QString KEduVocTenseRelation::shortStr() const 
 { 
-    return shortId; 
+  return d->shortId; 
 }
 
 QString KEduVocTenseRelation::longStr()  const 
 { 
-    return longId;  
+  return d->longId;  
 }
 
 
index 5cc26e38ab8bc4a759dd91af90aec153a2342598..8721404faa7739f9601897d909d6581f982f7ad1 100644 (file)
@@ -44,9 +44,6 @@
 
 #define UL_USER_TENSE          "#"   // designates number of user tense
 
-
-class KEduVocArticlePrivate;
-
 /**
  * Class representing the articles of a language
  *
@@ -105,6 +102,9 @@ public:
   void getMale   (QString *def, QString *indef) const;
   void getNatural(QString *def, QString *indef) const;
   
+  /**
+   * assignment operator for d-pointer copying
+   */
   KEduVocArticle &operator=(const KEduVocArticle& other);
 
 private:
@@ -121,6 +121,9 @@ public:
    * The constructor without arguments
    */
   explicit KEduVocComparison();
+  
+  /** copy constructor */
+  KEduVocComparison(const KEduVocComparison &other);
 
   /**
    * The constructor with arguments
@@ -130,6 +133,9 @@ public:
    */
   KEduVocComparison(const QString &l1, const QString &l2, const QString &l3);
 
+  /** default destructor, deletes the d-pointer */
+  ~KEduVocComparison();
+  
   void setL1(const QString &s);
   void setL2(const QString &s);
   void setL3(const QString &s);
@@ -143,25 +149,35 @@ public:
 
   bool operator == (const KEduVocComparison& a) const;
 
+  /**
+   * assignment operator for d-pointer copying
+   */
+  KEduVocComparison &operator=(const KEduVocComparison& other);
+
 private:
-  QString ls1;
-  QString ls2;
-  QString ls3;
+  class Private;
+  Private * const d;
 };
 
 
 class KDEEDUCORE_EXPORT KEduVocTenseRelation
 {
 public:
-  KEduVocTenseRelation() {}
-  KEduVocTenseRelation (const QString & _short, const QString & _long): shortId (_short), longId(_long) {}
+  /** default constructor */
+  KEduVocTenseRelation();
+  KEduVocTenseRelation (const QString & _short, const QString & _long);
+  
+  /** default destructor, deletes the d-pointer */
+  ~KEduVocTenseRelation();
 
   QString shortStr() const;
   QString longStr()  const;
 
+  KEduVocTenseRelation &operator=(const KEduVocTenseRelation &other);
+
 private:
-  QString shortId;
-  QString longId;
+  class Private;
+  Private * const d;
 };
 
 /**