nsguid.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef _NSGUID_H
  2. #define _NSGUID_H
  3. #include "platform/guid.h"
  4. //#include <bfc/common.h>
  5. // Some conversion functions to allow
  6. // us to have GUIDs translatable to and from other data types.
  7. class nsGUID {
  8. public:
  9. // To the "Human Readable" character format.
  10. // {1B3CA60C-DA98-4826-B4A9-D79748A5FD73}
  11. static char *toChar(const GUID &guid, char *target);
  12. static wchar_t *toCharW(const GUID &guid, wchar_t *target);
  13. static GUID fromCharW(const wchar_t *source);
  14. // To the "C Structure" character format.
  15. // { 0x1b3ca60c, 0xda98, 0x4826, { 0xb4, 0xa9, 0xd7, 0x97, 0x48, 0xa5, 0xfd, 0x73 } };
  16. static char *toCode(const GUID &guid, char *target);
  17. static GUID fromCode(const char *source);
  18. // Compare function, returns -1, 0, 1
  19. static int compare(const GUID &a, const GUID &b);
  20. // strlen("{xx xxx xxx-xxxx-xxxx-xxxx-xxx xxx xxx xxx}"
  21. enum { GUID_STRLEN = 38 };
  22. #ifdef WASABI_COMPILE_CREATEGUID
  23. static void createGuid(GUID *g);
  24. #endif
  25. };
  26. inline
  27. int operator <(const GUID &a, const GUID &b) {
  28. return (nsGUID::compare(a, b) < 0);
  29. }
  30. #endif //_NSGUID_H