10 #ifndef INCLUDED_RTL_STRINGUTILS_HXX 11 #define INCLUDED_RTL_STRINGUTILS_HXX 24 #ifdef RTL_STRING_UNITTEST 25 #define rtl rtlunittest 31 #ifdef RTL_STRING_UNITTEST 35 #if defined LIBO_INTERNAL_ONLY 69 constexpr OUStringLiteral1_(
sal_Unicode theC): c(theC) {}
72 using OUStringLiteral1 = OUStringLiteral1_
const;
77 namespace libreoffice_internal
104 template<
typename T1,
typename T2 =
void >
107 static const bool ok =
false;
109 template<
typename T >
113 static const bool ok =
true;
115 template<
typename T >
119 static const bool ok =
true;
122 template<
typename T1,
typename T2 >
126 template<
typename T,
int N >
131 #ifdef RTL_STRING_UNITTEST 133 template<
typename T >
138 template<
typename T >
139 struct NonConstCharArrayDetector< const char[], T >
145 template<
typename T1,
typename T2 =
void >
148 static const bool ok =
false;
150 template< std::
size_t N,
typename T >
154 static const std::size_t length = N - 1;
155 static const bool ok =
true;
156 #if defined LIBO_INTERNAL_ONLY 159 static bool isValid(
char const (& literal)[N]) {
160 for (std::size_t i = 0; i != N - 1; ++i) {
161 if (literal[i] ==
'\0') {
165 return literal[N - 1] ==
'\0';
167 #if defined LIBO_INTERNAL_ONLY 170 static char const *
toPointer(
char const (& literal)[N]) {
return literal; }
173 #if defined(__COVERITY__) 176 template<
typename T >
177 struct ConstCharArrayDetector< const char[ 1 ], T >
180 static const std::size_t length = 0;
181 static const bool ok =
true;
182 #if defined LIBO_INTERNAL_ONLY 185 static bool isValid(
char const (& literal)[1]) {
186 return literal[0] ==
'\0';
188 #if defined LIBO_INTERNAL_ONLY 191 static char const * toPointer(
char const (& literal)[1]) {
return literal; }
195 #if defined LIBO_INTERNAL_ONLY && defined __cpp_char8_t 196 template<std::
size_t N,
typename T>
197 struct ConstCharArrayDetector<char8_t const [N], T> {
199 static constexpr
bool const ok =
true;
200 static constexpr std::size_t
const length = N - 1;
201 static constexpr
bool isValid(char8_t
const (& literal)[N]) {
202 for (std::size_t i = 0; i != N - 1; ++i) {
203 if (literal[i] == u8
'\0') {
207 return literal[N - 1] == u8
'\0';
209 static constexpr
char const * toPointer(char8_t
const (& literal)[N])
210 {
return reinterpret_cast<char const *>(literal); }
214 #if defined LIBO_INTERNAL_ONLY 215 template<std::
size_t N,
typename T>
216 struct ConstCharArrayDetector<
sal_Unicode const [N], T> {
218 static constexpr
bool const ok =
true;
219 static constexpr std::size_t
const length = N - 1;
224 template<
typename T>
struct ConstCharArrayDetector<
229 static constexpr
bool const ok =
true;
230 static constexpr std::size_t
const length = 1;
232 OUStringLiteral1_
const & literal)
233 {
return &literal.c; }
238 template<
typename T >
247 #if defined LIBO_INTERNAL_ONLY 248 template<std::
size_t N>
250 template<>
struct ExceptConstCharArrayDetector<
260 template<
typename T >
273 #if defined LIBO_INTERNAL_ONLY 275 template<std::
size_t N>
struct ExceptCharArrayDetector<
sal_Unicode const[N]> {};
276 template<>
struct ExceptCharArrayDetector<OUStringLiteral1_> {};
279 template<
typename T1,
typename T2 =
void >
282 static const bool ok =
false;
284 template<
typename T >
288 static const bool ok =
true;
290 template<
typename T >
294 static const bool ok =
true;
298 template<
typename T,
bool >
303 template<
typename T >
314 #endif // INCLUDED_RTL_STRINGUTILS_HXX T Type
Definition: stringutils.hxx:153
Dummy Type
Definition: stringutils.hxx:241
Definition: stringutils.hxx:123
static const bool ok
Definition: stringutils.hxx:107
static const bool ok
Definition: stringutils.hxx:282
Definition: bootstrap.hxx:29
T Type
Definition: stringutils.hxx:306
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:578
static const bool ok
Definition: stringutils.hxx:148
Definition: stringutils.hxx:146
sal_uInt16 sal_Unicode
Definition: types.h:141
Definition: stringutils.hxx:239
static bool isValid(char const (&literal)[N])
Definition: stringutils.hxx:159
Definition: stringutils.hxx:299
T Type
Definition: stringutils.hxx:293
Definition: stringutils.hxx:280
Definition: stringutils.hxx:261
T Type
Definition: stringutils.hxx:118
Definition: stringutils.hxx:105
T Type
Definition: stringutils.hxx:112
Dummy Type
Definition: stringutils.hxx:263
T Type
Definition: stringutils.hxx:287
static char const * toPointer(char const (&literal)[N])
Definition: stringutils.hxx:170
T Type
Definition: stringutils.hxx:129
Definition: stringutils.hxx:103