1 /* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 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 "SDL_stdinc.h" 35 #include "SDL_error.h" 36 37 #include "begin_code.h" 38 /* Set up for C function definitions, even when using C++ */ 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /** 44 * An SDL_GUID is a 128-bit identifier. 45 * 46 * This is an acronym for "Globally Unique ID." 47 * 48 * While a GUID can be used to assign a unique value to almost anything, in 49 * SDL these are largely used to identify input devices across runs of SDL 50 * programs on the same platform.If the device is detached and then 51 * re-attached to a different port, or if the base system is rebooted, the 52 * device should still report the same GUID. 53 * 54 * GUIDs are as precise as possible but are not guaranteed to distinguish 55 * physically distinct but equivalent devices. For example, two game 56 * controllers from the same vendor with the same product ID and revision may 57 * have the same GUID. 58 * 59 * GUIDs may be platform-dependent (i.e., the same device may report different 60 * GUIDs on different operating systems). 61 */ 62 typedef struct SDL_GUID { 63 Uint8 data[16]; 64 } SDL_GUID; 65 66 /* Function prototypes */ 67 68 /** 69 * Get an ASCII string representation for a given SDL_GUID. 70 * 71 * You should supply at least 33 bytes for pszGUID. 72 * 73 * \param guid the SDL_GUID you wish to convert to string. 74 * \param pszGUID buffer in which to write the ASCII string. 75 * \param cbGUID the size of pszGUID. 76 * 77 * \since This function is available since SDL 2.24.0. 78 * 79 * \sa SDL_GUIDFromString 80 */ 81 extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); 82 83 /** 84 * Convert a GUID string into a SDL_GUID structure. 85 * 86 * Performs no error checking. If this function is given a string containing 87 * an invalid GUID, the function will silently succeed, but the GUID generated 88 * will not be useful. 89 * 90 * \param pchGUID string containing an ASCII representation of a GUID. 91 * \returns a SDL_GUID structure. 92 * 93 * \since This function is available since SDL 2.24.0. 94 * 95 * \sa SDL_GUIDToString 96 */ 97 extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID); 98 99 /* Ends C function definitions when using C++ */ 100 #ifdef __cplusplus 101 } 102 #endif 103 #include "close_code.h" 104 105 #endif /* SDL_guid_h_ */ 106 107 /* vi: set ts=4 sw=4 expandtab: */