diff options
| author | 2023-04-30 18:30:36 -0400 | |
|---|---|---|
| committer | 2023-04-30 18:30:36 -0400 | |
| commit | 3565aad630864ecdbe53fdaa501ea708555b3c7c (patch) | |
| tree | c743e4ad0bad39ebdb2f514c7cc52d34a257ebbe /SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp | |
| parent | 1fdc150116cad39aae5c5da407c3312b47a59e3a (diff) | |
New upstream version 3.4.4+dfsg.upstream/3.4.4+dfsg
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp b/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp index 5aac017..f2c1b2c 100644 --- a/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp @@ -17,6 +17,15 @@ BiStrHash::BiStrHash(const BiStrHash& other) : hash(other.hash), inverted(other. { } +BiStrHash& BiStrHash::operator=(const BiStrHash& other) +{ + this->hash = other.hash; + this->inverted = other.inverted; + this->lowerHash = other.lowerHash; + this->lowerInverted = other.lowerInverted; + return *this; +} + void BiStrHash::insert(const QString& left, const QString& right) { if (lowerHash.contains(left.toLower())) @@ -163,6 +172,14 @@ QString BiStrHash::valueByLeft(const QString& left, Qt::CaseSensitivity cs) cons return hash.value(lowerHash.value(left.toLower())); } +QString BiStrHash::valueByLeft(const QString& left, const QString& defaultValue, Qt::CaseSensitivity cs) const +{ + if (containsLeft(left, cs)) + return valueByLeft(left, cs); + + return defaultValue; +} + QString BiStrHash::valueByRight(const QString& right, Qt::CaseSensitivity cs) const { if (cs == Qt::CaseSensitive) @@ -171,6 +188,14 @@ QString BiStrHash::valueByRight(const QString& right, Qt::CaseSensitivity cs) co return inverted.value(lowerInverted.value(right.toLower())); } +QString BiStrHash::valueByRight(const QString& right, const QString& defaultValue, Qt::CaseSensitivity cs) const +{ + if (containsRight(right, cs)) + return valueByRight(right, cs); + + return defaultValue; +} + QStringList BiStrHash::leftValues() const { return hash.keys(); |
