1#ifndef SDL3PP_STDINC_H_
2#define SDL3PP_STDINC_H_
5#include <SDL3/SDL_stdinc.h>
6#include "SDL3pp_callbackWrapper.h"
7#include "SDL3pp_error.h"
8#include "SDL3pp_optionalRef.h"
9#include "SDL3pp_ownPtr.h"
10#include "SDL3pp_spanRef.h"
11#include "SDL3pp_strings.h"
73 constexpr explicit operator bool()
const {
return !!
value; }
109 constexpr explicit operator bool()
const {
return !!
value; }
136#define SDL_NOLONGLONG 1
152#define SDL_SIZE_MAX SIZE_MAX
185#define SDL_COMPILE_TIME_ASSERT(name, x) FailToCompileIf_x_IsFalse(x)
197template<
class T, std::
size_t N>
200 return SDL_arraysize(array);
219#define SDL_STRINGIFY_ARG(arg) #arg
238 return SDL_FOURCC(a, b, c, d);
254#define SDL_SINT64_C(c) c##LL
267#define SDL_UINT64_C(c) c##ULL
418 constexpr Time() =
default;
435 constexpr Time(std::chrono::nanoseconds time) noexcept
441 constexpr explicit operator bool()
const
443 return m_time != std::chrono::nanoseconds{};
447 constexpr operator std::chrono::nanoseconds()
const {
return m_time; }
462 return Time{std::chrono::nanoseconds{time}};
531 return std::chrono::duration_cast<std::chrono::nanoseconds>(
572concept Interface =
requires(I* iface) { (iface)->version =
sizeof(I); };
615 SDL_INIT_INTERFACE(iface);
643inline void*
malloc(
size_t size) {
return SDL_malloc(size); }
668inline void*
calloc(
size_t nmemb,
size_t size)
670 return SDL_calloc(nmemb, size);
709inline void*
realloc(
void* mem,
size_t size) {
return SDL_realloc(mem, size); }
729inline void free(
void* mem) { SDL_free(mem); }
832 SDL_GetOriginalMemoryFunctions(
919 return SDL_aligned_alloc(alignment, size);
985 : m_resource(resource)
1023 : m_resource(SDL_CreateEnvironment(populated))
1033 std::swap(m_resource, other.m_resource);
1048 auto r = m_resource;
1049 m_resource =
nullptr;
1057 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
1278 return SDL_GetEnvironmentVariable(env, name);
1340 CheckError(SDL_SetEnvironmentVariable(env, name, value, overwrite));
1348 m_resource, std::move(name), std::move(value), overwrite);
1371 CheckError(SDL_UnsetEnvironmentVariable(env, name));
1393 SDL_DestroyEnvironment(env);
1432 return SDL_getenv_unsafe(name);
1453 return SDL_setenv_unsafe(name, value, overwrite);
1471 return SDL_unsetenv_unsafe(name);
1539 SDL_qsort(base, nmemb, size, compare);
1597 return SDL_bsearch(key, base, nmemb, size, compare);
1634using CompareCB = std::function<int(
const void* a,
const void* b)>;
1694 SDL_qsort_r(base, nmemb, size, compare, userdata);
1754 [](
void* userdata,
const void* a,
const void* b) {
1755 auto& cb = *
static_cast<CompareCB*
>(userdata);
1825 return SDL_bsearch_r(key, base, nmemb, size, compare, userdata);
1895 [](
void* userdata,
const void* a,
const void* b) {
1896 auto& cb = *
static_cast<CompareCB*
>(userdata);
1912inline int abs(
int x) {
return SDL_abs(x); }
1933inline double abs(
double x) {
return SDL_fabs(x); }
1954inline float abs(
float x) {
return SDL_fabsf(x); }
1972template<
class T,
class U>
1975 return SDL_min(x, y);
1994template<
class T,
class U>
1997 return SDL_max(x, y);
2022template<
class T,
class U,
class V>
2025 return SDL_clamp(x, a, b);
2041inline int isalpha(
int x) {
return SDL_isalpha(x); }
2056inline int isalnum(
int x) {
return SDL_isalnum(x); }
2071inline int isblank(
int x) {
return SDL_isblank(x); }
2086inline int iscntrl(
int x) {
return SDL_iscntrl(x); }
2101inline int isdigit(
int x) {
return SDL_isdigit(x); }
2134inline int ispunct(
int x) {
return SDL_ispunct(x); }
2156inline int isspace(
int x) {
return SDL_isspace(x); }
2171inline int isupper(
int x) {
return SDL_isupper(x); }
2186inline int islower(
int x) {
return SDL_islower(x); }
2205inline int isprint(
int x) {
return SDL_isprint(x); }
2226inline int isgraph(
int x) {
return SDL_isgraph(x); }
2244inline int toupper(
int x) {
return SDL_toupper(x); }
2262inline int tolower(
int x) {
return SDL_tolower(x); }
2285 return SDL_crc16(crc, data, len);
2309 return SDL_crc32(crc, data, len);
2338 return SDL_murmur3_32(data, len, seed);
2359inline void*
memcpy(
void* dst,
const void* src,
size_t len)
2361#ifdef SDL_SLOW_MEMCPY
2362 return SDL_memcpy(dst, src, len);
2364 return ::memcpy(dst, src, len);
2392template<
typename T,
typename U>
2395 SDL_copyp(dst, src);
2416inline void*
memmove(
void* dst,
const void* src,
size_t len)
2418#ifdef SDL_SLOW_MEMMOVE
2419 return SDL_memmove(dst, src, len);
2421 return ::memmove(dst, src, len);
2443inline void*
memset(
void* dst,
int c,
size_t len)
2445#ifdef SDL_SLOW_MEMSET
2446 return SDL_memset(dst, c, len);
2448 return ::memset(dst, c, len);
2472 return SDL_memset4(dst, val, dwords);
2538template<
class T, std::
size_t N>
2558inline int memcmp(
const void* s1,
const void* s2,
size_t len)
2560 return SDL_memcmp(s1, s2, len);
2587inline size_t wcslen(
const wchar_t* wstr) {
return SDL_wcslen(wstr); }
2617inline size_t wcsnlen(
const wchar_t* wstr,
size_t maxlen)
2619 return SDL_wcsnlen(wstr, maxlen);
2647inline size_t wcslcpy(
wchar_t* dst,
const wchar_t* src,
size_t maxlen)
2649 return SDL_wcslcpy(dst, src, maxlen);
2678inline size_t wcslcat(
wchar_t* dst,
const wchar_t* src,
size_t maxlen)
2680 return SDL_wcslcat(dst, src, maxlen);
2699inline wchar_t*
wcsdup(
const wchar_t* wstr) {
return SDL_wcsdup(wstr); }
2719inline wchar_t*
wcsstr(
const wchar_t* haystack,
const wchar_t* needle)
2721 return SDL_wcsstr(haystack, needle);
2746 const wchar_t* needle,
2749 return SDL_wcsnstr(haystack, needle, maxlen);
2768inline int wcscmp(
const wchar_t* str1,
const wchar_t* str2)
2770 return SDL_wcscmp(str1, str2);
2800inline int wcsncmp(
const wchar_t* str1,
const wchar_t* str2,
size_t maxlen)
2802 return SDL_wcsncmp(str1, str2, maxlen);
2834 return SDL_wcscasecmp(str1, str2);
2876inline int wcsncasecmp(
const wchar_t* str1,
const wchar_t* str2,
size_t maxlen)
2878 return SDL_wcsncasecmp(str1, str2, maxlen);
2905inline long wcstol(
const wchar_t* str,
wchar_t** endp,
int base)
2907 return SDL_wcstol(str, endp, base);
2953 return SDL_strnlen(str, maxlen);
2983 return SDL_strlcpy(dst, src, maxlen);
3014 return SDL_utf8strlcpy(dst, src, dst_bytes);
3045 return SDL_strlcat(dst, src, maxlen);
3091 return SDL_strndup(str, maxlen);
3113inline char*
strrev(
char* str) {
return SDL_strrev(str); }
3134inline char*
strupr(
char* str) {
return SDL_strupr(str); }
3155inline char*
strlwr(
char* str) {
return SDL_strlwr(str); }
3216 return SDL_strstr(haystack, needle);
3242 return SDL_strnstr(haystack, needle, maxlen);
3273 return SDL_strcasestr(haystack, needle);
3304 return SDL_strtok_r(str, delim, saveptr);
3365 return SDL_utf8strnlen(str, bytes);
3393inline char*
itoa(
int value,
char* str,
int radix)
3395 return SDL_itoa(value, str, radix);
3423inline char*
uitoa(
unsigned int value,
char* str,
int radix)
3425 return SDL_uitoa(value, str, radix);
3453inline char*
ltoa(
long value,
char* str,
int radix)
3455 return SDL_ltoa(value, str, radix);
3483inline char*
ultoa(
unsigned long value,
char* str,
int radix)
3485 return SDL_ultoa(value, str, radix);
3488#ifndef SDL_NOLONGLONG
3515inline char* lltoa(
long long value,
char* str,
int radix)
3517 return SDL_lltoa(value, str, radix);
3545inline char* ulltoa(
unsigned long long value,
char* str,
int radix)
3547 return SDL_ulltoa(value, str, radix);
3629 return SDL_strtol(str, endp, base);
3664 return SDL_strtoul(str, endp, base);
3667#ifndef SDL_NOLONGLONG
3699inline long long strtoll(StringParam str,
char** endp,
int base)
3701 return SDL_strtoll(str, endp, base);
3734inline unsigned long long strtoull(StringParam str,
char** endp,
int base)
3736 return SDL_strtoull(str, endp, base);
3770 return SDL_strtod(str, endp);
3792 return SDL_strcmp(str1, str2);
3824 return SDL_strncmp(str1, str2, maxlen);
3854 return SDL_strcasecmp(str1, str2);
3895 return SDL_strncasecmp(str1, str2, maxlen);
3916 return SDL_strpbrk(str, breakset);
3977 return SDL_StepUTF8(pstr, pslen);
4009 return SDL_StepBackUTF8(start, pstr);
4041 return SDL_UCS4ToUTF8(codepoint, dst);
4060 SDL_SCANF_FORMAT_STRING
const char* fmt,
4066 rc = SDL_vsscanf(text, fmt, ap);
4088 SDL_SCANF_FORMAT_STRING
const char* fmt,
4091 return SDL_vsscanf(text, fmt, ap);
4126 SDL_PRINTF_FORMAT_STRING
const char* fmt,
4133 result = SDL_vsnprintf(text, maxlen, fmt, ap);
4172 SDL_PRINTF_FORMAT_STRING
const wchar_t* fmt,
4179 result = SDL_vswprintf(text, maxlen, fmt, ap);
4205 SDL_PRINTF_FORMAT_STRING
const char* fmt,
4208 return SDL_vsnprintf(text, maxlen, fmt, ap);
4232 SDL_PRINTF_FORMAT_STRING
const wchar_t* fmt,
4235 return SDL_vswprintf(text, maxlen, fmt, ap);
4264inline int asprintf(
char** strp, SDL_PRINTF_FORMAT_STRING
const char* fmt, ...)
4270 result = SDL_vasprintf(strp, fmt, ap);
4294 SDL_PRINTF_FORMAT_STRING
const char* fmt,
4297 return SDL_vasprintf(strp, fmt, ap);
4371inline float randf() {
return SDL_randf(); }
4425 constexpr operator Uint64() {
return m_state; }
4482 float randf() {
return SDL_randf_r(&m_state); }
4639inline double acos(
double x) {
return SDL_acos(x); }
4668inline float acos(
float x) {
return SDL_acosf(x); }
4697inline double asin(
double x) {
return SDL_asin(x); }
4726inline float asin(
float x) {
return SDL_asinf(x); }
4757inline double atan(
double x) {
return SDL_atan(x); }
4788inline float atan(
float x) {
return SDL_atanf(x); }
4822inline double atan2(
double y,
double x) {
return SDL_atan2(y, x); }
4857inline float atan2(
float y,
float x) {
return SDL_atan2f(y, x); }
4885inline double ceil(
double x) {
return SDL_ceil(x); }
4913inline float ceil(
float x) {
return SDL_ceilf(x); }
4938inline double copysign(
double x,
double y) {
return SDL_copysign(x, y); }
4963inline float copysign(
float x,
float y) {
return SDL_copysignf(x, y); }
4990inline double cos(
double x) {
return SDL_cos(x); }
5017inline float cos(
float x) {
return SDL_cosf(x); }
5048inline double exp(
double x) {
return SDL_exp(x); }
5079inline float exp(
float x) {
return SDL_expf(x); }
5107inline double floor(
double x) {
return SDL_floor(x); }
5135inline float floor(
float x) {
return SDL_floorf(x); }
5164inline double trunc(
double x) {
return SDL_trunc(x); }
5193inline float trunc(
float x) {
return SDL_truncf(x); }
5223inline double fmod(
double x,
double y) {
return SDL_fmod(x, y); }
5253inline float fmod(
float x,
float y) {
return SDL_fmodf(x, y); }
5267inline int isinf(
double x) {
return SDL_isinf(x); }
5281inline int isinf(
float x) {
return SDL_isinff(x); }
5295inline int isnan(
double x) {
return SDL_isnan(x); }
5309inline int isnan(
float x) {
return SDL_isnanf(x); }
5338inline double log(
double x) {
return SDL_log(x); }
5366inline float log(
float x) {
return SDL_logf(x); }
5395inline double log10(
double x) {
return SDL_log10(x); }
5424inline float log10(
float x) {
return SDL_log10f(x); }
5444inline double modf(
double x,
double* y) {
return SDL_modf(x, y); }
5464inline float modf(
float x,
float* y) {
return SDL_modff(x, y); }
5494inline double pow(
double x,
double y) {
return SDL_pow(x, y); }
5524inline float pow(
float x,
float y) {
return SDL_powf(x, y); }
5553inline double round(
double x) {
return SDL_round(x); }
5582inline float round(
float x) {
return SDL_roundf(x); }
5611inline long lround(
double x) {
return SDL_lround(x); }
5640inline long lround(
float x) {
return SDL_lroundf(x); }
5665inline double scalbn(
double x,
int n) {
return SDL_scalbn(x, n); }
5690inline float scalbn(
float x,
int n) {
return SDL_scalbnf(x, n); }
5717inline double sin(
double x) {
return SDL_sin(x); }
5744inline float sin(
float x) {
return SDL_sinf(x); }
5769inline double sqrt(
double x) {
return SDL_sqrt(x); }
5794inline float sqrt(
float x) {
return SDL_sqrtf(x); }
5823inline double tan(
double x) {
return SDL_tan(x); }
5852inline float tan(
float x) {
return SDL_tanf(x); }
5869 constexpr IConv(std::nullptr_t =
nullptr) noexcept
5870 : m_resource(
IConvRaw(SDL_ICONV_ERROR))
5882 : m_resource(resource)
5891 :
IConv(other.release())
5914 : m_resource(SDL_iconv_open(tocode, fromcode))
5924 std::swap(m_resource, other.m_resource);
5939 auto r = m_resource;
5940 m_resource =
nullptr;
5948 constexpr explicit operator bool() const noexcept
5950 return m_resource !=
IConvRaw(SDL_ICONV_ERROR);
5954 constexpr operator IConvParam() const noexcept {
return {m_resource}; }
6003 size_t iconv(
const char** inbuf,
6004 size_t* inbytesleft,
6006 size_t* outbytesleft);
6022 :
IConv(resource.value)
6040 :
IConv(other.get())
6064 return IConv(std::move(tocode), std::move(fromcode));
6120 size_t* inbytesleft,
6122 size_t* outbytesleft)
6124 return CheckError(SDL_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft));
6128 size_t* inbytesleft,
6130 size_t* outbytesleft)
6132 return SDL::iconv(m_resource, inbuf, inbytesleft, outbuf, outbytesleft);
6173 SDL_iconv_string(tocode, fromcode, inbuf.
data(), inbuf.
size_bytes())};
6207 auto data = SDL_iconv_string(
"UCS-2",
"UTF-8", S.data(), S.size());
6225 auto data = SDL_iconv_string(
"UCS-4",
"UTF-8", S.data(), S.size());
6265 return SDL_size_mul_check_overflow(a, b, ret);
6287 return SDL_size_add_check_overflow(a, b, ret);
6309inline void PtrDeleter::operator()(
void* ptr)
const { SDL_free(ptr); }
A thread-safe set of environment variables.
Definition: SDL3pp_stdinc.h:967
constexpr Environment(const EnvironmentRaw resource) noexcept
Constructs from EnvironmentParam.
Definition: SDL3pp_stdinc.h:984
constexpr EnvironmentRaw get() const noexcept
Retrieves underlying EnvironmentRaw.
Definition: SDL3pp_stdinc.h:1043
constexpr EnvironmentRaw release() noexcept
Retrieves underlying EnvironmentRaw and clear this.
Definition: SDL3pp_stdinc.h:1046
constexpr Environment & operator=(const Environment &other) noexcept=default
Assignment operator.
constexpr Environment(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_stdinc.h:972
Uint64 GetVariableCount()
Get the Variables count.
Definition: SDL3pp_stdinc.h:1121
constexpr Environment & operator=(Environment &&other) noexcept
Assignment operator.
Definition: SDL3pp_stdinc.h:1031
constexpr auto operator<=>(const Environment &other) const noexcept=default
Comparison.
Environment(bool populated)
Create a set of environment variables.
Definition: SDL3pp_stdinc.h:1022
constexpr Environment(const Environment &other)=delete
Copy constructor.
~Environment()
Destructor.
Definition: SDL3pp_stdinc.h:1028
constexpr Environment(Environment &&other) noexcept
Move constructor.
Definition: SDL3pp_stdinc.h:993
An opaque handle representing string encoding conversion state.
Definition: SDL3pp_stdinc.h:5864
constexpr IConv(const IConvRaw resource) noexcept
Constructs from IConvParam.
Definition: SDL3pp_stdinc.h:5881
constexpr IConvRaw get() const noexcept
Retrieves underlying IConvRaw.
Definition: SDL3pp_stdinc.h:5934
constexpr IConv & operator=(IConv &&other) noexcept
Assignment operator.
Definition: SDL3pp_stdinc.h:5922
~IConv()
Destructor.
Definition: SDL3pp_stdinc.h:5919
constexpr IConv(const IConv &other)=delete
Copy constructor.
constexpr IConv(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_stdinc.h:5869
constexpr IConvRaw release() noexcept
Retrieves underlying IConvRaw and clear this.
Definition: SDL3pp_stdinc.h:5937
constexpr auto operator<=>(const IConv &other) const noexcept=default
Comparison.
IConv(StringParam tocode, StringParam fromcode)
This function allocates a context for the specified character set conversion.
Definition: SDL3pp_stdinc.h:5913
constexpr IConv & operator=(const IConv &other) noexcept=default
Assignment operator.
constexpr IConv(IConv &&other) noexcept
Move constructor.
Definition: SDL3pp_stdinc.h:5890
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
A independent pseudo random state.
Definition: SDL3pp_stdinc.h:4407
constexpr Random(Uint64 state)
Init state with the given value.
Definition: SDL3pp_stdinc.h:4419
float randf()
Generate a uniform pseudo-random floating point number less than 1.0.
Definition: SDL3pp_stdinc.h:4482
Uint32 rand_bits()
Generate 32 pseudo-random bits.
Definition: SDL3pp_stdinc.h:4505
Sint32 rand(Sint32 n)
Generate a pseudo-random number less than n for positive n.
Definition: SDL3pp_stdinc.h:4458
Source byte stream.
Definition: SDL3pp_strings.h:239
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition: SDL3pp_strings.h:303
constexpr const char * data() const
Retrieves contained data.
Definition: SDL3pp_strings.h:306
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
SDL times are signed, 64-bit integers representing nanoseconds since the Unix epoch (Jan 1,...
Definition: SDL3pp_stdinc.h:414
constexpr Sint64 ToNS() const
Converts to nanoseconds Sint64.
Definition: SDL3pp_stdinc.h:466
constexpr Time & operator+=(std::chrono::nanoseconds interval)
Increment time.
Definition: SDL3pp_stdinc.h:536
constexpr float ToSeconds() const
Converts a time to seconds (float) since epoch.
Definition: SDL3pp_stdinc.h:526
constexpr Time & operator-=(std::chrono::nanoseconds interval)
Decrement.
Definition: SDL3pp_stdinc.h:543
constexpr Time(std::chrono::nanoseconds time) noexcept
Wraps Time.
Definition: SDL3pp_stdinc.h:435
constexpr Time(TimeRaw time) noexcept
Wraps Time.
Definition: SDL3pp_stdinc.h:425
static constexpr Time FromNS(Sint64 time)
Create from a nanoseconds Sint64.
Definition: SDL3pp_stdinc.h:460
static constexpr Time FromSeconds(float interval)
Converts a time to seconds (float) since epoch.
Definition: SDL3pp_stdinc.h:529
Concept of interface.
Definition: SDL3pp_stdinc.h:572
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
int wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
Compare two wide strings up to a number of wchar_t values.
Definition: SDL3pp_stdinc.h:2800
double log(double x)
Compute the natural logarithm of x.
Definition: SDL3pp_stdinc.h:5338
char * UCS4ToUTF8(Uint32 codepoint, char *dst)
Convert a single Unicode codepoint to UTF-8.
Definition: SDL3pp_stdinc.h:4039
long wcstol(const wchar_t *str, wchar_t **endp, int base)
Parse a long from a wide string.
Definition: SDL3pp_stdinc.h:2905
char * strdup(StringParam str)
Allocate a copy of a string.
Definition: SDL3pp_stdinc.h:3064
void SetMemoryFunctions(malloc_func malloc_func, calloc_func calloc_func, realloc_func realloc_func, free_func free_func)
Replace SDL's memory allocation functions with a custom set.
Definition: SDL3pp_stdinc.h:886
double strtod(StringParam str, char **endp)
Parse a double from a string.
Definition: SDL3pp_stdinc.h:3768
void SetVariable(StringParam name, StringParam value, bool overwrite)
Set the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1343
int(SDLCALL *)(void *userdata, const void *a, const void *b) CompareCallback_r
A callback used with SDL sorting and binary search functions.
Definition: SDL3pp_stdinc.h:1617
constexpr Sint8 MIN_SINT8
Min representable value.
Definition: SDL3pp_stdinc.h:282
char * strcasestr(StringParam haystack, StringParam needle)
Search a UTF-8 string for the first instance of a specific substring, case-insensitively.
Definition: SDL3pp_stdinc.h:3271
void UnsetVariable(StringParam name)
Clear a variable from the environment.
Definition: SDL3pp_stdinc.h:1374
double atan(double x)
Compute the arc tangent of x.
Definition: SDL3pp_stdinc.h:4757
int asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt,...)
This works exactly like asprintf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4264
double ceil(double x)
Compute the ceiling of x.
Definition: SDL3pp_stdinc.h:4885
char * strlwr(char *str)
Convert a string to lowercase.
Definition: SDL3pp_stdinc.h:3155
void * memmove(void *dst, const void *src, size_t len)
Copy memory ranges that might overlap.
Definition: SDL3pp_stdinc.h:2416
int memcmp(const void *s1, const void *s2, size_t len)
Compare two buffers of memory.
Definition: SDL3pp_stdinc.h:2558
constexpr Uint16 MIN_UINT16
Min representable value.
Definition: SDL3pp_stdinc.h:321
constexpr std::size_t arraysize(const T(&array)[N])
The number of elements in a static array.
Definition: SDL3pp_stdinc.h:198
char * strnstr(StringParam haystack, StringParam needle, size_t maxlen)
Search a string, up to n bytes, for the first instance of a specific substring.
Definition: SDL3pp_stdinc.h:3240
OwnArray< Uint16 > iconv_utf8_ucs2(std::string_view S)
Convert a UTF-8 string to UCS-2.
Definition: SDL3pp_stdinc.h:6205
int isnan(double x)
Return whether the value is NaN.
Definition: SDL3pp_stdinc.h:5295
constexpr Uint32 INVALID_UNICODE_CODEPOINT
The Unicode REPLACEMENT CHARACTER codepoint.
Definition: SDL3pp_stdinc.h:3932
double scalbn(double x, int n)
Scale x by an integer power of two.
Definition: SDL3pp_stdinc.h:5665
char * ultoa(unsigned long value, char *str, int radix)
Convert an unsigned long integer into a string.
Definition: SDL3pp_stdinc.h:3483
wchar_t * wcsdup(const wchar_t *wstr)
Allocate a copy of a wide string.
Definition: SDL3pp_stdinc.h:2699
void(SDLCALL *)(void *mem) free_func
A callback used to implement free().
Definition: SDL3pp_stdinc.h:808
int isgraph(int x)
Report if a character is any "printable" except space.
Definition: SDL3pp_stdinc.h:2226
constexpr Sint16 MIN_SINT16
Min representable value.
Definition: SDL3pp_stdinc.h:308
OwnArray< char * > GetVariables()
Get all variables in the environment.
Definition: SDL3pp_stdinc.h:1310
const char * GetEnvironmentVariable(EnvironmentParam env, StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1275
int strncmp(StringParam str1, StringParam str2, size_t maxlen)
Compare two UTF-8 strings up to a number of bytes.
Definition: SDL3pp_stdinc.h:3822
size_t iconv(const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
This function converts text between encodings, reading from and writing to a buffer.
Definition: SDL3pp_stdinc.h:6127
void *(SDLCALL *)(size_t nmemb, size_t size) calloc_func
A callback used to implement calloc().
Definition: SDL3pp_stdinc.h:769
double asin(double x)
Compute the arc sine of x.
Definition: SDL3pp_stdinc.h:4697
Uint16 crc16(Uint16 crc, const void *data, size_t len)
Calculate a CRC-16 value.
Definition: SDL3pp_stdinc.h:2283
char * strrev(char *str)
Reverse a string's contents.
Definition: SDL3pp_stdinc.h:3113
int strncasecmp(StringParam str1, StringParam str2, size_t maxlen)
Compare two UTF-8 strings, case-insensitively, up to a number of bytes.
Definition: SDL3pp_stdinc.h:3893
constexpr T min(T x, U y)
Return the lesser of two values.
Definition: SDL3pp_stdinc.h:1973
SDL_FunctionPointer FunctionPointer
A generic function pointer.
Definition: SDL3pp_stdinc.h:6305
unsigned long strtoul(StringParam str, char **endp, int base)
Parse an unsigned long from a string.
Definition: SDL3pp_stdinc.h:3662
void *(SDLCALL *)(void *mem, size_t size) realloc_func
A callback used to implement realloc().
Definition: SDL3pp_stdinc.h:790
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
int isdigit(int x)
Report if a character is a numeric digit.
Definition: SDL3pp_stdinc.h:2101
std::chrono::duration< float > Seconds
Duration in seconds (float).
Definition: SDL3pp_stdinc.h:380
double exp(double x)
Compute the exponential of x.
Definition: SDL3pp_stdinc.h:5048
char * strstr(StringParam haystack, StringParam needle)
Search a string for the first instance of a specific substring.
Definition: SDL3pp_stdinc.h:3214
constexpr bool size_mul_check_overflow(size_t a, size_t b, size_t *ret)
Multiply two integers, checking for overflow.
Definition: SDL3pp_stdinc.h:6263
constexpr Uint32 MAX_UINT32
Max representable value.
Definition: SDL3pp_stdinc.h:344
IConv iconv_open(StringParam tocode, StringParam fromcode)
This function allocates a context for the specified character set conversion.
Definition: SDL3pp_stdinc.h:6062
int vsnprintf(char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
This works exactly like vsnprintf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4203
char * strchr(StringParam str, int c)
Search a string for the first instance of a specific byte.
Definition: SDL3pp_stdinc.h:3175
double copysign(double x, double y)
Copy the sign of one floating-point value to another.
Definition: SDL3pp_stdinc.h:4938
Environment CreateEnvironment(bool populated)
Create a set of environment variables.
Definition: SDL3pp_stdinc.h:1252
void * malloc(size_t size)
Allocate uninitialized memory.
Definition: SDL3pp_stdinc.h:643
constexpr float FLT_EPSILON
Epsilon constant, used for comparing floating-point numbers.
Definition: SDL3pp_stdinc.h:564
double modf(double x, double *y)
Split x into integer and fractional parts.
Definition: SDL3pp_stdinc.h:5444
void zero(T &x)
Clear an object's memory to zero.
Definition: SDL3pp_stdinc.h:2493
size_t strlcat(char *dst, StringParam src, size_t maxlen)
Concatenate strings.
Definition: SDL3pp_stdinc.h:3043
void zeroa(T(&x)[N])
Clear an array's memory to zero.
Definition: SDL3pp_stdinc.h:2539
char * strndup(StringParam str, size_t maxlen)
Allocate a copy of a string, up to n characters.
Definition: SDL3pp_stdinc.h:3089
constexpr Uint8 MIN_UINT64
Min representable value.
Definition: SDL3pp_stdinc.h:377
size_t iconv(IConvRaw cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
This function converts text between encodings, reading from and writing to a buffer.
Definition: SDL3pp_stdinc.h:6118
std::chrono::milliseconds Milliseconds
Duration in Miliseconds (Uint32).
Definition: SDL3pp_stdinc.h:386
int snprintf(char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt,...)
This works exactly like snprintf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4124
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition: SDL3pp_stdinc.h:371
double round(double x)
Round x to the nearest integer.
Definition: SDL3pp_stdinc.h:5553
int sscanf(StringParam text, SDL_SCANF_FORMAT_STRING const char *fmt,...)
This works exactly like sscanf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4059
size_t strlcpy(char *dst, StringParam src, size_t maxlen)
Copy a string.
Definition: SDL3pp_stdinc.h:2981
void * memset(void *dst, int c, size_t len)
Initialize all bytes of buffer of memory to a specific value.
Definition: SDL3pp_stdinc.h:2443
void UnsetEnvironmentVariable(EnvironmentParam env, StringParam name)
Clear a variable from the environment.
Definition: SDL3pp_stdinc.h:1369
constexpr Uint64 MAX_UINT64
Max representable value.
Definition: SDL3pp_stdinc.h:374
Uint32 rand_bits_r(Uint64 *state)
Generate 32 pseudo-random bits.
Definition: SDL3pp_stdinc.h:4592
int iconv_close(IConvRaw cd)
This function frees a context used for character set conversion.
Definition: SDL3pp_stdinc.h:6080
void GetOriginalMemoryFunctions(malloc_func *malloc_func, calloc_func *calloc_func, realloc_func *realloc_func, free_func *free_func)
Get the original set of SDL memory functions.
Definition: SDL3pp_stdinc.h:827
int strcmp(StringParam str1, StringParam str2)
Compare two null-terminated UTF-8 strings.
Definition: SDL3pp_stdinc.h:3790
float randf_r(Uint64 *state)
Generate a uniform pseudo-random floating point number less than 1.0.
Definition: SDL3pp_stdinc.h:4567
char * uitoa(unsigned int value, char *str, int radix)
Convert an unsigned integer into a string.
Definition: SDL3pp_stdinc.h:3423
double pow(double x, double y)
Raise x to the power y
Definition: SDL3pp_stdinc.h:5494
constexpr T * copyp(T *dst, const U *src)
A macro to copy memory between objects, with basic type checking.
Definition: SDL3pp_stdinc.h:2393
constexpr Sint32 MIN_SINT32
Min representable value.
Definition: SDL3pp_stdinc.h:334
EnvironmentRaw GetEnvironment()
Get the process environment.
Definition: SDL3pp_stdinc.h:1230
int isprint(int x)
Report if a character is "printable".
Definition: SDL3pp_stdinc.h:2205
long lround(double x)
Round x to the nearest integer representable as a long.
Definition: SDL3pp_stdinc.h:5611
std::chrono::nanoseconds Nanoseconds
Duration in Nanoseconds (Uint64).
Definition: SDL3pp_stdinc.h:383
int isxdigit(int x)
Report if a character is a hexadecimal digit.
Definition: SDL3pp_stdinc.h:2116
constexpr T max(T x, U y)
Return the greater of two values.
Definition: SDL3pp_stdinc.h:1995
int atoi(StringParam str)
Parse an int from a string.
Definition: SDL3pp_stdinc.h:3573
OwnArray< char > iconv_string(StringParam tocode, StringParam fromcode, SourceBytes inbuf)
Helper function to convert a string's encoding in one call.
Definition: SDL3pp_stdinc.h:6168
int tolower(int x)
Convert low-ASCII English letters to lowercase.
Definition: SDL3pp_stdinc.h:2262
int isalpha(int x)
Query if a character is alphabetic (a letter).
Definition: SDL3pp_stdinc.h:2041
constexpr size_t ICONV_E2BIG
Output buffer was too small.
Definition: SDL3pp_stdinc.h:6138
OwnArray< char > iconv_utf8_locale(std::string_view S)
Convert a UTF-8 string to the current locale's character encoding.
Definition: SDL3pp_stdinc.h:6188
OwnArray< Uint32 > iconv_utf8_ucs4(std::string_view S)
Convert a UTF-8 string to UCS-4.
Definition: SDL3pp_stdinc.h:6223
int unsetenv_unsafe(StringParam name)
Clear a variable from the environment.
Definition: SDL3pp_stdinc.h:1469
constexpr float ToSeconds(Seconds duration)
Converts a time duration to seconds (float).
Definition: SDL3pp_stdinc.h:389
char * strupr(char *str)
Convert a string to uppercase.
Definition: SDL3pp_stdinc.h:3134
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
int close()
This function frees a context used for character set conversion.
Definition: SDL3pp_stdinc.h:6082
size_t utf8strlen(StringParam str)
Count the number of codepoints in a UTF-8 string.
Definition: SDL3pp_stdinc.h:3331
constexpr Seconds FromSeconds(float duration)
Converts a float to seconds representation.
Definition: SDL3pp_stdinc.h:392
size_t utf8strnlen(StringParam str, size_t bytes)
Count the number of codepoints in a UTF-8 string, up to n bytes.
Definition: SDL3pp_stdinc.h:3363
int vswprintf(wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, va_list ap)
This works exactly like vswprintf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4230
int isupper(int x)
Report if a character is upper case.
Definition: SDL3pp_stdinc.h:2171
size_t wcsnlen(const wchar_t *wstr, size_t maxlen)
This works exactly like wcsnlen() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:2617
double sqrt(double x)
Compute the square root of x.
Definition: SDL3pp_stdinc.h:5769
constexpr Sint16 MAX_SINT16
Max representable value.
Definition: SDL3pp_stdinc.h:305
void srand(Uint64 seed)
Seeds the pseudo-random number generator.
Definition: SDL3pp_stdinc.h:4317
constexpr Uint8 MAX_UINT8
Max representable value.
Definition: SDL3pp_stdinc.h:292
Sint32 rand_r(Uint64 *state, Sint32 n)
Generate a pseudo-random number less than n for positive n.
Definition: SDL3pp_stdinc.h:4541
double tan(double x)
Compute the tangent of x.
Definition: SDL3pp_stdinc.h:5823
double sin(double x)
Compute the sine of x.
Definition: SDL3pp_stdinc.h:5717
constexpr size_t ICONV_EILSEQ
Invalid input sequence was encountered.
Definition: SDL3pp_stdinc.h:6141
const char * getenv_unsafe(StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1430
size_t utf8strlcpy(char *dst, StringParam src, size_t dst_bytes)
Copy an UTF-8 string.
Definition: SDL3pp_stdinc.h:3012
constexpr Sint64 MIN_SINT64
Min representable value.
Definition: SDL3pp_stdinc.h:362
::Sint8 Sint8
A signed 8-bit integer type.
Definition: SDL3pp_stdinc.h:276
char * strtok_r(char *str, StringParam delim, char **saveptr)
This works exactly like strtok_r() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:3302
void * memset4(void *dst, Uint32 val, size_t dwords)
Initialize all 32-bit words of buffer of memory to a specific value.
Definition: SDL3pp_stdinc.h:2470
constexpr size_t ICONV_ERROR
Generic error. Check GetError()?
Definition: SDL3pp_stdinc.h:6135
int iscntrl(int x)
Report if a character is a control character.
Definition: SDL3pp_stdinc.h:2086
int swprintf(wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt,...)
This works exactly like swprintf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4170
constexpr double PI_D
The value of Pi, as a double-precision floating point literal.
Definition: SDL3pp_stdinc.h:4601
int islower(int x)
Report if a character is lower case.
Definition: SDL3pp_stdinc.h:2186
int isinf(double x)
Return whether the value is infinity.
Definition: SDL3pp_stdinc.h:5267
int isspace(int x)
Report if a character is whitespace.
Definition: SDL3pp_stdinc.h:2156
void DestroyEnvironment(EnvironmentRaw env)
Destroy a set of environment variables.
Definition: SDL3pp_stdinc.h:1391
size_t strnlen(StringParam str, size_t maxlen)
This works exactly like strnlen() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:2951
int strcasecmp(StringParam str1, StringParam str2)
Compare two null-terminated UTF-8 strings, case-insensitively.
Definition: SDL3pp_stdinc.h:3852
size_t strlen(StringParam str)
This works exactly like strlen() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:2928
constexpr Uint16 MAX_UINT16
Max representable value.
Definition: SDL3pp_stdinc.h:318
const char * GetVariable(StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1281
const char * getenv(StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1411
int setenv_unsafe(StringParam name, StringParam value, int overwrite)
Set the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1451
constexpr void InitInterface(I *iface)
A macro to initialize an SDL interface.
Definition: SDL3pp_stdinc.h:613
void *(SDLCALL *)(size_t size) malloc_func
A callback used to implement malloc().
Definition: SDL3pp_stdinc.h:748
int wcscmp(const wchar_t *str1, const wchar_t *str2)
Compare two null-terminated wide strings.
Definition: SDL3pp_stdinc.h:2768
double acos(double x)
Compute the arc cosine of x.
Definition: SDL3pp_stdinc.h:4639
Sint32 rand(Sint32 n)
Generate a pseudo-random number less than n for positive n.
Definition: SDL3pp_stdinc.h:4349
constexpr Sint64 MAX_SINT64
Max representable value.
Definition: SDL3pp_stdinc.h:359
constexpr bool size_add_check_overflow(size_t a, size_t b, size_t *ret)
Add two integers, checking for overflow.
Definition: SDL3pp_stdinc.h:6285
void qsort_r(void *base, size_t nmemb, size_t size, CompareCallback_r compare, void *userdata)
Sort an array, passing a userdata pointer to the compare function.
Definition: SDL3pp_stdinc.h:1688
double floor(double x)
Compute the floor of x.
Definition: SDL3pp_stdinc.h:5107
Uint32 StepUTF8(const char **pstr, size_t *pslen)
Decode a UTF-8 string, one Unicode codepoint at a time.
Definition: SDL3pp_stdinc.h:3975
int toupper(int x)
Convert low-ASCII English letters to uppercase.
Definition: SDL3pp_stdinc.h:2244
SDL_Time TimeRaw
Alias to raw representation for Time.
Definition: SDL3pp_stdinc.h:41
int(SDLCALL *)(const void *a, const void *b) CompareCallback
A callback used with SDL sorting and binary search functions.
Definition: SDL3pp_stdinc.h:1488
Uint32 murmur3_32(const void *data, size_t len, Uint32 seed)
Calculate a 32-bit MurmurHash3 value for a block of data.
Definition: SDL3pp_stdinc.h:2336
constexpr Uint32 FourCC(Uint8 a, Uint8 b, Uint8 c, Uint8 d)
Define a four character code as a Uint32.
Definition: SDL3pp_stdinc.h:236
Uint32 StepBackUTF8(StringParam start, const char **pstr)
Decode a UTF-8 string in reverse, one Unicode codepoint at a time.
Definition: SDL3pp_stdinc.h:4007
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen)
Copy a wide string.
Definition: SDL3pp_stdinc.h:2647
float randf()
Generate a uniform pseudo-random floating point number less than 1.0.
Definition: SDL3pp_stdinc.h:4371
constexpr T clamp(T x, U a, V b)
Return a value clamped to a range.
Definition: SDL3pp_stdinc.h:2023
constexpr Time MAX_TIME
Max allowed time representation.
Definition: SDL3pp_stdinc.h:551
constexpr Nanoseconds FromNS(Sint64 duration)
Converts a Sint64 to nanoseconds representation.
Definition: SDL3pp_stdinc.h:398
SDL_iconv_t IConvRaw
Alias to raw representation for IConv.
Definition: SDL3pp_stdinc.h:86
int wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
Compare two wide strings, case-insensitively, up to a number of wchar_t.
Definition: SDL3pp_stdinc.h:2876
void aligned_free(void *mem)
Free memory allocated by aligned_alloc().
Definition: SDL3pp_stdinc.h:938
void zerop(T *x)
Clear an object's memory to zero, using a pointer.
Definition: SDL3pp_stdinc.h:2516
int abs(int x)
Compute the absolute value of x.
Definition: SDL3pp_stdinc.h:1912
void * calloc(size_t nmemb, size_t size)
Allocate a zero-initialized array.
Definition: SDL3pp_stdinc.h:668
void GetMemoryFunctions(malloc_func *malloc_func, calloc_func *calloc_func, realloc_func *realloc_func, free_func *free_func)
Get the current set of SDL memory functions.
Definition: SDL3pp_stdinc.h:853
void qsort(void *base, size_t nmemb, size_t size, CompareCallback compare)
Sort an array.
Definition: SDL3pp_stdinc.h:1534
constexpr Time MIN_TIME
Min allowed time representation.
Definition: SDL3pp_stdinc.h:554
constexpr Sint64 ToNS(Nanoseconds duration)
Converts a time duration to nanoseconds (Sint64);.
Definition: SDL3pp_stdinc.h:395
int isblank(int x)
Report if a character is blank (a space or tab).
Definition: SDL3pp_stdinc.h:2071
void * realloc(void *mem, size_t size)
Change the size of allocated memory.
Definition: SDL3pp_stdinc.h:709
::Sint64 Sint64
A signed 64-bit integer type.
Definition: SDL3pp_stdinc.h:356
::Sint32 Sint32
A signed 32-bit integer type.
Definition: SDL3pp_stdinc.h:328
int vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
This works exactly like vasprintf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4293
char * itoa(int value, char *str, int radix)
Convert an integer into a string.
Definition: SDL3pp_stdinc.h:3393
int ispunct(int x)
Report if a character is a punctuation mark.
Definition: SDL3pp_stdinc.h:2134
int vsscanf(StringParam text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap)
This works exactly like vsscanf() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:4087
constexpr Uint8 MIN_UINT8
Min representable value.
Definition: SDL3pp_stdinc.h:295
std::function< int(const void *a, const void *b)> CompareCB
A callback used with SDL sorting and binary search functions.
Definition: SDL3pp_stdinc.h:1634
::Sint16 Sint16
A signed 16-bit integer type.
Definition: SDL3pp_stdinc.h:302
wchar_t * wcsnstr(const wchar_t *haystack, const wchar_t *needle, size_t maxlen)
Search a wide string, up to n wide chars, for the first instance of a specific substring.
Definition: SDL3pp_stdinc.h:2745
Uint32 crc32(Uint32 crc, const void *data, size_t len)
Calculate a CRC-32 value.
Definition: SDL3pp_stdinc.h:2307
double log10(double x)
Compute the base-10 logarithm of x.
Definition: SDL3pp_stdinc.h:5395
void SetEnvironmentVariable(EnvironmentParam env, StringParam name, StringParam value, bool overwrite)
Set the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1335
constexpr float PI_F
The value of Pi, as a single-precision floating point literal.
Definition: SDL3pp_stdinc.h:4610
void Destroy()
Destroy a set of environment variables.
Definition: SDL3pp_stdinc.h:1396
wchar_t * wcsstr(const wchar_t *haystack, const wchar_t *needle)
Search a wide string for the first instance of a specific substring.
Definition: SDL3pp_stdinc.h:2719
void * bsearch(const void *key, const void *base, size_t nmemb, size_t size, CompareCallback compare)
Perform a binary search on a previously sorted array.
Definition: SDL3pp_stdinc.h:1591
double cos(double x)
Compute the cosine of x.
Definition: SDL3pp_stdinc.h:4990
void free(void *mem)
Free allocated memory.
Definition: SDL3pp_stdinc.h:729
double atan2(double y, double x)
Compute the arc tangent of y / x, using the signs of x and y to adjust the result's quadrant.
Definition: SDL3pp_stdinc.h:4822
::Uint16 Uint16
An unsigned 16-bit integer type.
Definition: SDL3pp_stdinc.h:315
int wcscasecmp(const wchar_t *str1, const wchar_t *str2)
Compare two null-terminated wide strings, case-insensitively.
Definition: SDL3pp_stdinc.h:2832
char * strpbrk(StringParam str, StringParam breakset)
Searches a string for the first occurrence of any character contained in a breakset,...
Definition: SDL3pp_stdinc.h:3914
void * aligned_alloc(size_t alignment, size_t size)
Allocate memory aligned to a specific alignment.
Definition: SDL3pp_stdinc.h:917
int GetNumAllocations()
Get the number of outstanding (unfreed) allocations.
Definition: SDL3pp_stdinc.h:949
Uint32 rand_bits()
Generate 32 pseudo-random bits.
Definition: SDL3pp_stdinc.h:4394
constexpr Sint8 MAX_SINT8
Max representable value.
Definition: SDL3pp_stdinc.h:279
constexpr Uint8 MIN_UINT32
Min representable value.
Definition: SDL3pp_stdinc.h:347
double trunc(double x)
Truncate x to an integer.
Definition: SDL3pp_stdinc.h:5164
OwnArray< char * > GetEnvironmentVariables(EnvironmentParam env)
Get all variables in the environment.
Definition: SDL3pp_stdinc.h:1305
char * ltoa(long value, char *str, int radix)
Convert a long integer into a string.
Definition: SDL3pp_stdinc.h:3453
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen)
Concatenate wide strings.
Definition: SDL3pp_stdinc.h:2678
double atof(StringParam str)
Parse a double from a string.
Definition: SDL3pp_stdinc.h:3594
constexpr size_t ICONV_EINVAL
Incomplete input sequence was encountered.
Definition: SDL3pp_stdinc.h:6144
constexpr Sint32 MAX_SINT32
Max representable value.
Definition: SDL3pp_stdinc.h:331
void * bsearch_r(const void *key, const void *base, size_t nmemb, size_t size, CompareCallback_r compare, void *userdata)
Perform a binary search on a previously sorted array, passing a userdata pointer to the compare funct...
Definition: SDL3pp_stdinc.h:1818
long strtol(StringParam str, char **endp, int base)
Parse a long from a string.
Definition: SDL3pp_stdinc.h:3627
OwnArray< char > iconv_wchar_utf8(std::wstring_view S)
Convert a wchar_t string to UTF-8.
Definition: SDL3pp_stdinc.h:6241
char * strrchr(StringParam str, int c)
Search a string for the last instance of a specific byte.
Definition: SDL3pp_stdinc.h:3194
size_t wcslen(const wchar_t *wstr)
This works exactly like wcslen() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:2587
SDL_Environment * EnvironmentRaw
Alias to raw representation for Environment.
Definition: SDL3pp_stdinc.h:50
int isalnum(int x)
Query if a character is alphabetic (a letter) or a number.
Definition: SDL3pp_stdinc.h:2056
double fmod(double x, double y)
Return the floating-point remainder of x / y
Definition: SDL3pp_stdinc.h:5223
void * memcpy(void *dst, const void *src, size_t len)
Copy non-overlapping memory.
Definition: SDL3pp_stdinc.h:2359
static Time FromWindows(Uint32 dwLowDateTime, Uint32 dwHighDateTime)
Converts a Windows FILETIME (100-nanosecond intervals since January 1, 1601) to an SDL time.
Definition: SDL3pp_time.h:399
void ToWindows(Uint32 *dwLowDateTime, Uint32 *dwHighDateTime) const
Converts an SDL time into a Windows FILETIME (100-nanosecond intervals since January 1,...
Definition: SDL3pp_time.h:394
static Time Current()
Gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coo...
Definition: SDL3pp_time.h:348
constexpr Sint64 ToPosix() const
Convert nanoseconds to seconds.
Definition: SDL3pp_timer.h:31
static constexpr Time FromPosix(Sint64 time)
Convert seconds to nanoseconds.
Definition: SDL3pp_timer.h:26
Main include header for the SDL3pp library.
Safely wrap Environment for non owning parameters.
Definition: SDL3pp_stdinc.h:57
EnvironmentRaw value
parameter's EnvironmentRaw
Definition: SDL3pp_stdinc.h:58
constexpr EnvironmentParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_stdinc.h:67
constexpr EnvironmentParam(EnvironmentRaw value)
Constructs from EnvironmentRaw.
Definition: SDL3pp_stdinc.h:61
constexpr auto operator<=>(const EnvironmentParam &other) const =default
Comparison.
Semi-safe reference for Environment.
Definition: SDL3pp_stdinc.h:1172
EnvironmentRef(EnvironmentParam resource) noexcept
Constructs from EnvironmentParam.
Definition: SDL3pp_stdinc.h:1182
~EnvironmentRef()
Destructor.
Definition: SDL3pp_stdinc.h:1206
EnvironmentRef(EnvironmentRaw resource) noexcept
Constructs from EnvironmentParam.
Definition: SDL3pp_stdinc.h:1194
EnvironmentRef(const EnvironmentRef &other) noexcept
Copy constructor.
Definition: SDL3pp_stdinc.h:1200
Safely wrap IConv for non owning parameters.
Definition: SDL3pp_stdinc.h:93
constexpr IConvParam(IConvRaw value)
Constructs from IConvRaw.
Definition: SDL3pp_stdinc.h:97
constexpr IConvParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_stdinc.h:103
constexpr auto operator<=>(const IConvParam &other) const =default
Comparison.
IConvRaw value
parameter's IConvRaw
Definition: SDL3pp_stdinc.h:94
Semi-safe reference for IConv.
Definition: SDL3pp_stdinc.h:6011
~IConvRef()
Destructor.
Definition: SDL3pp_stdinc.h:6045
IConvRef(IConvParam resource) noexcept
Constructs from IConvParam.
Definition: SDL3pp_stdinc.h:6021
IConvRef(const IConvRef &other) noexcept
Copy constructor.
Definition: SDL3pp_stdinc.h:6039
IConvRef(IConvRaw resource) noexcept
Constructs from IConvParam.
Definition: SDL3pp_stdinc.h:6033