From: Frederik Gladhorn Date: Mon, 24 Sep 2007 22:45:17 +0000 (+0000) Subject: read write dual tag for pronouns, add bool dualExists to pronoun class, make visibili... X-Git-Tag: v3.94.0~13 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=452278997b0eab303c0c5156fb8ffb864daddb9a;p=libqmvoc.git read write dual tag for pronouns, add bool dualExists to pronoun class, make visibility for dual conjugation entris box depend on that. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=716578 --- diff --git a/keduvocdocument/keduvockvtml2reader.cpp b/keduvocdocument/keduvockvtml2reader.cpp index 2b8638b..fa35d49 100644 --- a/keduvocdocument/keduvockvtml2reader.cpp +++ b/keduvocdocument/keduvockvtml2reader.cpp @@ -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); - } } diff --git a/keduvocdocument/keduvockvtml2writer.cpp b/keduvocdocument/keduvockvtml2writer.cpp index 7d0a354..229fc4a 100644 --- a/keduvocdocument/keduvockvtml2writer.cpp +++ b/keduvocdocument/keduvockvtml2writer.cpp @@ -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( diff --git a/keduvocdocument/keduvocpersonalpronoun.cpp b/keduvocdocument/keduvocpersonalpronoun.cpp index 4b65a63..1b03afb 100644 --- a/keduvocdocument/keduvocpersonalpronoun.cpp +++ b/keduvocdocument/keduvocpersonalpronoun.cpp @@ -23,6 +23,7 @@ public: bool m_maleFemaleDifferent; bool m_neuterExists; + bool m_dualExists; QMap 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; +} + diff --git a/keduvocdocument/keduvocpersonalpronoun.h b/keduvocdocument/keduvocpersonalpronoun.h index 8ba0d23..05a921e 100644 --- a/keduvocdocument/keduvocpersonalpronoun.h +++ b/keduvocdocument/keduvocpersonalpronoun.h @@ -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; diff --git a/keduvocdocument/kvtml2defs.h b/keduvocdocument/kvtml2defs.h index 6de4629..dc9d347 100644 --- a/keduvocdocument/kvtml2defs.h +++ b/keduvocdocument/kvtml2defs.h @@ -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"