aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp25
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();