1 //===-- SBEvent.h -----------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBEvent_h_
11 #define LLDB_SBEvent_h_
12 
13 #include "lldb/API/SBDefines.h"
14 
15 #include <stdio.h>
16 #include <vector>
17 
18 namespace lldb {
19 
20 class SBBroadcaster;
21 
22 class LLDB_API SBEvent {
23 public:
24   SBEvent();
25 
26   SBEvent(const lldb::SBEvent &rhs);
27 
28   // Make an event that contains a C string.
29   SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len);
30 
31   SBEvent(lldb::EventSP &event_sp);
32 
33   SBEvent(lldb_private::Event *event_sp);
34 
35   ~SBEvent();
36 
37   const SBEvent &operator=(const lldb::SBEvent &rhs);
38 
39   bool IsValid() const;
40 
41   const char *GetDataFlavor();
42 
43   uint32_t GetType() const;
44 
45   lldb::SBBroadcaster GetBroadcaster() const;
46 
47   const char *GetBroadcasterClass() const;
48 
49   bool BroadcasterMatchesPtr(const lldb::SBBroadcaster *broadcaster);
50 
51   bool BroadcasterMatchesRef(const lldb::SBBroadcaster &broadcaster);
52 
53   void Clear();
54 
55   static const char *GetCStringFromEvent(const lldb::SBEvent &event);
56 
57   bool GetDescription(lldb::SBStream &description);
58 
59   bool GetDescription(lldb::SBStream &description) const;
60 
61 protected:
62   friend class SBListener;
63   friend class SBBroadcaster;
64   friend class SBBreakpoint;
65   friend class SBDebugger;
66   friend class SBProcess;
67   friend class SBTarget;
68   friend class SBThread;
69   friend class SBWatchpoint;
70 
71   lldb::EventSP &GetSP() const;
72 
73   void reset(lldb::EventSP &event_sp);
74 
75   void reset(lldb_private::Event *event);
76 
77   lldb_private::Event *get() const;
78 
79 private:
80   mutable lldb::EventSP m_event_sp;
81   mutable lldb_private::Event *m_opaque_ptr;
82 };
83 
84 } // namespace lldb
85 
86 #endif // LLDB_SBEvent_h_
87