SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_stdinc.h
1#ifndef SDL3PP_STDINC_H_
2#define SDL3PP_STDINC_H_
3
4#include <chrono>
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"
12
13namespace SDL {
14
41using TimeRaw = SDL_Time;
42
43// Forward decl
44struct Time;
45
46// Forward decl
47struct Environment;
48
50using EnvironmentRaw = SDL_Environment*;
51
52// Forward decl
53struct EnvironmentRef;
54
57{
59
62 : value(value)
63 {
64 }
65
67 constexpr EnvironmentParam(std::nullptr_t = nullptr)
68 : value(nullptr)
69 {
70 }
71
73 constexpr explicit operator bool() const { return !!value; }
74
76 constexpr auto operator<=>(const EnvironmentParam& other) const = default;
77
79 constexpr operator EnvironmentRaw() const { return value; }
80};
81
82// Forward decl
83struct IConv;
84
86using IConvRaw = SDL_iconv_t;
87
88// Forward decl
89struct IConvRef;
90
93{
95
98 : value(value)
99 {
100 }
101
103 constexpr IConvParam(std::nullptr_t = nullptr)
104 : value(nullptr)
105 {
106 }
107
109 constexpr explicit operator bool() const { return !!value; }
110
112 constexpr auto operator<=>(const IConvParam& other) const = default;
113
115 constexpr operator IConvRaw() const { return value; }
116};
117
118#ifdef SDL3PP_DOC
119
136#define SDL_NOLONGLONG 1
137
152#define SDL_SIZE_MAX SIZE_MAX
153
185#define SDL_COMPILE_TIME_ASSERT(name, x) FailToCompileIf_x_IsFalse(x)
186
187#endif // SDL3PP_DOC
188
197template<class T, std::size_t N>
198constexpr std::size_t arraysize(const T (&array)[N])
199{
200 return SDL_arraysize(array);
201}
202
203#ifdef SDL3PP_DOC
204
219#define SDL_STRINGIFY_ARG(arg) #arg
220
221#endif // SDL3PP_DOC
222
236constexpr Uint32 FourCC(Uint8 a, Uint8 b, Uint8 c, Uint8 d)
237{
238 return SDL_FOURCC(a, b, c, d);
239}
240
241#ifdef SDL3PP_DOC
242
254#define SDL_SINT64_C(c) c##LL /* or whatever the current compiler uses. */
255
267#define SDL_UINT64_C(c) c##ULL /* or whatever the current compiler uses. */
268
269#endif // SDL3PP_DOC
270
277
279constexpr Sint8 MAX_SINT8 = SDL_MAX_SINT8;
280
282constexpr Sint8 MIN_SINT8 = SDL_MIN_SINT8;
283
290
292constexpr Uint8 MAX_UINT8 = SDL_MAX_UINT8;
293
295constexpr Uint8 MIN_UINT8 = SDL_MIN_UINT8;
296
303
305constexpr Sint16 MAX_SINT16 = SDL_MAX_SINT16;
306
308constexpr Sint16 MIN_SINT16 = SDL_MIN_SINT16;
309
316
318constexpr Uint16 MAX_UINT16 = SDL_MAX_UINT16;
319
321constexpr Uint16 MIN_UINT16 = SDL_MIN_UINT16;
322
329
331constexpr Sint32 MAX_SINT32 = SDL_MAX_SINT32;
332
334constexpr Sint32 MIN_SINT32 = SDL_MIN_SINT32;
335
342
344constexpr Uint32 MAX_UINT32 = SDL_MAX_UINT32;
345
347constexpr Uint8 MIN_UINT32 = SDL_MIN_UINT32;
348
357
359constexpr Sint64 MAX_SINT64 = SDL_MAX_SINT64;
360
362constexpr Sint64 MIN_SINT64 = SDL_MIN_SINT64;
363
372
374constexpr Uint64 MAX_UINT64 = SDL_MAX_UINT64;
375
377constexpr Uint8 MIN_UINT64 = SDL_MIN_UINT64;
378
380using Seconds = std::chrono::duration<float>;
381
383using Nanoseconds = std::chrono::nanoseconds;
384
386using Milliseconds = std::chrono::milliseconds;
387
389constexpr float ToSeconds(Seconds duration) { return duration.count(); }
390
392constexpr Seconds FromSeconds(float duration) { return Seconds(duration); }
393
395constexpr Sint64 ToNS(Nanoseconds duration) { return duration.count(); }
396
398constexpr Nanoseconds FromNS(Sint64 duration) { return Nanoseconds{duration}; }
399
413class Time
414{
415 Nanoseconds m_time;
416
417public:
418 constexpr Time() = default;
419
425 constexpr explicit Time(TimeRaw time) noexcept
426 : m_time(time)
427 {
428 }
429
435 constexpr Time(std::chrono::nanoseconds time) noexcept
436 : m_time(time)
437 {
438 }
439
441 constexpr explicit operator bool() const
442 {
443 return m_time != std::chrono::nanoseconds{};
444 }
445
447 constexpr operator std::chrono::nanoseconds() const { return m_time; }
448
457 static Time Current();
458
460 static constexpr Time FromNS(Sint64 time)
461 {
462 return Time{std::chrono::nanoseconds{time}};
463 }
464
466 constexpr Sint64 ToNS() const { return m_time.count(); }
467
480 static constexpr Time FromPosix(Sint64 time);
481
493 constexpr Sint64 ToPosix() const;
494
508 static Time FromWindows(Uint32 dwLowDateTime, Uint32 dwHighDateTime);
509
523 void ToWindows(Uint32* dwLowDateTime, Uint32* dwHighDateTime) const;
524
526 constexpr float ToSeconds() const { return Seconds(m_time).count(); }
527
529 static constexpr Time FromSeconds(float interval)
530 {
531 return std::chrono::duration_cast<std::chrono::nanoseconds>(
532 Seconds(interval));
533 }
534
536 constexpr Time& operator+=(std::chrono::nanoseconds interval)
537 {
538 m_time += interval;
539 return *this;
540 }
541
543 constexpr Time& operator-=(std::chrono::nanoseconds interval)
544 {
545 m_time -= interval;
546 return *this;
547 }
548};
549
551constexpr Time MAX_TIME = Time::FromNS(SDL_MAX_TIME);
552
554constexpr Time MIN_TIME = Time::FromNS(SDL_MIN_TIME);
555
564constexpr float FLT_EPSILON = SDL_FLT_EPSILON;
565
571template<class I>
572concept Interface = requires(I* iface) { (iface)->version = sizeof(I); };
573
612template<Interface I>
613constexpr void InitInterface(I* iface)
614{
615 SDL_INIT_INTERFACE(iface);
616}
617
643inline void* malloc(size_t size) { return SDL_malloc(size); }
644
668inline void* calloc(size_t nmemb, size_t size)
669{
670 return SDL_calloc(nmemb, size);
671}
672
709inline void* realloc(void* mem, size_t size) { return SDL_realloc(mem, size); }
710
729inline void free(void* mem) { SDL_free(mem); }
730
748using malloc_func = void*(SDLCALL*)(size_t size);
749
769using calloc_func = void*(SDLCALL*)(size_t nmemb, size_t size);
770
790using realloc_func = void*(SDLCALL*)(void* mem, size_t size);
791
808using free_func = void(SDLCALL*)(void* mem);
809
831{
832 SDL_GetOriginalMemoryFunctions(
834}
835
857{
858 SDL_GetMemoryFunctions(malloc_func, calloc_func, realloc_func, free_func);
859}
860
890{
892 SDL_SetMemoryFunctions(malloc_func, calloc_func, realloc_func, free_func));
893}
894
917inline void* aligned_alloc(size_t alignment, size_t size)
918{
919 return SDL_aligned_alloc(alignment, size);
920}
921
938inline void aligned_free(void* mem) { SDL_aligned_free(mem); }
939
949inline int GetNumAllocations() { return SDL_GetNumAllocations(); }
950
967{
968 EnvironmentRaw m_resource = nullptr;
969
970public:
972 constexpr Environment(std::nullptr_t = nullptr) noexcept
973 : m_resource(0)
974 {
975 }
976
984 constexpr explicit Environment(const EnvironmentRaw resource) noexcept
985 : m_resource(resource)
986 {
987 }
988
989protected:
991 constexpr Environment(const Environment& other) noexcept = default;
992
993public:
995 constexpr Environment(Environment&& other) noexcept
996 : Environment(other.release())
997 {
998 }
999
1000 constexpr Environment(const EnvironmentRef& other) = delete;
1001
1002 constexpr Environment(EnvironmentRef&& other) = delete;
1003
1024 Environment(bool populated)
1025 : m_resource(SDL_CreateEnvironment(populated))
1026 {
1027 }
1028
1030 ~Environment() { SDL_DestroyEnvironment(m_resource); }
1031
1033 constexpr Environment& operator=(Environment&& other) noexcept
1034 {
1035 std::swap(m_resource, other.m_resource);
1036 return *this;
1037 }
1038
1039protected:
1041 constexpr Environment& operator=(const Environment& other) noexcept = default;
1042
1043public:
1045 constexpr EnvironmentRaw get() const noexcept { return m_resource; }
1046
1048 constexpr EnvironmentRaw release() noexcept
1049 {
1050 auto r = m_resource;
1051 m_resource = nullptr;
1052 return r;
1053 }
1054
1056 constexpr auto operator<=>(const Environment& other) const noexcept = default;
1057
1059 constexpr explicit operator bool() const noexcept { return !!m_resource; }
1060
1062 constexpr operator EnvironmentParam() const noexcept { return {m_resource}; }
1063
1074 void Destroy();
1075
1093 const char* GetVariable(StringParam name);
1094
1115
1124 {
1125 Uint64 count = 0;
1126 for (auto& var : GetVariables()) count += 1;
1127 return count;
1128 }
1129
1150 void SetVariable(StringParam name, StringParam value, bool overwrite);
1151
1169 void UnsetVariable(StringParam name);
1170};
1171
1174{
1176
1185 : Environment(resource.value)
1186 {
1187 }
1188
1197 : Environment(resource)
1198 {
1199 }
1200
1202 constexpr EnvironmentRef(const EnvironmentRef& other) noexcept = default;
1203
1206};
1207
1229inline EnvironmentRaw GetEnvironment() { return SDL_GetEnvironment(); }
1230
1251inline Environment CreateEnvironment(bool populated)
1252{
1253 return Environment(populated);
1254}
1255
1275 StringParam name)
1276{
1277 return SDL_GetEnvironmentVariable(env, name);
1278}
1279
1281{
1282 return SDL::GetEnvironmentVariable(m_resource, std::move(name));
1283}
1284
1305{
1306 return OwnArray<char*>{CheckError(SDL_GetEnvironmentVariables(env))};
1307}
1308
1310{
1311 return SDL::GetEnvironmentVariables(m_resource);
1312}
1313
1335 StringParam name,
1336 StringParam value,
1337 bool overwrite)
1338{
1339 CheckError(SDL_SetEnvironmentVariable(env, name, value, overwrite));
1340}
1341
1343 StringParam value,
1344 bool overwrite)
1345{
1347 m_resource, std::move(name), std::move(value), overwrite);
1348}
1349
1369{
1370 CheckError(SDL_UnsetEnvironmentVariable(env, name));
1371}
1372
1374{
1375 SDL::UnsetEnvironmentVariable(m_resource, std::move(name));
1376}
1377
1391{
1392 SDL_DestroyEnvironment(env);
1393}
1394
1396
1410inline const char* getenv(StringParam name) { return SDL_getenv(name); }
1411
1429inline const char* getenv_unsafe(StringParam name)
1430{
1431 return SDL_getenv_unsafe(name);
1432}
1433
1450inline int setenv_unsafe(StringParam name, StringParam value, int overwrite)
1451{
1452 return SDL_setenv_unsafe(name, value, overwrite);
1453}
1454
1469{
1470 return SDL_unsetenv_unsafe(name);
1471}
1472
1487using CompareCallback = int(SDLCALL*)(const void* a, const void* b);
1488
1533inline void qsort(void* base,
1534 size_t nmemb,
1535 size_t size,
1536 CompareCallback compare)
1537{
1538 SDL_qsort(base, nmemb, size, compare);
1539}
1540
1590inline void* bsearch(const void* key,
1591 const void* base,
1592 size_t nmemb,
1593 size_t size,
1594 CompareCallback compare)
1595{
1596 return SDL_bsearch(key, base, nmemb, size, compare);
1597}
1598
1614using CompareCallback_r = int(SDLCALL*)(void* userdata,
1615 const void* a,
1616 const void* b);
1617
1633using CompareCB = std::function<int(const void* a, const void* b)>;
1634
1687inline void qsort_r(void* base,
1688 size_t nmemb,
1689 size_t size,
1690 CompareCallback_r compare,
1691 void* userdata)
1692{
1693 SDL_qsort_r(base, nmemb, size, compare, userdata);
1694}
1695
1747inline void qsort_r(void* base, size_t nmemb, size_t size, CompareCB compare)
1748{
1749 return qsort_r(
1750 base,
1751 nmemb,
1752 size,
1753 [](void* userdata, const void* a, const void* b) {
1754 auto& cb = *static_cast<CompareCB*>(userdata);
1755 return cb(a, b);
1756 },
1757 &compare);
1758}
1759
1817inline void* bsearch_r(const void* key,
1818 const void* base,
1819 size_t nmemb,
1820 size_t size,
1821 CompareCallback_r compare,
1822 void* userdata)
1823{
1824 return SDL_bsearch_r(key, base, nmemb, size, compare, userdata);
1825}
1826
1883inline void* bsearch_r(const void* key,
1884 const void* base,
1885 size_t nmemb,
1886 size_t size,
1887 CompareCB compare)
1888{
1889 return bsearch_r(
1890 key,
1891 base,
1892 nmemb,
1893 size,
1894 [](void* userdata, const void* a, const void* b) {
1895 auto& cb = *static_cast<CompareCB*>(userdata);
1896 return cb(a, b);
1897 },
1898 &compare);
1899}
1900
1911inline int abs(int x) { return SDL_abs(x); }
1912
1932inline double abs(double x) { return SDL_fabs(x); }
1933
1953inline float abs(float x) { return SDL_fabsf(x); }
1954
1971template<class T, class U>
1972constexpr T min(T x, U y)
1973{
1974 return SDL_min(x, y);
1975}
1976
1993template<class T, class U>
1994constexpr T max(T x, U y)
1995{
1996 return SDL_max(x, y);
1997}
1998
2021template<class T, class U, class V>
2022constexpr T clamp(T x, U a, V b)
2023{
2024 return SDL_clamp(x, a, b);
2025}
2026
2040inline int isalpha(int x) { return SDL_isalpha(x); }
2041
2055inline int isalnum(int x) { return SDL_isalnum(x); }
2056
2070inline int isblank(int x) { return SDL_isblank(x); }
2071
2085inline int iscntrl(int x) { return SDL_iscntrl(x); }
2086
2100inline int isdigit(int x) { return SDL_isdigit(x); }
2101
2115inline int isxdigit(int x) { return SDL_isxdigit(x); }
2116
2133inline int ispunct(int x) { return SDL_ispunct(x); }
2134
2155inline int isspace(int x) { return SDL_isspace(x); }
2156
2170inline int isupper(int x) { return SDL_isupper(x); }
2171
2185inline int islower(int x) { return SDL_islower(x); }
2186
2204inline int isprint(int x) { return SDL_isprint(x); }
2205
2225inline int isgraph(int x) { return SDL_isgraph(x); }
2226
2243inline int toupper(int x) { return SDL_toupper(x); }
2244
2261inline int tolower(int x) { return SDL_tolower(x); }
2262
2282inline Uint16 crc16(Uint16 crc, const void* data, size_t len)
2283{
2284 return SDL_crc16(crc, data, len);
2285}
2286
2306inline Uint32 crc32(Uint32 crc, const void* data, size_t len)
2307{
2308 return SDL_crc32(crc, data, len);
2309}
2310
2335inline Uint32 murmur3_32(const void* data, size_t len, Uint32 seed)
2336{
2337 return SDL_murmur3_32(data, len, seed);
2338}
2339
2358inline void* memcpy(void* dst, const void* src, size_t len)
2359{
2360#ifdef SDL_SLOW_MEMCPY
2361 return SDL_memcpy(dst, src, len);
2362#else
2363 return ::memcpy(dst, src, len);
2364#endif // SDL_SLOW_MEMCPY
2365}
2366
2391template<typename T, typename U>
2392constexpr T* copyp(T* dst, const U* src)
2393{
2394 SDL_copyp(dst, src);
2395 return dst;
2396}
2397
2415inline void* memmove(void* dst, const void* src, size_t len)
2416{
2417#ifdef SDL_SLOW_MEMMOVE
2418 return SDL_memmove(dst, src, len);
2419#else
2420 return ::memmove(dst, src, len);
2421#endif // SDL_SLOW_MEMMOVE
2422}
2423
2442inline void* memset(void* dst, int c, size_t len)
2443{
2444#ifdef SDL_SLOW_MEMSET
2445 return SDL_memset(dst, c, len);
2446#else
2447 return ::memset(dst, c, len);
2448#endif // SDL_SLOW_MEMSET
2449}
2450
2469inline void* memset4(void* dst, Uint32 val, size_t dwords)
2470{
2471 return SDL_memset4(dst, val, dwords);
2472}
2473
2491template<class T>
2492inline void zero(T& x)
2493{
2494 SDL_zero(x);
2495}
2496
2514template<class T>
2515inline void zerop(T* x)
2516{
2517 SDL_zerop(x);
2518}
2519
2537template<class T, std::size_t N>
2538inline void zeroa(T (&x)[N])
2539{
2540 SDL_zeroa(x);
2541}
2542
2557inline int memcmp(const void* s1, const void* s2, size_t len)
2558{
2559 return SDL_memcmp(s1, s2, len);
2560}
2561
2586inline size_t wcslen(const wchar_t* wstr) { return SDL_wcslen(wstr); }
2587
2616inline size_t wcsnlen(const wchar_t* wstr, size_t maxlen)
2617{
2618 return SDL_wcsnlen(wstr, maxlen);
2619}
2620
2646inline size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t maxlen)
2647{
2648 return SDL_wcslcpy(dst, src, maxlen);
2649}
2650
2677inline size_t wcslcat(wchar_t* dst, const wchar_t* src, size_t maxlen)
2678{
2679 return SDL_wcslcat(dst, src, maxlen);
2680}
2681
2698inline wchar_t* wcsdup(const wchar_t* wstr) { return SDL_wcsdup(wstr); }
2699
2718inline wchar_t* wcsstr(const wchar_t* haystack, const wchar_t* needle)
2719{
2720 return SDL_wcsstr(haystack, needle);
2721}
2722
2744inline wchar_t* wcsnstr(const wchar_t* haystack,
2745 const wchar_t* needle,
2746 size_t maxlen)
2747{
2748 return SDL_wcsnstr(haystack, needle, maxlen);
2749}
2750
2767inline int wcscmp(const wchar_t* str1, const wchar_t* str2)
2768{
2769 return SDL_wcscmp(str1, str2);
2770}
2771
2799inline int wcsncmp(const wchar_t* str1, const wchar_t* str2, size_t maxlen)
2800{
2801 return SDL_wcsncmp(str1, str2, maxlen);
2802}
2803
2831inline int wcscasecmp(const wchar_t* str1, const wchar_t* str2)
2832{
2833 return SDL_wcscasecmp(str1, str2);
2834}
2835
2875inline int wcsncasecmp(const wchar_t* str1, const wchar_t* str2, size_t maxlen)
2876{
2877 return SDL_wcsncasecmp(str1, str2, maxlen);
2878}
2879
2904inline long wcstol(const wchar_t* str, wchar_t** endp, int base)
2905{
2906 return SDL_wcstol(str, endp, base);
2907}
2908
2927inline size_t strlen(StringParam str) { return SDL_strlen(str); }
2928
2950inline size_t strnlen(StringParam str, size_t maxlen)
2951{
2952 return SDL_strnlen(str, maxlen);
2953}
2954
2980inline size_t strlcpy(char* dst, StringParam src, size_t maxlen)
2981{
2982 return SDL_strlcpy(dst, src, maxlen);
2983}
2984
3011inline size_t utf8strlcpy(char* dst, StringParam src, size_t dst_bytes)
3012{
3013 return SDL_utf8strlcpy(dst, src, dst_bytes);
3014}
3015
3042inline size_t strlcat(char* dst, StringParam src, size_t maxlen)
3043{
3044 return SDL_strlcat(dst, src, maxlen);
3045}
3046
3063inline char* strdup(StringParam str) { return SDL_strdup(str); }
3064
3088inline char* strndup(StringParam str, size_t maxlen)
3089{
3090 return SDL_strndup(str, maxlen);
3091}
3092
3112inline char* strrev(char* str) { return SDL_strrev(str); }
3113
3133inline char* strupr(char* str) { return SDL_strupr(str); }
3134
3154inline char* strlwr(char* str) { return SDL_strlwr(str); }
3155
3174inline char* strchr(StringParam str, int c) { return SDL_strchr(str, c); }
3175
3193inline char* strrchr(StringParam str, int c) { return SDL_strrchr(str, c); }
3194
3213inline char* strstr(StringParam haystack, StringParam needle)
3214{
3215 return SDL_strstr(haystack, needle);
3216}
3217
3239inline char* strnstr(StringParam haystack, StringParam needle, size_t maxlen)
3240{
3241 return SDL_strnstr(haystack, needle, maxlen);
3242}
3243
3270inline char* strcasestr(StringParam haystack, StringParam needle)
3271{
3272 return SDL_strcasestr(haystack, needle);
3273}
3274
3301inline char* strtok_r(char* str, StringParam delim, char** saveptr)
3302{
3303 return SDL_strtok_r(str, delim, saveptr);
3304}
3305
3330inline size_t utf8strlen(StringParam str) { return SDL_utf8strlen(str); }
3331
3362inline size_t utf8strnlen(StringParam str, size_t bytes)
3363{
3364 return SDL_utf8strnlen(str, bytes);
3365}
3366
3392inline char* itoa(int value, char* str, int radix)
3393{
3394 return SDL_itoa(value, str, radix);
3395}
3396
3422inline char* uitoa(unsigned int value, char* str, int radix)
3423{
3424 return SDL_uitoa(value, str, radix);
3425}
3426
3452inline char* ltoa(long value, char* str, int radix)
3453{
3454 return SDL_ltoa(value, str, radix);
3455}
3456
3482inline char* ultoa(unsigned long value, char* str, int radix)
3483{
3484 return SDL_ultoa(value, str, radix);
3485}
3486
3487#ifndef SDL_NOLONGLONG
3488
3514inline char* lltoa(long long value, char* str, int radix)
3515{
3516 return SDL_lltoa(value, str, radix);
3517}
3518
3544inline char* ulltoa(unsigned long long value, char* str, int radix)
3545{
3546 return SDL_ulltoa(value, str, radix);
3547}
3548
3549#endif // SDL_NOLONGLONG
3550
3572inline int atoi(StringParam str) { return SDL_atoi(str); }
3573
3593inline double atof(StringParam str) { return SDL_atof(str); }
3594
3626inline long strtol(StringParam str, char** endp, int base)
3627{
3628 return SDL_strtol(str, endp, base);
3629}
3630
3661inline unsigned long strtoul(StringParam str, char** endp, int base)
3662{
3663 return SDL_strtoul(str, endp, base);
3664}
3665
3666#ifndef SDL_NOLONGLONG
3667
3698inline long long strtoll(StringParam str, char** endp, int base)
3699{
3700 return SDL_strtoll(str, endp, base);
3701}
3702
3733inline unsigned long long strtoull(StringParam str, char** endp, int base)
3734{
3735 return SDL_strtoull(str, endp, base);
3736}
3737
3738#endif // SDL_NOLONGLONG
3739
3767inline double strtod(StringParam str, char** endp)
3768{
3769 return SDL_strtod(str, endp);
3770}
3771
3789inline int strcmp(StringParam str1, StringParam str2)
3790{
3791 return SDL_strcmp(str1, str2);
3792}
3793
3821inline int strncmp(StringParam str1, StringParam str2, size_t maxlen)
3822{
3823 return SDL_strncmp(str1, str2, maxlen);
3824}
3825
3851inline int strcasecmp(StringParam str1, StringParam str2)
3852{
3853 return SDL_strcasecmp(str1, str2);
3854}
3855
3892inline int strncasecmp(StringParam str1, StringParam str2, size_t maxlen)
3893{
3894 return SDL_strncasecmp(str1, str2, maxlen);
3895}
3896
3913inline char* strpbrk(StringParam str, StringParam breakset)
3914{
3915 return SDL_strpbrk(str, breakset);
3916}
3917
3931constexpr Uint32 INVALID_UNICODE_CODEPOINT = SDL_INVALID_UNICODE_CODEPOINT;
3932
3974inline Uint32 StepUTF8(const char** pstr, size_t* pslen)
3975{
3976 return SDL_StepUTF8(pstr, pslen);
3977}
3978
4006inline Uint32 StepBackUTF8(StringParam start, const char** pstr)
4007{
4008 return SDL_StepBackUTF8(start, pstr);
4009}
4010
4038inline char* UCS4ToUTF8(Uint32 codepoint, char* dst)
4039{
4040 return SDL_UCS4ToUTF8(codepoint, dst);
4041}
4042
4058inline int sscanf(StringParam text,
4059 SDL_SCANF_FORMAT_STRING const char* fmt,
4060 ...)
4061{
4062 int rc;
4063 va_list ap;
4064 va_start(ap, fmt);
4065 rc = SDL_vsscanf(text, fmt, ap);
4066 va_end(ap);
4067 return rc;
4068}
4069
4086inline int vsscanf(StringParam text,
4087 SDL_SCANF_FORMAT_STRING const char* fmt,
4088 va_list ap)
4089{
4090 return SDL_vsscanf(text, fmt, ap);
4091}
4092
4123inline int snprintf(char* text,
4124 size_t maxlen,
4125 SDL_PRINTF_FORMAT_STRING const char* fmt,
4126 ...)
4127{
4128 va_list ap;
4129 int result;
4130
4131 va_start(ap, fmt);
4132 result = SDL_vsnprintf(text, maxlen, fmt, ap);
4133 va_end(ap);
4134
4135 return result;
4136}
4137
4169inline int swprintf(wchar_t* text,
4170 size_t maxlen,
4171 SDL_PRINTF_FORMAT_STRING const wchar_t* fmt,
4172 ...)
4173{
4174 va_list ap;
4175 int result;
4176
4177 va_start(ap, fmt);
4178 result = SDL_vswprintf(text, maxlen, fmt, ap);
4179 va_end(ap);
4180
4181 return result;
4182}
4183
4202inline int vsnprintf(char* text,
4203 size_t maxlen,
4204 SDL_PRINTF_FORMAT_STRING const char* fmt,
4205 va_list ap)
4206{
4207 return SDL_vsnprintf(text, maxlen, fmt, ap);
4208}
4209
4229inline int vswprintf(wchar_t* text,
4230 size_t maxlen,
4231 SDL_PRINTF_FORMAT_STRING const wchar_t* fmt,
4232 va_list ap)
4233{
4234 return SDL_vswprintf(text, maxlen, fmt, ap);
4235}
4236
4263inline int asprintf(char** strp, SDL_PRINTF_FORMAT_STRING const char* fmt, ...)
4264{
4265 va_list ap;
4266 int result;
4267
4268 va_start(ap, fmt);
4269 result = SDL_vasprintf(strp, fmt, ap);
4270 va_end(ap);
4271
4272 return result;
4273}
4274
4292inline int vasprintf(char** strp,
4293 SDL_PRINTF_FORMAT_STRING const char* fmt,
4294 va_list ap)
4295{
4296 return SDL_vasprintf(strp, fmt, ap);
4297}
4298
4316inline void srand(Uint64 seed) { SDL_srand(seed); }
4317
4329{
4330 Uint64 m_state;
4331
4332public:
4334 constexpr Random()
4335 : m_state(0)
4336 {
4337 }
4338
4340 constexpr explicit Random(Uint64 state)
4341 : m_state(state)
4342 {
4343 }
4344
4346 constexpr operator Uint64() const { return m_state; }
4347
4379 Sint32 rand(Sint32 n) { return SDL_rand_r(&m_state, n); }
4380
4403 float randf() { return SDL_randf_r(&m_state); }
4404
4426 Uint32 rand_bits() { return SDL_rand_bits_r(&m_state); }
4427};
4428
4459inline Sint32 rand(Sint32 n) { return SDL_rand(n); }
4460
4494inline Sint32 rand(Uint64* state, Sint32 n) { return SDL_rand_r(state, n); }
4495
4529inline Sint32 rand(Random& state, Sint32 n) { return state.rand(n); }
4530
4551inline float randf() { return SDL_randf(); }
4552
4577inline float randf(Uint64* state) { return SDL_randf_r(state); }
4578
4603inline float randf(Random& state) { return state.randf(); }
4604
4626inline Uint32 rand_bits() { return SDL_rand_bits(); }
4627
4651inline Uint32 rand_bits(Uint64* state) { return SDL_rand_bits_r(state); }
4652
4676inline Uint32 rand_bits(Random& state) { return state.rand_bits(); }
4677
4685constexpr double PI_D = SDL_PI_D;
4686
4694constexpr float PI_F = SDL_PI_F;
4695
4723inline double acos(double x) { return SDL_acos(x); }
4724
4752inline float acos(float x) { return SDL_acosf(x); }
4753
4781inline double asin(double x) { return SDL_asin(x); }
4782
4810inline float asin(float x) { return SDL_asinf(x); }
4811
4841inline double atan(double x) { return SDL_atan(x); }
4842
4872inline float atan(float x) { return SDL_atanf(x); }
4873
4906inline double atan2(double y, double x) { return SDL_atan2(y, x); }
4907
4941inline float atan2(float y, float x) { return SDL_atan2f(y, x); }
4942
4969inline double ceil(double x) { return SDL_ceil(x); }
4970
4997inline float ceil(float x) { return SDL_ceilf(x); }
4998
5022inline double copysign(double x, double y) { return SDL_copysign(x, y); }
5023
5047inline float copysign(float x, float y) { return SDL_copysignf(x, y); }
5048
5074inline double cos(double x) { return SDL_cos(x); }
5075
5101inline float cos(float x) { return SDL_cosf(x); }
5102
5132inline double exp(double x) { return SDL_exp(x); }
5133
5163inline float exp(float x) { return SDL_expf(x); }
5164
5191inline double floor(double x) { return SDL_floor(x); }
5192
5219inline float floor(float x) { return SDL_floorf(x); }
5220
5248inline double trunc(double x) { return SDL_trunc(x); }
5249
5277inline float trunc(float x) { return SDL_truncf(x); }
5278
5307inline double fmod(double x, double y) { return SDL_fmod(x, y); }
5308
5337inline float fmod(float x, float y) { return SDL_fmodf(x, y); }
5338
5351inline int isinf(double x) { return SDL_isinf(x); }
5352
5365inline int isinf(float x) { return SDL_isinff(x); }
5366
5379inline int isnan(double x) { return SDL_isnan(x); }
5380
5393inline int isnan(float x) { return SDL_isnanf(x); }
5394
5422inline double log(double x) { return SDL_log(x); }
5423
5450inline float log(float x) { return SDL_logf(x); }
5451
5479inline double log10(double x) { return SDL_log10(x); }
5480
5508inline float log10(float x) { return SDL_log10f(x); }
5509
5528inline double modf(double x, double* y) { return SDL_modf(x, y); }
5529
5548inline float modf(float x, float* y) { return SDL_modff(x, y); }
5549
5578inline double pow(double x, double y) { return SDL_pow(x, y); }
5579
5608inline float pow(float x, float y) { return SDL_powf(x, y); }
5609
5637inline double round(double x) { return SDL_round(x); }
5638
5666inline float round(float x) { return SDL_roundf(x); }
5667
5695inline long lround(double x) { return SDL_lround(x); }
5696
5724inline long lround(float x) { return SDL_lroundf(x); }
5725
5749inline double scalbn(double x, int n) { return SDL_scalbn(x, n); }
5750
5774inline float scalbn(float x, int n) { return SDL_scalbnf(x, n); }
5775
5801inline double sin(double x) { return SDL_sin(x); }
5802
5828inline float sin(float x) { return SDL_sinf(x); }
5829
5853inline double sqrt(double x) { return SDL_sqrt(x); }
5854
5878inline float sqrt(float x) { return SDL_sqrtf(x); }
5879
5907inline double tan(double x) { return SDL_tan(x); }
5908
5936inline float tan(float x) { return SDL_tanf(x); }
5937
5948{
5949 IConvRaw m_resource = nullptr;
5950
5951public:
5953 constexpr IConv(std::nullptr_t = nullptr) noexcept
5954 : m_resource(reinterpret_cast<IConvRaw>(SDL_ICONV_ERROR))
5955 {
5956 }
5957
5965 constexpr explicit IConv(const IConvRaw resource) noexcept
5966 : m_resource(resource)
5967 {
5968 }
5969
5970protected:
5972 constexpr IConv(const IConv& other) noexcept = default;
5973
5974public:
5976 constexpr IConv(IConv&& other) noexcept
5977 : IConv(other.release())
5978 {
5979 }
5980
5981 constexpr IConv(const IConvRef& other) = delete;
5982
5983 constexpr IConv(IConvRef&& other) = delete;
5984
6000 : m_resource(SDL_iconv_open(tocode, fromcode))
6001 {
6002 }
6003
6005 ~IConv() { SDL_iconv_close(m_resource); }
6006
6008 constexpr IConv& operator=(IConv&& other) noexcept
6009 {
6010 std::swap(m_resource, other.m_resource);
6011 return *this;
6012 }
6013
6014protected:
6016 constexpr IConv& operator=(const IConv& other) noexcept = default;
6017
6018public:
6020 constexpr IConvRaw get() const noexcept { return m_resource; }
6021
6023 constexpr IConvRaw release() noexcept
6024 {
6025 auto r = m_resource;
6026 m_resource = nullptr;
6027 return r;
6028 }
6029
6031 constexpr auto operator<=>(const IConv& other) const noexcept = default;
6032
6034 explicit operator bool() const noexcept
6035 {
6036 return reinterpret_cast<size_t>(m_resource) != SDL_ICONV_ERROR;
6037 }
6038
6040 constexpr operator IConvParam() const noexcept { return {m_resource}; }
6041
6053 int close();
6054
6089 size_t iconv(const char** inbuf,
6090 size_t* inbytesleft,
6091 char** outbuf,
6092 size_t* outbytesleft);
6093};
6094
6097{
6098 using IConv::IConv;
6099
6107 IConvRef(IConvParam resource) noexcept
6108 : IConv(resource.value)
6109 {
6110 }
6111
6119 IConvRef(IConvRaw resource) noexcept
6120 : IConv(resource)
6121 {
6122 }
6123
6125 constexpr IConvRef(const IConvRef& other) noexcept = default;
6126
6129};
6130
6145inline IConv iconv_open(StringParam tocode, StringParam fromcode)
6146{
6147 return IConv(std::move(tocode), std::move(fromcode));
6148}
6149
6163inline int iconv_close(IConvRaw cd) { return CheckError(SDL_iconv_close(cd)); }
6164
6165inline int IConv::close() { return iconv_close(release()); }
6166
6201inline size_t iconv(IConvRaw cd,
6202 const char** inbuf,
6203 size_t* inbytesleft,
6204 char** outbuf,
6205 size_t* outbytesleft)
6206{
6207 return CheckError(SDL_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft));
6208}
6209
6210inline size_t IConv::iconv(const char** inbuf,
6211 size_t* inbytesleft,
6212 char** outbuf,
6213 size_t* outbytesleft)
6214{
6215 return SDL::iconv(m_resource, inbuf, inbytesleft, outbuf, outbytesleft);
6216}
6217
6218constexpr size_t ICONV_ERROR =
6219 SDL_ICONV_ERROR;
6220
6221constexpr size_t ICONV_E2BIG =
6222 SDL_ICONV_E2BIG;
6223
6224constexpr size_t ICONV_EILSEQ =
6225 SDL_ICONV_EILSEQ;
6226
6227constexpr size_t ICONV_EINVAL =
6228 SDL_ICONV_EINVAL;
6229
6252 StringParam fromcode,
6253 SourceBytes inbuf)
6254{
6255 return OwnArray<char>{
6256 SDL_iconv_string(tocode, fromcode, inbuf.data(), inbuf.size_bytes())};
6257}
6258
6271inline OwnArray<char> iconv_utf8_locale(std::string_view S)
6272{
6273 return iconv_string("", "UTF-8", S);
6274}
6275
6288inline OwnArray<Uint16> iconv_utf8_ucs2(std::string_view S)
6289{
6290 auto data = SDL_iconv_string("UCS-2", "UTF-8", S.data(), S.size());
6291 return OwnArray<Uint16>(reinterpret_cast<Uint16*>(data));
6292}
6293
6306inline OwnArray<Uint32> iconv_utf8_ucs4(std::string_view S)
6307{
6308 auto data = SDL_iconv_string("UCS-4", "UTF-8", S.data(), S.size());
6309 return OwnArray<Uint32>(reinterpret_cast<Uint32*>(data));
6310}
6311
6324inline OwnArray<char> iconv_wchar_utf8(std::wstring_view S)
6325{
6326 return iconv_string("UTF-8", "WCHAR_T", S);
6327}
6328
6346constexpr bool size_mul_check_overflow(size_t a, size_t b, size_t* ret)
6347{
6348 return SDL_size_mul_check_overflow(a, b, ret);
6349}
6350
6368constexpr bool size_add_check_overflow(size_t a, size_t b, size_t* ret)
6369{
6370 return SDL_size_add_check_overflow(a, b, ret);
6371}
6372
6388using FunctionPointer = void(SDLCALL*)();
6389
6391
6392inline void PtrDeleter::operator()(void* ptr) const { SDL_free(ptr); }
6393
6394} // namespace SDL
6395
6396#endif /* SDL3PP_STDINC_H_ */
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:1045
constexpr EnvironmentRaw release() noexcept
Retrieves underlying EnvironmentRaw and clear this.
Definition: SDL3pp_stdinc.h:1048
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:1123
constexpr Environment & operator=(Environment &&other) noexcept
Assignment operator.
Definition: SDL3pp_stdinc.h:1033
constexpr Environment(const Environment &other) noexcept=default
Copy constructor.
constexpr auto operator<=>(const Environment &other) const noexcept=default
Comparison.
Environment(bool populated)
Create a set of environment variables.
Definition: SDL3pp_stdinc.h:1024
~Environment()
Destructor.
Definition: SDL3pp_stdinc.h:1030
constexpr Environment(Environment &&other) noexcept
Move constructor.
Definition: SDL3pp_stdinc.h:995
An opaque handle representing string encoding conversion state.
Definition: SDL3pp_stdinc.h:5948
constexpr IConv(const IConvRaw resource) noexcept
Constructs from IConvParam.
Definition: SDL3pp_stdinc.h:5965
constexpr IConvRaw get() const noexcept
Retrieves underlying IConvRaw.
Definition: SDL3pp_stdinc.h:6020
constexpr IConv & operator=(IConv &&other) noexcept
Assignment operator.
Definition: SDL3pp_stdinc.h:6008
~IConv()
Destructor.
Definition: SDL3pp_stdinc.h:6005
constexpr IConv(const IConv &other) noexcept=default
Copy constructor.
constexpr IConv(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_stdinc.h:5953
constexpr IConvRaw release() noexcept
Retrieves underlying IConvRaw and clear this.
Definition: SDL3pp_stdinc.h:6023
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:5999
constexpr IConv & operator=(const IConv &other) noexcept=default
Assignment operator.
constexpr IConv(IConv &&other) noexcept
Move constructor.
Definition: SDL3pp_stdinc.h:5976
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
A independent pseudo random state.
Definition: SDL3pp_stdinc.h:4329
constexpr Random(Uint64 state)
Init state with the given value.
Definition: SDL3pp_stdinc.h:4340
float randf()
Generate a uniform pseudo-random floating point number less than 1.0.
Definition: SDL3pp_stdinc.h:4403
constexpr Random()
Default constructor initializes state to zero.
Definition: SDL3pp_stdinc.h:4334
Uint32 rand_bits()
Generate 32 pseudo-random bits.
Definition: SDL3pp_stdinc.h:4426
Sint32 rand(Sint32 n)
Generate a pseudo-random number less than n for positive n.
Definition: SDL3pp_stdinc.h:4379
Source byte stream.
Definition: SDL3pp_strings.h:240
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition: SDL3pp_strings.h:304
constexpr const char * data() const
Retrieves contained data.
Definition: SDL3pp_strings.h:307
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:2799
double log(double x)
Compute the natural logarithm of x.
Definition: SDL3pp_stdinc.h:5422
char * UCS4ToUTF8(Uint32 codepoint, char *dst)
Convert a single Unicode codepoint to UTF-8.
Definition: SDL3pp_stdinc.h:4038
long wcstol(const wchar_t *str, wchar_t **endp, int base)
Parse a long from a wide string.
Definition: SDL3pp_stdinc.h:2904
char * strdup(StringParam str)
Allocate a copy of a string.
Definition: SDL3pp_stdinc.h:3063
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:3767
void SetVariable(StringParam name, StringParam value, bool overwrite)
Set the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1342
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:1616
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:3270
void UnsetVariable(StringParam name)
Clear a variable from the environment.
Definition: SDL3pp_stdinc.h:1373
double atan(double x)
Compute the arc tangent of x.
Definition: SDL3pp_stdinc.h:4841
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:4263
double ceil(double x)
Compute the ceiling of x.
Definition: SDL3pp_stdinc.h:4969
char * strlwr(char *str)
Convert a string to lowercase.
Definition: SDL3pp_stdinc.h:3154
void * memmove(void *dst, const void *src, size_t len)
Copy memory ranges that might overlap.
Definition: SDL3pp_stdinc.h:2415
int memcmp(const void *s1, const void *s2, size_t len)
Compare two buffers of memory.
Definition: SDL3pp_stdinc.h:2557
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:3239
OwnArray< Uint16 > iconv_utf8_ucs2(std::string_view S)
Convert a UTF-8 string to UCS-2.
Definition: SDL3pp_stdinc.h:6288
int isnan(double x)
Return whether the value is NaN.
Definition: SDL3pp_stdinc.h:5379
constexpr Uint32 INVALID_UNICODE_CODEPOINT
The Unicode REPLACEMENT CHARACTER codepoint.
Definition: SDL3pp_stdinc.h:3931
double scalbn(double x, int n)
Scale x by an integer power of two.
Definition: SDL3pp_stdinc.h:5749
char * ultoa(unsigned long value, char *str, int radix)
Convert an unsigned long integer into a string.
Definition: SDL3pp_stdinc.h:3482
wchar_t * wcsdup(const wchar_t *wstr)
Allocate a copy of a wide string.
Definition: SDL3pp_stdinc.h:2698
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:2225
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:1309
const char * GetEnvironmentVariable(EnvironmentParam env, StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1274
int strncmp(StringParam str1, StringParam str2, size_t maxlen)
Compare two UTF-8 strings up to a number of bytes.
Definition: SDL3pp_stdinc.h:3821
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:6210
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:4781
Uint16 crc16(Uint16 crc, const void *data, size_t len)
Calculate a CRC-16 value.
Definition: SDL3pp_stdinc.h:2282
char * strrev(char *str)
Reverse a string's contents.
Definition: SDL3pp_stdinc.h:3112
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:3892
constexpr T min(T x, U y)
Return the lesser of two values.
Definition: SDL3pp_stdinc.h:1972
unsigned long strtoul(StringParam str, char **endp, int base)
Parse an unsigned long from a string.
Definition: SDL3pp_stdinc.h:3661
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:2100
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:5132
char * strstr(StringParam haystack, StringParam needle)
Search a string for the first instance of a specific substring.
Definition: SDL3pp_stdinc.h:3213
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:6346
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:6145
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:4202
char * strchr(StringParam str, int c)
Search a string for the first instance of a specific byte.
Definition: SDL3pp_stdinc.h:3174
double copysign(double x, double y)
Copy the sign of one floating-point value to another.
Definition: SDL3pp_stdinc.h:5022
Environment CreateEnvironment(bool populated)
Create a set of environment variables.
Definition: SDL3pp_stdinc.h:1251
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:5528
void zero(T &x)
Clear an object's memory to zero.
Definition: SDL3pp_stdinc.h:2492
size_t strlcat(char *dst, StringParam src, size_t maxlen)
Concatenate strings.
Definition: SDL3pp_stdinc.h:3042
void zeroa(T(&x)[N])
Clear an array's memory to zero.
Definition: SDL3pp_stdinc.h:2538
char * strndup(StringParam str, size_t maxlen)
Allocate a copy of a string, up to n characters.
Definition: SDL3pp_stdinc.h:3088
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:6201
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:4123
::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:5637
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:4058
size_t strlcpy(char *dst, StringParam src, size_t maxlen)
Copy a string.
Definition: SDL3pp_stdinc.h:2980
void * memset(void *dst, int c, size_t len)
Initialize all bytes of buffer of memory to a specific value.
Definition: SDL3pp_stdinc.h:2442
void(SDLCALL *)() FunctionPointer
A generic function pointer.
Definition: SDL3pp_stdinc.h:6388
void UnsetEnvironmentVariable(EnvironmentParam env, StringParam name)
Clear a variable from the environment.
Definition: SDL3pp_stdinc.h:1368
constexpr Uint64 MAX_UINT64
Max representable value.
Definition: SDL3pp_stdinc.h:374
int iconv_close(IConvRaw cd)
This function frees a context used for character set conversion.
Definition: SDL3pp_stdinc.h:6163
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:3789
char * uitoa(unsigned int value, char *str, int radix)
Convert an unsigned integer into a string.
Definition: SDL3pp_stdinc.h:3422
double pow(double x, double y)
Raise x to the power y
Definition: SDL3pp_stdinc.h:5578
constexpr T * copyp(T *dst, const U *src)
A macro to copy memory between objects, with basic type checking.
Definition: SDL3pp_stdinc.h:2392
constexpr Sint32 MIN_SINT32
Min representable value.
Definition: SDL3pp_stdinc.h:334
EnvironmentRaw GetEnvironment()
Get the process environment.
Definition: SDL3pp_stdinc.h:1229
int isprint(int x)
Report if a character is "printable".
Definition: SDL3pp_stdinc.h:2204
long lround(double x)
Round x to the nearest integer representable as a long.
Definition: SDL3pp_stdinc.h:5695
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:2115
constexpr T max(T x, U y)
Return the greater of two values.
Definition: SDL3pp_stdinc.h:1994
int atoi(StringParam str)
Parse an int from a string.
Definition: SDL3pp_stdinc.h:3572
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:6251
int tolower(int x)
Convert low-ASCII English letters to lowercase.
Definition: SDL3pp_stdinc.h:2261
int isalpha(int x)
Query if a character is alphabetic (a letter).
Definition: SDL3pp_stdinc.h:2040
constexpr size_t ICONV_E2BIG
Output buffer was too small.
Definition: SDL3pp_stdinc.h:6221
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:6271
OwnArray< Uint32 > iconv_utf8_ucs4(std::string_view S)
Convert a UTF-8 string to UCS-4.
Definition: SDL3pp_stdinc.h:6306
int unsetenv_unsafe(StringParam name)
Clear a variable from the environment.
Definition: SDL3pp_stdinc.h:1468
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:3133
::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:6165
size_t utf8strlen(StringParam str)
Count the number of codepoints in a UTF-8 string.
Definition: SDL3pp_stdinc.h:3330
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:3362
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:4229
int isupper(int x)
Report if a character is upper case.
Definition: SDL3pp_stdinc.h:2170
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:2616
double sqrt(double x)
Compute the square root of x.
Definition: SDL3pp_stdinc.h:5853
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:4316
constexpr Uint8 MAX_UINT8
Max representable value.
Definition: SDL3pp_stdinc.h:292
double tan(double x)
Compute the tangent of x.
Definition: SDL3pp_stdinc.h:5907
double sin(double x)
Compute the sine of x.
Definition: SDL3pp_stdinc.h:5801
constexpr size_t ICONV_EILSEQ
Invalid input sequence was encountered.
Definition: SDL3pp_stdinc.h:6224
const char * getenv_unsafe(StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1429
size_t utf8strlcpy(char *dst, StringParam src, size_t dst_bytes)
Copy an UTF-8 string.
Definition: SDL3pp_stdinc.h:3011
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:3301
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:2469
constexpr size_t ICONV_ERROR
Generic error. Check GetError()?
Definition: SDL3pp_stdinc.h:6218
int iscntrl(int x)
Report if a character is a control character.
Definition: SDL3pp_stdinc.h:2085
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:4169
constexpr double PI_D
The value of Pi, as a double-precision floating point literal.
Definition: SDL3pp_stdinc.h:4685
int islower(int x)
Report if a character is lower case.
Definition: SDL3pp_stdinc.h:2185
int isinf(double x)
Return whether the value is infinity.
Definition: SDL3pp_stdinc.h:5351
int isspace(int x)
Report if a character is whitespace.
Definition: SDL3pp_stdinc.h:2155
void DestroyEnvironment(EnvironmentRaw env)
Destroy a set of environment variables.
Definition: SDL3pp_stdinc.h:1390
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:2950
int strcasecmp(StringParam str1, StringParam str2)
Compare two null-terminated UTF-8 strings, case-insensitively.
Definition: SDL3pp_stdinc.h:3851
size_t strlen(StringParam str)
This works exactly like strlen() but doesn't require access to a C runtime.
Definition: SDL3pp_stdinc.h:2927
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:1280
const char * getenv(StringParam name)
Get the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1410
int setenv_unsafe(StringParam name, StringParam value, int overwrite)
Set the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1450
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:2767
double acos(double x)
Compute the arc cosine of x.
Definition: SDL3pp_stdinc.h:4723
Sint32 rand(Sint32 n)
Generate a pseudo-random number less than n for positive n.
Definition: SDL3pp_stdinc.h:4459
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:6368
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:1687
double floor(double x)
Compute the floor of x.
Definition: SDL3pp_stdinc.h:5191
Uint32 StepUTF8(const char **pstr, size_t *pslen)
Decode a UTF-8 string, one Unicode codepoint at a time.
Definition: SDL3pp_stdinc.h:3974
int toupper(int x)
Convert low-ASCII English letters to uppercase.
Definition: SDL3pp_stdinc.h:2243
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:1487
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:2335
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:4006
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen)
Copy a wide string.
Definition: SDL3pp_stdinc.h:2646
float randf()
Generate a uniform pseudo-random floating point number less than 1.0.
Definition: SDL3pp_stdinc.h:4551
constexpr T clamp(T x, U a, V b)
Return a value clamped to a range.
Definition: SDL3pp_stdinc.h:2022
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:2875
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:2515
int abs(int x)
Compute the absolute value of x.
Definition: SDL3pp_stdinc.h:1911
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:1533
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:2070
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:4292
char * itoa(int value, char *str, int radix)
Convert an integer into a string.
Definition: SDL3pp_stdinc.h:3392
int ispunct(int x)
Report if a character is a punctuation mark.
Definition: SDL3pp_stdinc.h:2133
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:4086
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:1633
::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:2744
Uint32 crc32(Uint32 crc, const void *data, size_t len)
Calculate a CRC-32 value.
Definition: SDL3pp_stdinc.h:2306
double log10(double x)
Compute the base-10 logarithm of x.
Definition: SDL3pp_stdinc.h:5479
void SetEnvironmentVariable(EnvironmentParam env, StringParam name, StringParam value, bool overwrite)
Set the value of a variable in the environment.
Definition: SDL3pp_stdinc.h:1334
constexpr float PI_F
The value of Pi, as a single-precision floating point literal.
Definition: SDL3pp_stdinc.h:4694
void Destroy()
Destroy a set of environment variables.
Definition: SDL3pp_stdinc.h:1395
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:2718
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:1590
double cos(double x)
Compute the cosine of x.
Definition: SDL3pp_stdinc.h:5074
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:4906
::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:2831
char * strpbrk(StringParam str, StringParam breakset)
Searches a string for the first occurrence of any character contained in a breakset,...
Definition: SDL3pp_stdinc.h:3913
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:4626
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:5248
OwnArray< char * > GetEnvironmentVariables(EnvironmentParam env)
Get all variables in the environment.
Definition: SDL3pp_stdinc.h:1304
char * ltoa(long value, char *str, int radix)
Convert a long integer into a string.
Definition: SDL3pp_stdinc.h:3452
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen)
Concatenate wide strings.
Definition: SDL3pp_stdinc.h:2677
double atof(StringParam str)
Parse a double from a string.
Definition: SDL3pp_stdinc.h:3593
constexpr size_t ICONV_EINVAL
Incomplete input sequence was encountered.
Definition: SDL3pp_stdinc.h:6227
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:1817
long strtol(StringParam str, char **endp, int base)
Parse a long from a string.
Definition: SDL3pp_stdinc.h:3626
OwnArray< char > iconv_wchar_utf8(std::wstring_view S)
Convert a wchar_t string to UTF-8.
Definition: SDL3pp_stdinc.h:6324
char * strrchr(StringParam str, int c)
Search a string for the last instance of a specific byte.
Definition: SDL3pp_stdinc.h:3193
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:2586
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:2055
double fmod(double x, double y)
Return the floating-point remainder of x / y
Definition: SDL3pp_stdinc.h:5307
void * memcpy(void *dst, const void *src, size_t len)
Copy non-overlapping memory.
Definition: SDL3pp_stdinc.h:2358
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:1174
constexpr EnvironmentRef(const EnvironmentRef &other) noexcept=default
Copy constructor.
EnvironmentRef(EnvironmentParam resource) noexcept
Constructs from EnvironmentParam.
Definition: SDL3pp_stdinc.h:1184
~EnvironmentRef()
Destructor.
Definition: SDL3pp_stdinc.h:1205
EnvironmentRef(EnvironmentRaw resource) noexcept
Constructs from EnvironmentParam.
Definition: SDL3pp_stdinc.h:1196
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 auto operator<=>(const IConvParam &other) const =default
Comparison.
constexpr IConvParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_stdinc.h:103
IConvRaw value
parameter's IConvRaw
Definition: SDL3pp_stdinc.h:94
Semi-safe reference for IConv.
Definition: SDL3pp_stdinc.h:6097
~IConvRef()
Destructor.
Definition: SDL3pp_stdinc.h:6128
IConvRef(IConvParam resource) noexcept
Constructs from IConvParam.
Definition: SDL3pp_stdinc.h:6107
constexpr IConvRef(const IConvRef &other) noexcept=default
Copy constructor.
IConvRef(IConvRaw resource) noexcept
Constructs from IConvParam.
Definition: SDL3pp_stdinc.h:6119