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
19
21using GUIDRaw = SDL_GUID;
22
23// Forward decl
24struct GUID;
25
43struct GUID : GUIDRaw
44{
50 constexpr GUID(const GUIDRaw& gUID = {}) noexcept
51 : GUIDRaw(gUID)
52 {
53 }
54
71 GUID(StringParam pchGUID);
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
129inline GUID::GUID(StringParam pchGUID)
130 : GUIDRaw(SDL_StringToGUID(pchGUID))
131{
132}
133
135
136} // namespace SDL
137
138#endif /* SDL3PP_GUID_H_ */
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
SDL_GUID GUIDRaw
Alias to raw representation for GUID.
Definition SDL3pp_guid.h:21
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
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
constexpr GUID(const GUIDRaw &gUID={}) noexcept
Wraps GUID.
Definition SDL3pp_guid.h:50