SDL 3.0
SDL_guid.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/* WIKI CATEGORY: GUID */
23
24/**
25 * # CategoryGUID
26 *
27 * A GUID is a 128-bit value that represents something that is uniquely
28 * identifiable by this value: "globally unique."
29 */
30
31#ifndef SDL_guid_h_
32#define SDL_guid_h_
33
34#include <SDL3/SDL_stdinc.h>
35
36#include <SDL3/SDL_begin_code.h>
37/* Set up for C function definitions, even when using C++ */
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/**
43 * An SDL_GUID is a 128-bit identifier for an input device that identifies
44 * that device across runs of SDL programs on the same platform.
45 *
46 * If the device is detached and then re-attached to a different port, or if
47 * the base system is rebooted, the device should still report the same GUID.
48 *
49 * GUIDs are as precise as possible but are not guaranteed to distinguish
50 * physically distinct but equivalent devices. For example, two game
51 * controllers from the same vendor with the same product ID and revision may
52 * have the same GUID.
53 *
54 * GUIDs may be platform-dependent (i.e., the same device may report different
55 * GUIDs on different operating systems).
56 *
57 * \since This struct is available since SDL 3.1.3.
58 */
59typedef struct SDL_GUID {
61} SDL_GUID;
62
63/* Function prototypes */
64
65/**
66 * Get an ASCII string representation for a given SDL_GUID.
67 *
68 * \param guid the SDL_GUID you wish to convert to string.
69 * \param pszGUID buffer in which to write the ASCII string.
70 * \param cbGUID the size of pszGUID, should be at least 33 bytes.
71 *
72 * \since This function is available since SDL 3.1.3.
73 *
74 * \sa SDL_StringToGUID
75 */
76extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
77
78/**
79 * Convert a GUID string into a SDL_GUID structure.
80 *
81 * Performs no error checking. If this function is given a string containing
82 * an invalid GUID, the function will silently succeed, but the GUID generated
83 * will not be useful.
84 *
85 * \param pchGUID string containing an ASCII representation of a GUID.
86 * \returns a SDL_GUID structure.
87 *
88 * \since This function is available since SDL 3.1.3.
89 *
90 * \sa SDL_GUIDToString
91 */
92extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID);
93
94/* Ends C function definitions when using C++ */
95#ifdef __cplusplus
96}
97#endif
98#include <SDL3/SDL_close_code.h>
99
100#endif /* SDL_guid_h_ */
void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
SDL_GUID SDL_StringToGUID(const char *pchGUID)
uint8_t Uint8
Definition: SDL_stdinc.h:334
Uint8 data[16]
Definition: SDL_guid.h:60