LLDB  mainline
Public Types | Public Member Functions | Protected Attributes | List of all members
lldb_private::IOHandlerDelegate Class Referenceabstract

A delegate class for use with IOHandler subclasses. More...

#include <IOHandler.h>

Inheritance diagram for lldb_private::IOHandlerDelegate:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::IOHandlerDelegate:
Collaboration graph
[legend]

Public Types

enum  Completion { Completion::None, Completion::LLDBCommand, Completion::Expression }
 

Public Member Functions

 IOHandlerDelegate (Completion completion=Completion::None)
 
virtual ~IOHandlerDelegate ()=default
 
virtual void IOHandlerActivated (IOHandler &io_handler, bool interactive)
 
virtual void IOHandlerDeactivated (IOHandler &io_handler)
 
virtual int IOHandlerComplete (IOHandler &io_handler, const char *current_line, const char *cursor, const char *last_char, int skip_first_n_matches, int max_matches, StringList &matches, StringList &descriptions)
 
virtual const char * IOHandlerGetFixIndentationCharacters ()
 
virtual int IOHandlerFixIndentation (IOHandler &io_handler, const StringList &lines, int cursor_position)
 Called when a new line is created or one of an identified set of indentation characters is typed. More...
 
virtual void IOHandlerInputComplete (IOHandler &io_handler, std::string &data)=0
 Called when a line or lines have been retrieved. More...
 
virtual void IOHandlerInputInterrupted (IOHandler &io_handler, std::string &data)
 
virtual bool IOHandlerIsInputComplete (IOHandler &io_handler, StringList &lines)
 Called to determine whether typing enter after the last line in lines should end input. More...
 
virtual ConstString IOHandlerGetControlSequence (char ch)
 
virtual const char * IOHandlerGetCommandPrefix ()
 
virtual const char * IOHandlerGetHelpPrologue ()
 
virtual bool IOHandlerInterrupt (IOHandler &io_handler)
 

Protected Attributes

Completion m_completion
 

Detailed Description

A delegate class for use with IOHandler subclasses.

The IOHandler delegate is designed to be mixed into classes so they can use an IOHandler subclass to fetch input and notify the object that inherits from this delegate class when a token is received.

Definition at line 188 of file IOHandler.h.

Member Enumeration Documentation

◆ Completion

Enumerator
None 
LLDBCommand 
Expression 

Definition at line 190 of file IOHandler.h.

Constructor & Destructor Documentation

◆ IOHandlerDelegate()

lldb_private::IOHandlerDelegate::IOHandlerDelegate ( Completion  completion = Completion::None)
inline

Definition at line 192 of file IOHandler.h.

◆ ~IOHandlerDelegate()

virtual lldb_private::IOHandlerDelegate::~IOHandlerDelegate ( )
virtualdefault

Member Function Documentation

◆ IOHandlerActivated()

virtual void lldb_private::IOHandlerDelegate::IOHandlerActivated ( IOHandler io_handler,
bool  interactive 
)
inlinevirtual

◆ IOHandlerComplete()

int IOHandlerDelegate::IOHandlerComplete ( IOHandler io_handler,
const char *  current_line,
const char *  cursor,
const char *  last_char,
int  skip_first_n_matches,
int  max_matches,
StringList matches,
StringList descriptions 
)
virtual

◆ IOHandlerDeactivated()

virtual void lldb_private::IOHandlerDelegate::IOHandlerDeactivated ( IOHandler io_handler)
inlinevirtual

Definition at line 199 of file IOHandler.h.

Referenced by lldb_private::IOHandlerEditline::Deactivate().

◆ IOHandlerFixIndentation()

virtual int lldb_private::IOHandlerDelegate::IOHandlerFixIndentation ( IOHandler io_handler,
const StringList lines,
int  cursor_position 
)
inlinevirtual

Called when a new line is created or one of an identified set of indentation characters is typed.

This function determines how much indentation should be added or removed to match the recommended amount for the final line.

Parameters
[in]io_handlerThe IOHandler that responsible for input.
[in]linesThe current input up to the line to be corrected. Lines following the line containing the cursor are not included.
[in]cursor_positionThe number of characters preceding the cursor on the final line at the time.
Returns
Returns an integer describing the number of spaces needed to correct the indentation level. Positive values indicate that spaces should be added, while negative values represent spaces that should be removed.

