xref: /freebsd/contrib/llvm-project/lldb/include/lldb/API/SBEvent.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===-- SBEvent.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_API_SBEVENT_H
10 #define LLDB_API_SBEVENT_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 #include <cstdio>
15 #include <vector>
16 
17 namespace lldb_private {
18 class ScriptInterpreter;
19 namespace python {
20 class SWIGBridge;
21 }
22 } // namespace lldb_private
23 
24 namespace lldb {
25 
26 class SBBroadcaster;
27 
28 class LLDB_API SBEvent {
29 public:
30   SBEvent();
31 
32   SBEvent(const lldb::SBEvent &rhs);
33 
34   // Make an event that contains a C string.
35   SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len);
36 
37   ~SBEvent();
38 
39   const SBEvent &operator=(const lldb::SBEvent &rhs);
40 
41   explicit operator bool() const;
42 
43   bool IsValid() const;
44 
45   const char *GetDataFlavor();
46 
47   uint32_t GetType() const;
48 
49   lldb::SBBroadcaster GetBroadcaster() const;
50 
51   const char *GetBroadcasterClass() const;
52 
53 #ifndef SWIG
54   bool BroadcasterMatchesPtr(const lldb::SBBroadcaster *broadcaster);
55 #endif
56 
57   bool BroadcasterMatchesRef(const lldb::SBBroadcaster &broadcaster);
58 
59   void Clear();
60 
61   static const char *GetCStringFromEvent(const lldb::SBEvent &event);
62 
63   bool GetDescription(lldb::SBStream &description);
64 
65   bool GetDescription(lldb::SBStream &description) const;
66 
67 protected:
68   friend class SBListener;
69   friend class SBBroadcaster;
70   friend class SBBreakpoint;
71   friend class SBDebugger;
72   friend class SBProcess;
73   friend class SBTarget;
74   friend class SBThread;
75   friend class SBWatchpoint;
76 
77   friend class lldb_private::ScriptInterpreter;
78   friend class lldb_private::python::SWIGBridge;
79 
80   SBEvent(lldb::EventSP &event_sp);
81 
82   SBEvent(lldb_private::Event *event);
83 
84   lldb::EventSP &GetSP() const;
85 
86   void reset(lldb::EventSP &event_sp);
87 
88   void reset(lldb_private::Event *event);
89 
90   lldb_private::Event *get() const;
91 
92 private:
93   mutable lldb::EventSP m_event_sp;
94   mutable lldb_private::Event *m_opaque_ptr = nullptr;
95 };
96 
97 } // namespace lldb
98 
99 #endif // LLDB_API_SBEVENT_H
100