LLDB mainline
UserID.h
Go to the documentation of this file.
1//===-- UserID.h ------------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_UTILITY_USERID_H
10#define LLDB_UTILITY_USERID_H
11
12#include "lldb/lldb-defines.h"
13#include "lldb/lldb-types.h"
14
15namespace lldb_private {
16class Stream;
17
18/// \class UserID UserID.h "lldb/Core/UserID.h"
19/// A mix in class that contains a generic user ID.
20///
21/// UserID is designed as a mix in class that can contain an integer based
22/// unique identifier for a variety of objects in lldb.
23///
24/// The value for this identifier is chosen by each parser plug-in. A value
25/// should be chosen that makes sense for each kind of object and should allow
26/// quick access to further and more in depth parsing.
27///
28/// Symbol table entries can use this to store the original symbol table
29/// index, functions can use it to store the symbol table index or the
30/// DWARF offset.
31struct UserID {
32 /// Construct with optional user ID.
34
35 /// Destructor.
36 ~UserID() = default;
37
38 /// Clears the object state.
39 ///
40 /// Clears the object contents back to a default invalid state.
42
43 /// Get accessor for the user ID.
44 ///
45 /// \return
46 /// The user ID.
47 lldb::user_id_t GetID() const { return m_uid; }
48
49 /// Set accessor for the user ID.
50 ///
51 /// \param[in] uid
52 /// The new user ID.
53 void SetID(lldb::user_id_t uid) { m_uid = uid; }
54
55protected:
56 // Member variables.
57 lldb::user_id_t m_uid; ///< The user ID that uniquely identifies an object.
58};
59
60inline bool operator==(const UserID &lhs, const UserID &rhs) {
61 return lhs.GetID() == rhs.GetID();
62}
63
64inline bool operator!=(const UserID &lhs, const UserID &rhs) {
65 return lhs.GetID() != rhs.GetID();
66}
67
68/// Stream the UserID object to a Stream.
69Stream &operator<<(Stream &strm, const UserID &uid);
70
71} // namespace lldb_private
72
73#endif // LLDB_UTILITY_USERID_H
A stream class that can stream formatted output to a file.
Definition Stream.h:28
#define LLDB_INVALID_UID
A class that represents a running process on the host machine.
bool operator!=(const Address &lhs, const Address &rhs)
Definition Address.cpp:1017
Stream & operator<<(Stream &s, const Mangled &obj)
bool operator==(const Address &lhs, const Address &rhs)
Definition Address.cpp:1011
uint64_t user_id_t
Definition lldb-types.h:82
A mix in class that contains a generic user ID.
Definition UserID.h:31
~UserID()=default
Destructor.
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33
lldb::user_id_t m_uid
The user ID that uniquely identifies an object.
Definition UserID.h:57
void Clear()
Clears the object state.
Definition UserID.h:41
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition UserID.h:47
void SetID(lldb::user_id_t uid)
Set accessor for the user ID.
Definition UserID.h:53