SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_guid.h
1#ifndef SDL3PP_GUID_H_
2#define SDL3PP_GUID_H_
3
4#include <SDL3/SDL_guid.h>
5#include "SDL3pp_stdinc.h"
6
7namespace SDL {
8
40struct GUID : SDL_GUID
41{
42 constexpr GUID()
43 : SDL_GUID({0})
44 {
45 }
46
48 constexpr GUID(SDL_GUID guid)
49 : SDL_GUID(guid)
50 {
51 }
52
69 : SDL_GUID(SDL_StringToGUID(pchGUID))
70 {
71 }
72
84 std::string ToString() const
85 {
86 std::string result(32, ' ');
87 SDL_GUIDToString(*this, result.data(), 33);
88 return result;
89 }
90};
91
105inline void GUIDToString(SDL_GUID guid, char* pszGUID, int cbGUID)
106{
107 return SDL_GUIDToString(guid, pszGUID, cbGUID);
108}
109
126inline SDL_GUID StringToGUID(StringParam pchGUID)
127{
128 return SDL_StringToGUID(pchGUID);
129}
130
132
133} // namespace SDL
134
135#endif /* SDL3PP_GUID_H_ */
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
SDL_GUID StringToGUID(StringParam pchGUID)
Convert a GUID string into a SDL_GUID structure.
Definition SDL3pp_guid.h:126
void GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
Get an ASCII string representation for a given SDL_GUID.
Definition SDL3pp_guid.h:105
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
A GUID is a 128-bit identifier for an input device that identifies that device across runs of SDL pro...
Definition SDL3pp_guid.h:41
constexpr GUID(SDL_GUID guid)
Constructor from underling type.
Definition SDL3pp_guid.h:48
GUID(StringParam pchGUID)
Convert a GUID string into a GUID structure.
Definition SDL3pp_guid.h:68
std::string ToString() const
Get an ASCII string representation for a given GUID.
Definition SDL3pp_guid.h:84