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
41struct GUID : SDL_GUID
42{
43 constexpr GUID()
44 : SDL_GUID({0})
45 {
46 }
47
49 constexpr GUID(SDL_GUID guid)
50 : SDL_GUID(guid)
51 {
52 }
53
70 : SDL_GUID(SDL_StringToGUID(pchGUID))
71 {
72 }
73
85 std::string ToString() const
86 {
87 std::string result(32, ' ');
88 SDL_GUIDToString(*this, result.data(), 33);
89 return result;
90 }
91};
92
106inline void GUIDToString(SDL_GUID guid, char* pszGUID, int cbGUID)
107{
108 return SDL_GUIDToString(guid, pszGUID, cbGUID);
109}
110
127inline SDL_GUID StringToGUID(StringParam pchGUID)
128{
129 return SDL_StringToGUID(pchGUID);
130}
131
133
134} // namespace SDL
135
136#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:127
void GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
Get an ASCII string representation for a given SDL_GUID.
Definition SDL3pp_guid.h:106
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
An GUID is a 128-bit identifier for an input device that identifies that device across runs of SDL pr...
Definition SDL3pp_guid.h:42
constexpr GUID(SDL_GUID guid)
Constructor from underling type.
Definition SDL3pp_guid.h:49
GUID(StringParam pchGUID)
Convert a GUID string into a GUID structure.
Definition SDL3pp_guid.h:69
std::string ToString() const
Get an ASCII string representation for a given GUID.
Definition SDL3pp_guid.h:85