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
23// Forward decl
24struct GUID;
25
43struct GUID : GUIDRaw
44{
50 constexpr GUID(const GUIDRaw& gUID = {})
51 : GUIDRaw(gUID)
52 {
53 }
54
72 : GUIDRaw(SDL_StringToGUID(pchGUID))
73 {
74 }
75
87 std::string ToString() const;
88};
89
102inline std::string GUIDToString(const GUIDRaw& guid)
103{
104 std::string result(32, ' ');
105 SDL_GUIDToString(guid, result.data(), 33);
106 return result;
107}
108
109inline std::string GUID::ToString() const { return SDL::GUIDToString(*this); }
110
128{
129 return GUID(std::move(pchGUID));
130}
131
133
134} // namespace SDL
135
136#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:127
std::string GUIDToString(const GUIDRaw &guid)
Get an ASCII string representation for a given GUID.
Definition: SDL3pp_guid.h:102
std::string ToString() const
Get an ASCII string representation for a given GUID.
Definition: SDL3pp_guid.h:109
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:44
GUID(StringParam pchGUID)
Convert a GUID string into a GUID structure.
Definition: SDL3pp_guid.h:71
constexpr GUID(const GUIDRaw &gUID={})
Wraps GUID.
Definition: SDL3pp_guid.h:50