diff options
author | Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> | 2015-11-26 11:30:03 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> | 2015-11-27 14:23:11 +0000 |
commit | 423d031930fe734c234dd8bf8825125f49d03ce2 (patch) | |
tree | 326ad81c8775d61ced9182cc7fb0a175dec24715 | |
parent | 77bc9758a4024987de8a883dda22caca57cacb47 (diff) |
Add equality operator for QVoice
This way, one is able to check the content via indexOf in the QVector
returned by availableLocales() and availableVoices().
Change-Id: I905bb58e61280674e4e6d94a2e96dcc2b34aca68
Reviewed-by: Jeremy Whiting <jpwhiting@kde.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
-rw-r--r-- | src/tts/qvoice.cpp | 15 | ||||
-rw-r--r-- | src/tts/qvoice.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/tts/qvoice.cpp b/src/tts/qvoice.cpp index d138f94..8a578fd 100644 --- a/src/tts/qvoice.cpp +++ b/src/tts/qvoice.cpp @@ -69,6 +69,21 @@ void QVoice::operator=(const QVoice &other) d->data = other.d->data; } +bool QVoice::operator==(const QVoice &other) +{ + if (d->name != other.d->name || + d->gender != other.d->gender || + d->age != other.d->age || + d->data != other.d->data) + return false; + return true; +} + +bool QVoice::operator!=(const QVoice &other) +{ + return !operator==(other); +} + void QVoice::setName(const QString &name) { d->name = name; diff --git a/src/tts/qvoice.h b/src/tts/qvoice.h index ab4a122..e7f1021 100644 --- a/src/tts/qvoice.h +++ b/src/tts/qvoice.h @@ -71,6 +71,9 @@ public: void operator=(const QVoice &other); + bool operator==(const QVoice &other); + bool operator!=(const QVoice &other); + QString name() const; Gender gender() const; Age age() const; |