1 //===-- SBInputReader.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_SBInputReader_h_ 11 #define LLDB_SBInputReader_h_ 12 13 #include "lldb/API/SBDefines.h" 14 15 namespace lldb { 16 17 class SBInputReader 18 { 19 public: 20 21 typedef size_t (*Callback) (void *baton, 22 SBInputReader *reader, 23 InputReaderAction notification, 24 const char *bytes, 25 size_t bytes_len); 26 27 SBInputReader (); 28 29 SBInputReader (const lldb::InputReaderSP &reader_sp); 30 31 SBInputReader (const lldb::SBInputReader &rhs); 32 33 ~SBInputReader (); 34 35 36 SBError 37 Initialize (SBDebugger &debugger, 38 Callback callback, 39 void *callback_baton, 40 lldb::InputReaderGranularity granularity, 41 const char *end_token, 42 const char *prompt, 43 bool echo); 44 45 bool 46 IsValid () const; 47 48 const lldb::SBInputReader & 49 operator = (const lldb::SBInputReader &rhs); 50 51 bool 52 IsActive () const; 53 54 bool 55 IsDone () const; 56 57 void 58 SetIsDone (bool value); 59 60 InputReaderGranularity 61 GetGranularity (); 62 63 protected: 64 friend class SBDebugger; 65 66 lldb_private::InputReader * 67 operator->() const; 68 69 lldb::InputReaderSP & 70 operator *(); 71 72 const lldb::InputReaderSP & 73 operator *() const; 74 75 lldb_private::InputReader * 76 get() const; 77 78 lldb_private::InputReader & 79 ref() const; 80 81 private: 82 83 static size_t 84 PrivateCallback (void *baton, 85 lldb_private::InputReader &reader, 86 lldb::InputReaderAction notification, 87 const char *bytes, 88 size_t bytes_len); 89 90 lldb::InputReaderSP m_opaque_sp; 91 Callback m_callback_function; 92 void *m_callback_baton; 93 }; 94 95 } // namespace lldb 96 97 #endif // LLDB_SBInputReader_h_ 98