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
19 #include "lldb/lldb-private.h"
21 namespace lldb_private {
26 // Most UUIDs are 16 bytes, but some Linux build-ids (SHA1) are 20.
27 typedef uint8_t ValueType[20];
29 //------------------------------------------------------------------
30 // Constructors and Destructors
31 //------------------------------------------------------------------
33 UUID (const UUID& rhs);
34 UUID (const void *uuid_bytes, uint32_t num_uuid_bytes);
39 operator=(const UUID& rhs);
45 Dump (Stream *s) const;
57 SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16);
60 GetAsString(const char *separator = nullptr) const;
63 SetFromCString (const char *c_str, uint32_t num_uuid_bytes = 16);
65 // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
66 // This is used for auto completion where a partial UUID might have been
68 //------------------------------------------------------------------
69 /// Decode as many UUID bytes (up to 16) as possible from the C
73 /// A NULL terminate C string that points at a UUID string value
74 /// (no leading spaces). The string must contain only hex
75 /// characters and optionally can contain the '-' sepearators.
77 /// @param[in] uuid_bytes
78 /// A buffer of bytes that will contain a full or patially
82 /// If \a end is not nullptr, it will be filled in with the a
83 /// pointer to the character after the last successfully decoded
87 /// Returns the number of bytes that were successfully decoded
88 /// which should be 16 if a full UUID value was properly decoded.
89 //------------------------------------------------------------------
91 DecodeUUIDBytesFromCString (const char *cstr, ValueType &uuid_bytes, const char **end, uint32_t num_uuid_bytes = 16);
94 //------------------------------------------------------------------
95 // Classes that inherit from UUID can see and modify these
96 //------------------------------------------------------------------
97 uint32_t m_num_uuid_bytes; // Should be 16 or 20
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);
106 bool operator >= (const UUID &lhs, const UUID &rhs);
108 } // namespace lldb_private
110 #endif // liblldb_UUID_h_