]> Git trees. - libqmvoc.git/commitdiff
read write dual tag for pronouns, add bool dualExists to pronoun class, make visibili...
authorFrederik Gladhorn <gladhorn@kde.org>
Mon, 24 Sep 2007 22:45:17 +0000 (22:45 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Mon, 24 Sep 2007 22:45:17 +0000 (22:45 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=716578

keduvocdocument/keduvockvtml2reader.cpp
keduvocdocument/keduvockvtml2writer.cpp
keduvocdocument/keduvocpersonalpronoun.cpp
keduvocdocument/keduvocpersonalpronoun.h
keduvocdocument/kvtml2defs.h

index 2b8638b8bc06257cdec8744b370e83f35c49e17f..fa35d4970f8b30ce732fafe71e76325ee678a869 100644 (file)
@@ -804,6 +804,13 @@ bool KEduVocKvtml2Reader::readConjugationPerson(QDomElement & personElement, KEd
 
 bool KEduVocKvtml2Reader::readPersonalPronoun(QDomElement & pronounElement, KEduVocPersonalPronoun & pronoun)
 {
+    pronoun.setMaleFemaleDifferent(!pronounElement.firstChildElement(
+        KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT).isNull());
+    pronoun.setNeuterExists( !pronounElement.firstChildElement(
+        KVTML_THIRD_PERSON_NEUTER_EXISTS).isNull() );
+    pronoun.setDualExists( !pronounElement.firstChildElement(
+        KVTML_DUAL_EXISTS).isNull() );
+
     QDomElement personElement = pronounElement.firstChildElement( KVTML_SINGULAR );
     if ( !personElement.isNull() ) {
         readPersonalPronounChild( personElement, pronoun, KEduVocConjugation::Singular );
@@ -842,18 +849,6 @@ bool KEduVocKvtml2Reader::readPersonalPronounChild(QDomElement & personElement,
     currentElement = personElement.firstChildElement( KVTML_THIRD_NEUTER_COMMON );
     pronoun.setPersonalPronoun( currentElement.text(),
         KEduVocConjugation::ThirdNeuterCommon, number );
-
-    if ( !personElement.firstChildElement(KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT).isNull() ){
-        pronoun.setMaleFemaleDifferent(true);
-        if ( !personElement.firstChildElement(KVTML_THIRD_PERSON_NEUTER_EXISTS).isNull() ){
-            pronoun.setNeuterExists(true);
-        } else {
-            pronoun.setNeuterExists(false);
-        }
-    } else {
-        pronoun.setMaleFemaleDifferent(false);
-        pronoun.setNeuterExists(false);
-    }
 }
 
 
index 7d0a354bc02d2efcb83fb5fc2c39084f5ae49d31..229fc4a9a7043eba01b127ce290b8cbcb5db14bc 100644 (file)
@@ -595,6 +595,9 @@ bool KEduVocKvtml2Writer::writePersonalPronoun(QDomElement & pronounElement, con
     if ( pronoun.neuterExists() ) {
         pronounElement.appendChild( m_domDoc.createElement( KVTML_THIRD_PERSON_NEUTER_EXISTS ) );
     }
+    if ( pronoun.dualExists() ) {
+        pronounElement.appendChild( m_domDoc.createElement( KVTML_DUAL_EXISTS ) );
+    }
 
     for ( KEduVocConjugation::ConjugationNumber num = KEduVocConjugation::Singular; num < KEduVocConjugation::NumberMAX; num = KEduVocConjugation::ConjugationNumber(num +1) ) {
         QString first = pronoun.personalPronoun(
index 4b65a63d75e9231cda8e925764e544d419ecd9fb..1b03afbf1d5178b1d96fd8c267a3e741f177d3ce 100644 (file)
@@ -23,6 +23,7 @@ public:
 
     bool m_maleFemaleDifferent;
     bool m_neuterExists;
+    bool m_dualExists;
     QMap<int, QString> m_personalpronouns;
 };
 
@@ -31,6 +32,7 @@ KEduVocPersonalPronoun::Private::Private()
 {
     m_maleFemaleDifferent = false;
     m_neuterExists = false;
+    m_dualExists = false;
 }
 
 KEduVocPersonalPronoun::KEduVocPersonalPronoun()
@@ -44,6 +46,7 @@ KEduVocPersonalPronoun::KEduVocPersonalPronoun( const KEduVocPersonalPronoun& ot
     d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent;
     d->m_neuterExists = other.d->m_neuterExists;
     d->m_personalpronouns = other.d->m_personalpronouns;
+    d->m_dualExists = other.d->m_dualExists;
 }
 
 
@@ -58,14 +61,17 @@ KEduVocPersonalPronoun& KEduVocPersonalPronoun::operator = ( const KEduVocPerson
     d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent;
     d->m_neuterExists = other.d->m_neuterExists;
     d->m_personalpronouns = other.d->m_personalpronouns;
+    d->m_dualExists = other.d->m_dualExists;
     return *this;
 }
 
+
 bool KEduVocPersonalPronoun::operator ==(const KEduVocPersonalPronoun& other) const
 {
     return d->m_personalpronouns == other.d->m_personalpronouns &&
         d->m_maleFemaleDifferent == other.d->m_maleFemaleDifferent &&
         d->m_neuterExists == other.d->m_neuterExists;
+        d->m_dualExists == other.d->m_dualExists;
 }
 
 
@@ -108,3 +114,14 @@ void KEduVocPersonalPronoun::setNeuterExists(bool exists)
 {
     d->m_neuterExists = exists;
 }
+
+bool KEduVocPersonalPronoun::dualExists() const
+{
+    return d->m_dualExists;
+}
+
+void KEduVocPersonalPronoun::setDualExists(bool exists)
+{
+    d->m_dualExists = exists;
+}
+
index 8ba0d23b9bd376dfe0f6fca3b5cb333007b5b5d5..05a921ef84aa4beb11b7f7f2f6c4369923e5f918 100644 (file)
@@ -46,6 +46,9 @@ public:
 
     bool neuterExists() const;
     void setNeuterExists(bool exists);
+
+    bool dualExists() const;
+    void setDualExists(bool exists);
 private:
     class Private;
     Private* const d;
index 6de46297a0d11cfa30bb00fb86afd9a81f8595de..dc9d3479bab7638dcbcb795a52a689a44fac3330 100644 (file)
@@ -65,6 +65,7 @@
 #define KVTML_THIRD_PERSON_MALE_FEMALE_DIFFERENT "malefemaledifferent"
 // if this tag exists conjugations even have a neuter form for the third person
 #define KVTML_THIRD_PERSON_NEUTER_EXISTS "neuterexists"
+#define KVTML_DUAL_EXISTS        "dualexists"
 
 // word types
 #define KVTML_WORDTYPEDEFINITIONS   "wordtypedefinitions"