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