LLDB mainline
lldb_private::IOHandlerDelegate Class Referenceabstract

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

#include <IOHandler.h>

Inheritance diagram for lldb_private::IOHandlerDelegate:
[legend]

Public Types

enum class  Completion { None , LLDBCommand , 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 std::optional< std::string > IOHandlerSuggestion (IOHandler &io_handler, llvm::StringRef line)
virtual void IOHandlerComplete (IOHandler &io_handler, CompletionRequest &request)
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.
virtual void IOHandlerInputComplete (IOHandler &io_handler, std::string &data)=0
 Called when a line or lines have been retrieved.
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.
virtual llvm::StringRef 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 184 of file IOHandler.h.

Member Enumeration Documentation

◆ Completion

Enumerator
None 
LLDBCommand 
Expression 

Definition at line 186 of file IOHandler.h.

Constructor & Destructor Documentation

◆ IOHandlerDelegate()

◆ ~IOHandlerDelegate()

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

Member Function Documentation

◆ IOHandlerActivated()

◆ IOHandlerComplete()

◆ IOHandlerDeactivated()

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

Definition at line 195 of file IOHandler.h.

◆ 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 227 of file IOHandler.h.

◆ IOHandlerGetCommandPrefix()

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

Reimplemented in lldb_private::REPL.

Definition at line 269 of file IOHandler.h.

◆ IOHandlerGetControlSequence()

virtual llvm::StringRef lldb_private::IOHandlerDelegate::IOHandlerGetControlSequence ( char ch)
inlinevirtual

◆ IOHandlerGetFixIndentationCharacters()

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

Reimplemented in lldb_private::REPL.

Definition at line 203 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 271 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 CommandObjectBreakpointCommandAdd, CommandObjectCommandsAddRegex, CommandObjectCommandsScriptAdd, CommandObjectTargetStopHookAdd, CommandObjectTypeSummaryAdd, CommandObjectTypeSynthAdd, CommandObjectWatchpointCommandAdd, IOHandlerLuaInterpreter, lldb_private::CommandInterpreter, lldb_private::CommandObjectExpression, lldb_private::IOHandlerConfirm, and lldb_private::REPL.

◆ IOHandlerInputInterrupted()

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

Reimplemented in lldb_private::REPL.

Definition at line 243 of file IOHandler.h.

◆ IOHandlerInterrupt()

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

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

Definition at line 277 of file IOHandler.h.

◆ 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 IOHandlerLuaInterpreter, lldb_private::CommandObjectExpression, lldb_private::IOHandlerDelegateMultiline, and lldb_private::REPL.

Definition at line 260 of file IOHandler.h.

◆ IOHandlerSuggestion()

std::optional< std::string > IOHandlerDelegate::IOHandlerSuggestion ( IOHandler & io_handler,
llvm::StringRef line )
virtual

Member Data Documentation

◆ m_completion

Completion lldb_private::IOHandlerDelegate::m_completion
protected

Definition at line 280 of file IOHandler.h.

Referenced by IOHandlerComplete(), and IOHandlerDelegate().


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