File: keduvocidentifier.cpp

package info (click to toggle)
libkeduvocdocument 4%3A16.08.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 948 kB
  • ctags: 1,086
  • sloc: cpp: 7,995; sh: 16; makefile: 10
file content (146 lines) | stat: -rw-r--r-- 3,870 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/***************************************************************************
    Copyright 2007-2008 Frederik Gladhorn <gladhorn@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include "keduvocidentifier.h"

class KEduVocIdentifier::Private
{
public:
    /// the name: English, Anatomy, Fruit salad
    QString m_name;
    /// the locale: en, de, es, ...
    QString m_locale;

    /**
     * Let the user provide some additional informatioin about the language.
     * This could be Traditional/Simplified for chinese to differentiate between them.
     */
    QString m_comment;

    /** not sure yet: language|other|??? */
    QString m_type;

    /** I, you, he, she, it... */
    KEduVocPersonalPronoun m_personalPronouns;

    /** the for english ;)
       der, die, das ... in german */
    KEduVocArticle m_articles;

    /** Future, present and past... and many more */
    QStringList m_tenses;
};

KEduVocIdentifier::KEduVocIdentifier()
: d( new Private )
{
    ///@todo maybe the user locale would be more appropriate
    d->m_locale = "en";
}

KEduVocIdentifier::~KEduVocIdentifier()
{
    delete d;
}

KEduVocIdentifier::KEduVocIdentifier( const KEduVocIdentifier &other )
: d( new Private( *other.d ) )
{
#if 0
    d->m_locale = other.d->m_locale;
    d->m_name = other.d->m_name;
    d->m_articles = other.d->m_articles;
    d->m_personalPronouns = other.d->m_personalPronouns;
    d->m_comment = other.d->m_comment;
    d->m_tenses = other.d->m_tenses;
    d->m_type = other.d->m_type;
#endif
}

KEduVocIdentifier& KEduVocIdentifier::operator= ( const KEduVocIdentifier &other )
{
    d->m_locale = other.d->m_locale;
    d->m_name = other.d->m_name;
    d->m_articles = other.d->m_articles;
    d->m_personalPronouns = other.d->m_personalPronouns;
    d->m_comment = other.d->m_comment;
    d->m_tenses = other.d->m_tenses;
    d->m_type = other.d->m_type;
    return *this;
}

QString KEduVocIdentifier::name() const
{
    return d->m_name;
}

void KEduVocIdentifier::setName(const QString & name)
{
    d->m_name = name;
}

QString KEduVocIdentifier::locale() const
{
    return d->m_locale;
}

void KEduVocIdentifier::setLocale(const QString & locale)
{
    d->m_locale = locale;
}

void KEduVocIdentifier::setArticle( const KEduVocArticle& articles )
{
    d->m_articles = articles;
}

KEduVocArticle& KEduVocIdentifier::article() const
{
    return d->m_articles;
}

KEduVocPersonalPronoun& KEduVocIdentifier::personalPronouns() const
{
    return d->m_personalPronouns;
}

void KEduVocIdentifier::setPersonalPronouns( const KEduVocPersonalPronoun & pronouns )
{
    d->m_personalPronouns = pronouns;
}

QString KEduVocIdentifier::tense(int tenseIndex) const
{
    Q_ASSERT(d->m_tenses.size() > tenseIndex);
    return d->m_tenses.value(tenseIndex);
}

void KEduVocIdentifier::setTense(int tenseIndex, const QString& tense)
{
    Q_ASSERT(d->m_tenses.size() >= tenseIndex);
    if (tenseIndex == d->m_tenses.size()) {
        d->m_tenses.append(tense);
    } else {
        d->m_tenses[tenseIndex] = tense;
    }
}

QStringList KEduVocIdentifier::tenseList() const
{
    return d->m_tenses;
}

void KEduVocIdentifier::setTenseList(const QStringList& tenses)
{
    d->m_tenses = tenses;
}