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>
This commit is contained in:
Edward Welbourne 2023-03-01 10:40:03 +01:00 committed by Thiago Macieira
parent eaae969ac6
commit 0b66d4a3d4
2 changed files with 7 additions and 6 deletions

View File

@ -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;

View File

@ -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);
}