nlib
Cstring.h File Reference

Wraps functions like strlen and strcpy so they can be safely used. More...

#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include "nn/nlib/Config.h"

Go to the source code of this file.

Namespaces

 nn::nlib
 Implements common features and features that are highly platform-dependent. Also refer to nlib Platform APIs. nlib_ns is an alias.
 

Functions

size_t nn::nlib::StrLen (const char *str) noexcept
 Wraps the nlib_strlen function.
 
size_t nn::nlib::StrLen (const nlib_utf16_t *str) noexcept
 Wraps the nlib_utf16len function.
 
size_t nn::nlib::StrLen (const nlib_utf32_t *str) noexcept
 Wraps the nlib_utf32len function.
 
size_t nn::nlib::StrLen (const wchar_t *str) noexcept
 Wraps the nlib_wcslen function.
 
errno_t nn::nlib::CodePointCount (const char *str, size_t *count) noexcept
 Wraps the nlib_strcplen function.
 
errno_t nn::nlib::CodePointCount (const nlib_utf16_t *str, size_t *count) noexcept
 Wraps the nlib_utf16cplen function.
 
errno_t nn::nlib::CodePointCount (const nlib_utf32_t *str, size_t *count) noexcept
 Wraps the nlib_utf32cplen function.
 
errno_t nn::nlib::CodePointCount (const wchar_t *str, size_t *count) noexcept
 Wraps the nlib_wcscplen function.
 
int nn::nlib::StrCmp (const char *s1, const char *s2) noexcept
 Wraps the strcmp function.
 
int nn::nlib::StrCmp (const wchar_t *s1, const wchar_t *s2) noexcept
 Wraps the wcscmp function.
 
int nn::nlib::StrCmp (const nlib_utf16_t *s1, const nlib_utf16_t *s2) noexcept
 Compares UTF-16 strings in the same way as the strcmp function.
 
int nn::nlib::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 nn::nlib::StrNcmp (const char *s1, const char *s2, size_t n) noexcept
 Wraps the strncmp function.
 
int nn::nlib::StrNcmp (const wchar_t *s1, const wchar_t *s2, size_t n) noexcept
 Wraps the wcsncmp function.
 
int nn::nlib::StrNcmp (const nlib_utf16_t *s1, const nlib_utf16_t *s2, size_t n) noexcept
 Compares UTF-16 strings in the same way as the strncmp function.
 
int nn::nlib::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.
 
errno_t nn::nlib::StrCpy (char *dest, size_t destSize, const char *src) noexcept
 Wraps the nlib_strcpy function.
 
errno_t nn::nlib::StrCpy (nlib_utf16_t *dest, size_t destSize, const nlib_utf16_t *src) noexcept
 Wraps the nlib_utf16cpy function.
 
errno_t nn::nlib::StrCpy (nlib_utf32_t *dest, size_t destSize, const nlib_utf32_t *src) noexcept
 Wraps the nlib_utf32cpy function.
 
errno_t nn::nlib::StrCpy (wchar_t *dest, size_t destSize, const wchar_t *src) noexcept
 Wraps the nlib_wcscpy function.
 
template<class T , size_t N>
errno_t nn::nlib::StrCpy (T(&dest)[N], const T *src) noexcept
 Makes a call to StrCpy(&dest[0], N, src). More...
 
errno_t nn::nlib::StrNcpy (char *dest, size_t destSize, const char *src, size_t maxNumCopyWithoutNull) noexcept
 Wraps the nlib_strncpy function.
 
errno_t nn::nlib::StrNcpy (nlib_utf16_t *dest, size_t destSize, const nlib_utf16_t *src, size_t maxNumCopyWithoutNull) noexcept
 Wraps the nlib_utf16ncpy function.
 
errno_t nn::nlib::StrNcpy (nlib_utf32_t *dest, size_t destSize, const nlib_utf32_t *src, size_t maxNumCopyWithoutNull) noexcept
 Wraps the nlib_utf32ncpy function.
 
errno_t nn::nlib::StrNcpy (wchar_t *dest, size_t destSize, const wchar_t *src, size_t maxNumCopyWithoutNull) noexcept
 Wraps the nlib_wcsncpy function.
 
template<class T , size_t N>
errno_t nn::nlib::StrNcpy (T(&dest)[N], const T *src, size_t maxNumCopyWithoutNull) noexcept
 Makes a call to StrNcpy(&dest[0], N, src, maxNumCopyWithoutNull). More...
 
