aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-31 15:19:28 +0300
committerMarc Mutz <marc.mutz@kdab.com>2019-08-01 15:37:01 +0300
commite342f1366eff06f3cf01991b377c880b2d246177 (patch)
tree3a98b467a5eec7cdc06cf7c2aa5991b418e1e628
parentf3dd2e8cc0d913acaa9046990978a1e8ed02e472 (diff)
ZhuyinTable/CangjieTable: mark all functions as noexcept
Doesn't change the executable, as -fno-exceptions is in effect. Change-Id: I94fe49cce3f4109247f9b1b6b22eec71cb548585 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/plugins/tcime/3rdparty/tcime/cangjietable.cpp6
-rw-r--r--src/plugins/tcime/3rdparty/tcime/cangjietable.h6
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp16
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyintable.h16
4 files changed, 22 insertions, 22 deletions
diff --git a/src/plugins/tcime/3rdparty/tcime/cangjietable.cpp b/src/plugins/tcime/3rdparty/tcime/cangjietable.cpp
index cb43cfac..af6b22bd 100644
--- a/src/plugins/tcime/3rdparty/tcime/cangjietable.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/cangjietable.cpp
@@ -33,12 +33,12 @@ static Q_CONSTEXPR char16_t letters[] =
u"\x65e5\x6708\x91d1\x6728\x6c34\x706b\x571f\x7af9\x6208\x5341\x5927\x4e2d\x4e00\x5f13"
u"\x4eba\x5fc3\x624b\x53e3\x5c38\x5eff\x5c71\x5973\x7530\x96e3\x535c";
-bool CangjieTable::isLetter(QChar c)
+bool CangjieTable::isLetter(QChar c) noexcept
{
return QStringView(letters).contains(c);
}
-int CangjieTable::getPrimaryIndex(QStringView code)
+int CangjieTable::getPrimaryIndex(QStringView code) noexcept
{
const qsizetype length = code.size();
if ((length < 1) || (length > MAX_CODE_LENGTH))
@@ -61,7 +61,7 @@ int CangjieTable::getPrimaryIndex(QStringView code)
return index + QStringView(letters).indexOf(c) + 1;
}
-int CangjieTable::getSecondaryIndex(QStringView code)
+int CangjieTable::getSecondaryIndex(QStringView code) noexcept
{
int index = 0;
const qsizetype last = code.size() - 1;
diff --git a/src/plugins/tcime/3rdparty/tcime/cangjietable.h b/src/plugins/tcime/3rdparty/tcime/cangjietable.h
index 223caa0a..575fd49c 100644
--- a/src/plugins/tcime/3rdparty/tcime/cangjietable.h
+++ b/src/plugins/tcime/3rdparty/tcime/cangjietable.h
@@ -47,7 +47,7 @@ public:
/**
* Returns {@code true} only if the given character is a valid cangjie letter.
*/
- static bool isLetter(QChar c);
+ static bool isLetter(QChar c) noexcept;
/**
* Returns the primary index calculated by the first and last letter of
@@ -56,7 +56,7 @@ public:
* @param code should not be null.
* @return -1 for invalid code.
*/
- static int getPrimaryIndex(QStringView code);
+ static int getPrimaryIndex(QStringView code) noexcept;
/**
* Returns the secondary index calculated by letters between the first and
@@ -65,7 +65,7 @@ public:
* @param code should not be null.
* @return -1 for invalid code.
*/
- static int getSecondaryIndex(QStringView code);
+ static int getSecondaryIndex(QStringView code) noexcept;
};
}
diff --git a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
index 2f3da2ab..ce68618b 100644
--- a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
@@ -53,7 +53,7 @@ const QChar ZhuyinTable::DEFAULT_TONE = QLatin1Char(' ');
// Default tone and four tone symbols: '˙', 'ˊ', 'ˇ', and 'ˋ'.
static Q_CONSTEXPR char16_t tones[] = u" \x02d9\x02ca\x02c7\x02cb";
-int ZhuyinTable::getInitials(QChar initials)
+int ZhuyinTable::getInitials(QChar initials) noexcept
{
// Calculate the index by its distance to the first initials 'ㄅ' (b).
int index = initials.unicode() - 0x3105 + 1;
@@ -64,7 +64,7 @@ int ZhuyinTable::getInitials(QChar initials)
return (index >= 0) ? index : -1;
}
-int ZhuyinTable::getFinals(QStringView finals)
+int ZhuyinTable::getFinals(QStringView finals) noexcept
{
if (finals.length() == 0)
// Syllables ending with no finals can still be valid.
@@ -106,7 +106,7 @@ int ZhuyinTable::getFinals(QStringView finals)
return -1;
}
-int ZhuyinTable::getSyllablesIndex(QStringView syllables)
+int ZhuyinTable::getSyllablesIndex(QStringView syllables) noexcept
{
if (syllables.isEmpty())
return -1;
@@ -123,7 +123,7 @@ int ZhuyinTable::getSyllablesIndex(QStringView syllables)
return (finals * INITIALS_SIZE + initials);
}
-int ZhuyinTable::getTones(QChar c)
+int ZhuyinTable::getTones(QChar c) noexcept
{
const qsizetype i = QStringView(tones).indexOf(c);
if (i >= 0)
@@ -132,22 +132,22 @@ int ZhuyinTable::getTones(QChar c)
return 0;
}
-int ZhuyinTable::getTonesCount()
+int ZhuyinTable::getTonesCount() noexcept
{
return int(QStringView(tones).size());
}
-bool ZhuyinTable::isTone(QChar c)
+bool ZhuyinTable::isTone(QChar c) noexcept
{
return QStringView(tones).contains(c);
}
-bool ZhuyinTable::isYiWuYuFinals(QChar c)
+bool ZhuyinTable::isYiWuYuFinals(QChar c) noexcept
{
return c == YI_FINALS || c == WU_FINALS || c == YU_FINALS;
}
-auto ZhuyinTable::stripTones(QStringView input) -> StripTonesResult
+auto ZhuyinTable::stripTones(QStringView input) noexcept -> StripTonesResult
{
StripTonesResult result;
result.ok = false;
diff --git a/src/plugins/tcime/3rdparty/tcime/zhuyintable.h b/src/plugins/tcime/3rdparty/tcime/zhuyintable.h
index 57e9d36c..321cee83 100644
--- a/src/plugins/tcime/3rdparty/tcime/zhuyintable.h
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyintable.h
@@ -27,18 +27,18 @@
namespace tcime {
struct ZhuyinTable {
static const QChar DEFAULT_TONE;
- static int getInitials(QChar initials);
- static int getFinals(QStringView finals);
- static int getSyllablesIndex(QStringView syllables);
- static int getTones(QChar c);
- static int getTonesCount();
- static bool isTone(QChar c);
- static bool isYiWuYuFinals(QChar c);
+ static int getInitials(QChar initials) noexcept;
+ static int getFinals(QStringView finals) noexcept;
+ static int getSyllablesIndex(QStringView syllables) noexcept;
+ static int getTones(QChar c) noexcept;
+ static int getTonesCount() noexcept;
+ static bool isTone(QChar c) noexcept;
+ static bool isYiWuYuFinals(QChar c) noexcept;
struct StripTonesResult {
bool ok;
QStringView pair[2];
};
- static StripTonesResult stripTones(QStringView input);
+ static StripTonesResult stripTones(QStringView input) noexcept;
};
}