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