1 //===-- UUID.h --------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_UUID_h_
11 #define liblldb_UUID_h_
15 // Other libraries and framework includes
18 #include "lldb/lldb-private.h"
20 namespace lldb_private {
25 // Most UUIDs are 16 bytes, but some Linux build-ids (SHA1) are 20.
26 typedef uint8_t ValueType[20];
28 //------------------------------------------------------------------
29 // Constructors and Destructors
30 //------------------------------------------------------------------
32 UUID (const UUID& rhs);
33 UUID (const void *uuid_bytes, uint32_t num_uuid_bytes);
38 operator=(const UUID& rhs);
44 Dump (Stream *s) const;
56 SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16);
59 GetAsString (const char *separator = NULL) const;
62 SetFromCString (const char *c_str, uint32_t num_uuid_bytes = 16);
64 // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
65 // This is used for auto completion where a partial UUID might have been
67 //------------------------------------------------------------------
68 /// Decode as many UUID bytes (up to 16) as possible from the C
72 /// A NULL terminate C string that points at a UUID string value
73 /// (no leading spaces). The string must contain only hex
74 /// characters and optionally can contain the '-' sepearators.
76 /// @param[in] uuid_bytes
77 /// A buffer of bytes that will contain a full or patially
81 /// If \a end is not NULL, it will be filled in with the a
82 /// pointer to the character after the last successfully decoded
86 /// Returns the number of bytes that were successfully decoded
87 /// which should be 16 if a full UUID value was properly decoded.
88 //------------------------------------------------------------------
90 DecodeUUIDBytesFromCString (const char *cstr, ValueType &uuid_bytes, const char **end, uint32_t num_uuid_bytes = 16);
93 //------------------------------------------------------------------
94 // Classes that inherit from UUID can see and modify these
95 //------------------------------------------------------------------
96 uint32_t m_num_uuid_bytes; // Should be 16 or 20
100 bool operator == (const UUID &lhs, const UUID &rhs);
101 bool operator != (const UUID &lhs, const UUID &rhs);
102 bool operator < (const UUID &lhs, const UUID &rhs);
103 bool operator <= (const UUID &lhs, const UUID &rhs);
104 bool operator > (const UUID &lhs, const UUID &rhs);
105 bool operator >= (const UUID &lhs, const UUID &rhs);
107 } // namespace lldb_private
109 #endif // liblldb_UUID_h_