diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-03-01 10:40:03 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-03-13 21:20:51 +0000 |
commit | 0b66d4a3d4892dc0751df5e0b00cb7a54cfb62bd (patch) | |
tree | 4eac4672727309809553545e9e4a229af0dd0f73 /src/corelib/text | |
parent | eaae969ac604df5aef0c36a0ddaa20209bff70db (diff) |
Don't use unnamed namespace in qlocale_p.h
Pointed out by CodeChecker. It's included by plenty of places, so
duplicating that anonymous namespace potential code duplication. Use
QtPrivate namespace instead.
Change-Id: I9ccfd569089ea01a8be9ffd87889bca73b70dd9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qlocale.cpp | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_p.h | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index b9807735e3..6202bfdfbb 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -3920,7 +3920,7 @@ class NumericTokenizer // TODO: use deterministic finite-state-automata. // TODO QTBUG-95460: CLDR has Inf/NaN representations per locale. static constexpr char lettersInfNaN[] = "afin"; // Letters of Inf, NaN - static constexpr auto matchInfNaN = makeCharacterSetMatch<lettersInfNaN>(); + static constexpr auto matchInfNaN = QtPrivate::makeCharacterSetMatch<lettersInfNaN>(); const QStringView m_text; const QLocaleData::NumericData m_guide; qsizetype m_index = 0; diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index 99b2528633..fdf6889748 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -55,8 +55,8 @@ template <typename MaskType, uchar Lowest> struct QCharacterSetMatch } }; -namespace { -static constexpr char ascii_space_chars[] = +namespace QtPrivate { +inline constexpr char ascii_space_chars[] = "\t" // 9: HT - horizontal tab "\n" // 10: LF - line feed "\v" // 11: VT - vertical tab @@ -64,7 +64,8 @@ static constexpr char ascii_space_chars[] = "\r" // 13: CR - carriage return " "; // 32: space -template <const char *Set, int ForcedLowest = -1> static constexpr auto makeCharacterSetMatch() +template <const char *Set, int ForcedLowest = -1> +inline constexpr auto makeCharacterSetMatch() { constexpr auto view = std::string_view(Set); constexpr uchar MinElement = *std::min_element(view.begin(), view.end()); @@ -87,7 +88,7 @@ template <const char *Set, int ForcedLowest = -1> static constexpr auto makeChar return QCharacterSetMatch<MaskType, MinElement>(view); } } -} // unnamed namespace +} // QtPrivate struct QLocaleData; // Subclassed by Android platform plugin: @@ -536,7 +537,7 @@ QString qt_readEscapedFormatString(QStringView format, qsizetype *idx); [[nodiscard]] constexpr inline bool ascii_isspace(uchar c) { - constexpr auto matcher = makeCharacterSetMatch<ascii_space_chars>(); + constexpr auto matcher = QtPrivate::makeCharacterSetMatch<QtPrivate::ascii_space_chars>(); return matcher.matches(c); } |