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_
17 // Other libraries and framework includes
20 #include "lldb/lldb-private.h"
22 namespace lldb_private {
27 // Most UUIDs are 16 bytes, but some Linux build-ids (SHA1) are 20.
28 typedef uint8_t ValueType[20];
30 //------------------------------------------------------------------
31 // Constructors and Destructors
32 //------------------------------------------------------------------
34 UUID (const UUID& rhs);
35 UUID (const void *uuid_bytes, uint32_t num_uuid_bytes);
40 operator=(const UUID& rhs);
46 Dump (Stream *s) const;
58 SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16);
61 GetAsString (const char *separator = NULL) const;
64 SetFromCString (const char *c_str, uint32_t num_uuid_bytes = 16);
66 // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
67 // This is used for auto completion where a partial UUID might have been
69 //------------------------------------------------------------------
70 /// Decode as many UUID bytes (up to 16) as possible from the C
74 /// A NULL terminate C string that points at a UUID string value
75 /// (no leading spaces). The string must contain only hex
76 /// characters and optionally can contain the '-' sepearators.
78 /// @param[in] uuid_bytes
79 /// A buffer of bytes that will contain a full or patially
83 /// If \a end is not NULL, it will be filled in with the a
84 /// pointer to the character after the last successfully decoded
88 /// Returns the number of bytes that were successfully decoded
89 /// which should be 16 if a full UUID value was properly decoded.
90 //------------------------------------------------------------------
92 DecodeUUIDBytesFromCString (const char *cstr, ValueType &uuid_bytes, const char **end, uint32_t num_uuid_bytes = 16);
95 //------------------------------------------------------------------
96 // Classes that inherit from UUID can see and modify these
97 //------------------------------------------------------------------
98 uint32_t m_num_uuid_bytes; // Should be 16 or 20
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);
106 bool operator > (const UUID &lhs, const UUID &rhs);
107 bool operator >= (const UUID &lhs, const UUID &rhs);
109 } // namespace lldb_private
111 #endif // liblldb_UUID_h_