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
21using GUIDRaw = SDL_GUID;
22
40struct GUID : GUIDRaw
41{
47 constexpr GUID(const GUIDRaw& gUID = {})
48 : GUIDRaw(gUID)
49 {
50 }
51
69 : GUIDRaw(SDL_StringToGUID(pchGUID))
70 {
71 }
72
84 std::string ToString() const;
85};
86
99inline std::string GUIDToString(const GUIDRaw& guid)
100{
101 std::string result(32, ' ');
102 SDL_GUIDToString(guid, result.data(), 33);
103 return result;
104}
105
106inline std::string GUID::ToString() const { return SDL::GUIDToString(*this); }
107
125{
126 return GUID(std::move(pchGUID));
127}
128
130
131} // namespace SDL
132
133#endif /* SDL3PP_GUID_H_ */
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
GUID StringToGUID(StringParam pchGUID)
Convert a GUID string into a GUID structure.
Definition: SDL3pp_guid.h:124
std::string GUIDToString(const GUIDRaw &guid)
Get an ASCII string representation for a given GUID.
Definition: SDL3pp_guid.h:99
std::string ToString() const
Get an ASCII string representation for a given GUID.
Definition: SDL3pp_guid.h:106
SDL_GUID GUIDRaw
Alias to raw representation for GUID.
Definition: SDL3pp_guid.h:21
Main include header for the SDL3pp library.
An GUID is a 128-bit identifier for an input device that identifies that device across runs of SDL pr...
Definition: SDL3pp_guid.h:41
GUID(StringParam pchGUID)
Convert a GUID string into a GUID structure.
Definition: SDL3pp_guid.h:68
constexpr GUID(const GUIDRaw &gUID={})
Wraps GUID.
Definition: SDL3pp_guid.h:47