3 #ifndef INCLUDE_NN_NLIB_CSTRING_H_ 4 #define INCLUDE_NN_NLIB_CSTRING_H_ 21 return nlib_strcplen(count, NULL, NULL, str);
40 return strcmp(s1, s2);
43 return wcscmp(s1, s2);
46 for (; *s1 == *s2; ++s1, ++s2) {
49 return *s1 < *s2 ? -1 : 1;
52 for (; *s1 == *s2; ++s1, ++s2) {
55 return *s1 < *s2 ? -1 : 1;
61 return strncmp(s1, s2, n);
66 return wcsncmp(s1, s2, n);
71 for (; n > 0; ++s1, ++s2, --n) {
73 return *s1 < *s2 ? -1 : 1;
83 for (; n > 0; ++s1, ++s2, --n) {
85 return *s1 < *s2 ? -1 : 1;
114 template<
class T,
size_t N>
117 return StrCpy(&dest[0], N, src);
145 template<
class T,
size_t N>
149 return StrNcpy(&dest[0], N, src, n);
152 template<
class T,
size_t N>
155 return StrCat(&dest[0], N, src);
158 template<
class T,
size_t N>
162 return StrNcat(&dest[0], N, src, n);
169 _Printf_format_string_
const char* fmt,
175 _Printf_format_string_
const char* fmt,
176 va_list args) NLIB_NOEXCEPT {
179 if (e != 0) errno = e;
180 return (e == 0) ?
static_cast<int>(count) : -1;
186 _Printf_format_string_
const char* fmt,
187 va_list args) NLIB_NOEXCEPT {
194 _Printf_format_string_
const char* fmt,
198 int rval =
VsnPrintf(buf, size, fmt, args);
206 _Printf_format_string_
const char* fmt,
219 _Printf_format_string_
const char* fmt,
220 va_list args) NLIB_NOEXCEPT {
224 inline int SnPrintfFallback(
227 _Printf_format_string_
const char* fmt,
239 _Printf_format_string_
const char* fmt,
251 _Printf_format_string_
const wchar_t* fmt,
257 _Printf_format_string_
const wchar_t* fmt,
258 va_list args) NLIB_NOEXCEPT {
261 if (e != 0) errno = e;
262 return (e == 0) ?
static_cast<int>(count) : -1;
268 _Printf_format_string_
const wchar_t* fmt,
269 va_list args) NLIB_NOEXCEPT {
276 _Printf_format_string_
const wchar_t* fmt,
280 int rval =
VsnPrintf(buf, size, fmt, args);
288 _Printf_format_string_
const wchar_t* fmt,
300 _Printf_format_string_
const wchar_t* fmt,
301 va_list args) NLIB_NOEXCEPT {
305 inline int SnPrintfFallback(
308 _Printf_format_string_
const wchar_t* fmt,
320 _Printf_format_string_
const wchar_t* fmt,
331 #endif // INCLUDE_NN_NLIB_CSTRING_H_ int VsnPrintf(wchar_t(&buf)[N], const wchar_t *fmt, va_list args) noexcept
Internally runs VsnPrintf(buf, N, fmt, args).
errno_t StrCpy(T(&dest)[N], const T *src) noexcept
Makes a call to StrCpy(&dest[0], N, src).
int SnPrintf(wchar_t(&buf)[N], const wchar_t *fmt,...) noexcept
Internally runs the VsnPrintf function.
int VsnPrintfFallback(char *buf, size_t size, const char *fmt, va_list args) noexcept
The fallback for VsnPrintf. Also implemented in a wide-character version.
int StrCmp(const nlib_utf32_t *s1, const nlib_utf32_t *s2) noexcept
Compares UTF-32 strings in the same way as the strcmp function.
int StrNcmp(const nlib_utf32_t *s1, const nlib_utf32_t *s2, size_t n) noexcept
Compares UTF-32 strings in the same way as the strncmp function.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
A file that contains the configuration information for each development environment.
errno_t CodePointCount(const wchar_t *str, size_t *count) noexcept
Wraps the nlib_wcscplen function.
errno_t StrNcat(T(&dest)[N], const T *src, size_t n) noexcept
Makes an internal call to StrNcat(&dest[0], N, src, n).
size_t StrLen(const wchar_t *str) noexcept
Wraps the nlib_wcslen function.
errno_t StrNcpy(T(&dest)[N], const T *src, size_t n) noexcept
Makes an internal call to StrNcpy(&dest[0], N, src, n).
errno_t StrCat(T(&dest)[N], const T *src) noexcept
Makes a call to StrCat(&dest[0], N, src).