Reimplemented in lldb_private::REPL.

Definition at line 230 of file IOHandler.h.

Referenced by lldb_private::IOHandlerEditline::GetLine().

◆ IOHandlerGetCommandPrefix()

virtual const char* lldb_private::IOHandlerDelegate::IOHandlerGetCommandPrefix ( )
inlinevirtual

Reimplemented in lldb_private::REPL.

Definition at line 274 of file IOHandler.h.

◆ IOHandlerGetControlSequence()

virtual ConstString lldb_private::IOHandlerDelegate::IOHandlerGetControlSequence ( char  ch)
inlinevirtual

◆ IOHandlerGetFixIndentationCharacters()

virtual const char* lldb_private::IOHandlerDelegate::IOHandlerGetFixIndentationCharacters ( )
inlinevirtual

Reimplemented in lldb_private::REPL.

Definition at line 206 of file IOHandler.h.

Referenced by lldb_private::IOHandlerEditline::IOHandlerEditline().

◆ IOHandlerGetHelpPrologue()

virtual const char* lldb_private::IOHandlerDelegate::IOHandlerGetHelpPrologue ( )
inlinevirtual

Reimplemented in lldb_private::REPL.

Definition at line 276 of file IOHandler.h.

◆ IOHandlerInputComplete()

virtual void lldb_private::IOHandlerDelegate::IOHandlerInputComplete ( IOHandler io_handler,
std::string &  data 
)
pure virtual

Called when a line or lines have been retrieved.

This function can handle the current line and possibly call IOHandler::SetIsDone(true) when the IO handler is done like when "quit" is entered as a command, of when an empty line is received. It is up to the delegate to determine when a line should cause a IOHandler to exit.

Implemented in CommandObjectTargetStopHookAdd, CommandObjectCommandsScriptAdd, CommandObjectCommandsAddRegex, lldb_private::CommandInterpreter, lldb_private::IOHandlerConfirm, CommandObjectTypeSynthAdd, lldb_private::ScriptInterpreterPythonImpl, CommandObjectBreakpointCommandAdd, CommandObjectWatchpointCommandAdd, CommandObjectTypeSummaryAdd, lldb_private::REPL, and lldb_private::CommandObjectExpression.

Referenced by lldb_private::IOHandlerEditline::Run().

◆ IOHandlerInputInterrupted()

virtual void lldb_private::IOHandlerDelegate::IOHandlerInputInterrupted ( IOHandler io_handler,
std::string &  data 
)
inlinevirtual

Reimplemented in lldb_private::REPL.

Definition at line 246 of file IOHandler.h.

Referenced by lldb_private::IOHandlerEditline::Run().

◆ IOHandlerInterrupt()

virtual bool lldb_private::IOHandlerDelegate::IOHandlerInterrupt ( IOHandler io_handler)
inlinevirtual

Reimplemented in lldb_private::CommandInterpreter, and lldb_private::REPL.

Definition at line 282 of file IOHandler.h.

Referenced by lldb_private::IOHandlerEditline::Interrupt().

◆ IOHandlerIsInputComplete()

virtual bool lldb_private::IOHandlerDelegate::IOHandlerIsInputComplete ( IOHandler io_handler,
StringList lines 
)
inlinevirtual

Called to determine whether typing enter after the last line in lines should end input.

This function will not be called on IOHandler objects that are getting single lines.

Parameters
[in]io_handlerThe IOHandler that responsible for updating the lines.
[in]linesThe current multi-line content. May be altered to provide alternative input when complete.
Returns
Return an boolean to indicate whether input is complete, true indicates that no additional input is necessary, while false indicates that more input is required.

Reimplemented in lldb_private::IOHandlerDelegateMultiline, lldb_private::REPL, and lldb_private::CommandObjectExpression.

Definition at line 263 of file IOHandler.h.

Referenced by lldb_private::IOHandlerEditline::GetLine(), and lldb_private::IOHandlerEditline::GetLines().

Member Data Documentation

◆ m_completion

Completion lldb_private::IOHandlerDelegate::m_completion
protected

Definition at line 285 of file IOHandler.h.

Referenced by IOHandlerComplete().


The documentation for this class was generated from the following files: