LibKEduVocDocument

keduvocpersonalpronoun.cpp
1/*
2 * SPDX-FileCopyrightText: 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5#include "keduvocpersonalpronoun.h"
6#include "keduvoccommon_p.h"
7
8#include <QMap>
9
10class KEduVocPersonalPronoun::Private
11{
12public:
13 Private();
14
15 bool m_maleFemaleDifferent;
16 bool m_neutralExists;
17 bool m_dualExists;
18 QMap<KEduVocWordFlags, QString> m_personalpronouns;
19};
20
21KEduVocPersonalPronoun::Private::Private()
22{
23 m_maleFemaleDifferent = false;
24 m_neutralExists = false;
25 m_dualExists = false;
26}
27
32
34 : d(new Private)
35{
36 d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent;
37 d->m_neutralExists = other.d->m_neutralExists;
38 d->m_personalpronouns = other.d->m_personalpronouns;
39 d->m_dualExists = other.d->m_dualExists;
40}
41
42KEduVocPersonalPronoun::~KEduVocPersonalPronoun()
43{
44 delete d;
45}
46
47KEduVocPersonalPronoun &KEduVocPersonalPronoun::operator=(const KEduVocPersonalPronoun &other)
48{
49 d->m_maleFemaleDifferent = other.d->m_maleFemaleDifferent;
50 d->m_neutralExists = other.d->m_neutralExists;
51 d->m_personalpronouns = other.d->m_personalpronouns;
52 d->m_dualExists = other.d->m_dualExists;
53 return *this;
54}
55
56bool KEduVocPersonalPronoun::operator==(const KEduVocPersonalPronoun &other) const
57{
58 return d->m_personalpronouns == other.d->m_personalpronouns && d->m_maleFemaleDifferent == other.d->m_maleFemaleDifferent
59 && d->m_neutralExists == other.d->m_neutralExists && d->m_dualExists == other.d->m_dualExists;
60}
61
62QString KEduVocPersonalPronoun::personalPronoun(KEduVocWordFlags flags) const
63{
64 QString p = d->m_personalpronouns.value(flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers | KEduVocWordFlag::genders));
65 if (p.isEmpty() && !(flags & KEduVocWordFlag::genders) && d->m_maleFemaleDifferent && d->m_neutralExists) {
66 // initial flag lookup failed, adding neuter gender flag
67 flags |= KEduVocWordFlag::Neuter;
68 p = d->m_personalpronouns.value(flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers | KEduVocWordFlag::genders));
69 }
70 return p;
71}
72
73void KEduVocPersonalPronoun::setPersonalPronoun(const QString &personalpronoun, KEduVocWordFlags flags)
74{
75 d->m_personalpronouns[flags & (KEduVocWordFlag::persons | KEduVocWordFlag::numbers | KEduVocWordFlag::genders)] = personalpronoun;
76}
77
78bool KEduVocPersonalPronoun::maleFemaleDifferent() const
79{
80 return d->m_maleFemaleDifferent;
81}
82
83void KEduVocPersonalPronoun::setMaleFemaleDifferent(bool different)
84{
85 d->m_maleFemaleDifferent = different;
86}
87
88bool KEduVocPersonalPronoun::neutralExists() const
89{
90 return d->m_neutralExists;
91}
92
93void KEduVocPersonalPronoun::setNeutralExists(bool exists)
94{
95 d->m_neutralExists = exists;
96}
97
98bool KEduVocPersonalPronoun::dualExists() const
99{
100 return d->m_dualExists;
101}
102
103void KEduVocPersonalPronoun::setDualExists(bool exists)
104{
105 d->m_dualExists = exists;
106}
The conjugation of a verb.
KEduVocPersonalPronoun()
The constructor.
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.