SDL_guid.h 3.3 KB

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