File indexing completed on 2024-04-21 03:48:21

0001 /*
0002  * SPDX-FileCopyrightText: 2007-2008 Frederik Gladhorn <gladhorn@kde.org>
0003  * SPDX-License-Identifier: GPL-2.0-or-later
0004  */
0005 
0006 #include "keduvocidentifier.h"
0007 
0008 class KEduVocIdentifier::Private
0009 {
0010 public:
0011     /// the name: English, Anatomy, Fruit salad
0012     QString m_name;
0013     /// the locale: en, de, es, ...
0014     QString m_locale;
0015 
0016     /**
0017      * Let the user provide some additional information about the language.
0018      * This could be Traditional/Simplified for Chinese to differentiate between them.
0019      */
0020     QString m_comment;
0021 
0022     /** not sure yet: language|other|??? */
0023     QString m_type;
0024 
0025     /** I, you, he, she, it... */
0026     KEduVocPersonalPronoun m_personalPronouns;
0027 
0028     /** the for english ;)
0029        der, die, das ... in german */
0030     KEduVocArticle m_articles;
0031 
0032     /** Future, present and past... and many more */
0033     QStringList m_tenses;
0034 };
0035 
0036 KEduVocIdentifier::KEduVocIdentifier()
0037     : d(new Private)
0038 {
0039     ///@todo maybe the user locale would be more appropriate
0040     d->m_locale = QStringLiteral("en");
0041 }
0042 
0043 KEduVocIdentifier::~KEduVocIdentifier()
0044 {
0045     delete d;
0046 }
0047 
0048 KEduVocIdentifier::KEduVocIdentifier(const KEduVocIdentifier &other)
0049     : d(new Private(*other.d))
0050 {
0051 #if 0
0052     d->m_locale = other.d->m_locale;
0053     d->m_name = other.d->m_name;
0054     d->m_articles = other.d->m_articles;
0055     d->m_personalPronouns = other.d->m_personalPronouns;
0056     d->m_comment = other.d->m_comment;
0057     d->m_tenses = other.d->m_tenses;
0058     d->m_type = other.d->m_type;
0059 #endif
0060 }
0061 
0062 KEduVocIdentifier &KEduVocIdentifier::operator=(const KEduVocIdentifier &other)
0063 {
0064     d->m_locale = other.d->m_locale;
0065     d->m_name = other.d->m_name;
0066     d->m_articles = other.d->m_articles;
0067     d->m_personalPronouns = other.d->m_personalPronouns;
0068     d->m_comment = other.d->m_comment;
0069     d->m_tenses = other.d->m_tenses;
0070     d->m_type = other.d->m_type;
0071     return *this;
0072 }
0073 
0074 QString KEduVocIdentifier::name() const
0075 {
0076     return d->m_name;
0077 }
0078 
0079 void KEduVocIdentifier::setName(const QString &name)
0080 {
0081     d->m_name = name;
0082 }
0083 
0084 QString KEduVocIdentifier::locale() const
0085 {
0086     return d->m_locale;
0087 }
0088 
0089 void KEduVocIdentifier::setLocale(const QString &locale)
0090 {
0091     d->m_locale = locale;
0092 }
0093 
0094 void KEduVocIdentifier::setArticle(const KEduVocArticle &articles)
0095 {
0096     d->m_articles = articles;
0097 }
0098 
0099 KEduVocArticle &KEduVocIdentifier::article() const
0100 {
0101     return d->m_articles;
0102 }
0103 
0104 KEduVocPersonalPronoun &KEduVocIdentifier::personalPronouns() const
0105 {
0106     return d->m_personalPronouns;
0107 }
0108 
0109 void KEduVocIdentifier::setPersonalPronouns(const KEduVocPersonalPronoun &pronouns)
0110 {
0111     d->m_personalPronouns = pronouns;
0112 }
0113 
0114 QString KEduVocIdentifier::tense(int tenseIndex) const
0115 {
0116     Q_ASSERT(d->m_tenses.size() > tenseIndex);
0117     return d->m_tenses.value(tenseIndex);
0118 }
0119 
0120 void KEduVocIdentifier::setTense(int tenseIndex, const QString &tense)
0121 {
0122     Q_ASSERT(d->m_tenses.size() >= tenseIndex);
0123     if (tenseIndex == d->m_tenses.size()) {
0124         d->m_tenses.append(tense);
0125     } else {
0126         d->m_tenses[tenseIndex] = tense;
0127     }
0128 }
0129 
0130 QStringList KEduVocIdentifier::tenseList() const
0131 {
0132     return d->m_tenses;
0133 }
0134 
0135 void KEduVocIdentifier::setTenseList(const QStringList &tenses)
0136 {
0137     d->m_tenses = tenses;
0138 }