errno_t nn::nlib::MemCpy (void *dest, size_t destSize, const void *src, size_t srcSize) noexcept
 Wraps the nlib_memcpy function.
 
errno_t nn::nlib::MemMove (void *dest, size_t destSize, const void *src, size_t srcSize) noexcept
 Wraps the nlib_memmove function.
 
errno_t nn::nlib::StrCat (char *dest, size_t destSize, const char *src) noexcept
 Wraps the nlib_strcat function.
 
errno_t nn::nlib::StrCat (wchar_t *dest, size_t destSize, const wchar_t *src) noexcept
 Wraps the nlib_wcscat function.
 
template<class T , size_t N>
errno_t nn::nlib::StrCat (T(&dest)[N], const T *src) noexcept
 Makes a call to StrCat(&dest[0], N, src). More...
 
errno_t nn::nlib::StrNcat (char *dest, size_t destSize, const char *src, size_t maxNumCopyWithoutNull) noexcept
 Wraps the nlib_strncat function.
 
errno_t nn::nlib::StrNcat (wchar_t *dest, size_t destSize, const wchar_t *src, size_t maxNumCopyWithoutNull) noexcept
 Wraps the nlib_wcsncat function.
 
template<class T , size_t N>
errno_t nn::nlib::StrNcat (T(&dest)[N], const T *src, size_t maxNumCopyWithoutNull) noexcept
 Makes a call to StrNcat(&dest[0], N, src, maxNumCopyWithoutNull). More...
 
int nn::nlib::IsAlnum (int c) noexcept
 Returns std::isalnum(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsAlpha (int c) noexcept
 Returns std::isalpha(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsCntrl (int c) noexcept
 Returns std::iscntrl(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsDigit (int c) noexcept
 Returns std::isdigit(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsGraph (int c) noexcept
 Returns std::isgraph(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsLower (int c) noexcept
 Returns std::islower(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsPrint (int c) noexcept
 Returns std::isprint(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsPunct (int c) noexcept
 Returns std::ispunct(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsSpace (int c) noexcept
 Returns std::isspace(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsUpper (int c) noexcept
 Returns std::isupper(static_cast<unsigned char>(c)). More...
 
int nn::nlib::IsXdigit (int c) noexcept
 Returns std::isxdigit(static_cast<unsigned char>(c)). More...
 
int nn::nlib::ToUpper (int c) noexcept
 Returns std::toupper(static_cast<unsigned char>(c)). More...
 
int nn::nlib::ToLower (int c) noexcept
 Returns std::tolower(static_cast<unsigned char>(c)). More...
 
int nn::nlib::VsnPrintfFallback (char *buf, size_t size, const char *fmt, va_list args) noexcept
 The fallback for VsnPrintf. Also implemented in a wide-character version. More...
 
int nn::nlib::VsnPrintf (char *buf, size_t size, const char *fmt, va_list args) noexcept
 Executes vsnprintf. More...
 
template<size_t N>
int nn::nlib::VsnPrintf (char(&buf)[N], const char *fmt, va_list args) noexcept
 Internally runs VsnPrintf(buf, N, fmt, args). More...
 
int nn::nlib::SnPrintf (char *buf, size_t size, const char *fmt,...) noexcept
 Makes a call to the VsnPrintf function, but otherwise operates the same way as snprintf. More...
 
template<size_t N>
int nn::nlib::SnPrintf (char(&buf)[N], const char *fmt,...) noexcept
 Internally runs the VsnPrintf function. More...
 
int nn::nlib::VsnPrintf (wchar_t *buf, size_t size, const wchar_t *fmt, va_list args) noexcept
 Executes vsnprintf. More...
 
template<size_t N>
int nn::nlib::VsnPrintf (wchar_t(&buf)[N], const wchar_t *fmt, va_list args) noexcept
 Internally runs VsnPrintf(buf, N, fmt, args). More...
 
int nn::nlib::SnPrintf (wchar_t *buf, size_t size, const wchar_t *fmt,...) noexcept
 Makes a call to the VsnPrintf function, but otherwise operates the same way as snwprintf. More...
 
template<size_t N>
int nn::nlib::SnPrintf (wchar_t(&buf)[N], const wchar_t *fmt,...) noexcept
 Internally runs the VsnPrintf function. More...
 

Detailed Description

Wraps functions like strlen and strcpy so they can be safely used.

Definition in file Cstring.h.