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]

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

Member Enumeration Documentation

◆ Completion

Enumerator
None 
LLDBCommand 
Expression 

Definition at line 191 of file IOHandler.h.

Constructor & Destructor Documentation

◆ IOHandlerDelegate()

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

Definition at line 193 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()

void IOHandlerDelegate::IOHandlerComplete ( IOHandler io_handler,
CompletionRequest request 
)
virtual

◆ IOHandlerDeactivated()

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

Definition at line 200 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 232 of file IOHandler.h.

◆ IOHandlerGetCommandPrefix()

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

Reimplemented in lldb_private::REPL.

Definition at line 274 of file IOHandler.h.

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

◆ 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 208 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.

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

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

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 248 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::REPL, and lldb_private::CommandInterpreter.

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

Definition at line 265 of file IOHandler.h.

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

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

Referenced by IOHandlerComplete().


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