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