LLVM: llvm::LineEditor Class Reference (original) (raw)

#include "[llvm/LineEditor/LineEditor.h](LineEditor%5F8h%5Fsource.html)"

Classes
struct Completion
A possible completion at a given cursor position. More...
struct CompletionAction
The action to perform upon a completion request. More...
struct InternalData
Public Member Functions
LLVM_ABI LineEditor (StringRef ProgName, StringRef HistoryPath="", FILE *In=stdin, FILE *Out=stdout, FILE *Err=stderr)
Create a LineEditor object.
LLVM_ABI ~LineEditor ()
LLVM_ABI std::optional< std::string > readLine () const
Reads a line.
LLVM_ABI void saveHistory ()
LLVM_ABI void loadHistory ()
LLVM_ABI void setHistorySize (int size)
template<typename T>
void setCompleter (T Comp)
Set the completer for this LineEditor.
template<typename T>
void setListCompleter (T Comp)
Set the completer for this LineEditor to the given list completer.
LLVM_ABI CompletionAction getCompletionAction (StringRef Buffer, size_t Pos) const
Use the current completer to produce a CompletionAction for the given completion request.
const std::string & getPrompt () const
void setPrompt (const std::string &P)

Definition at line 23 of file LineEditor.h.

LineEditor::LineEditor ( StringRef ProgName,
StringRef HistoryPath = "",
FILE * In = stdin,
FILE * Out = stdout,
FILE * Err = stderr )

Create a LineEditor object.

Parameters

ProgName The name of the current program. Used to form a default prompt.
HistoryPath Path to the file in which to store history data, if possible.
In The input stream used by the editor.
Out The output stream used by the editor.
Err The error stream used by the editor.

Definition at line 287 of file LineEditor.cpp.

~LineEditor()

LineEditor::~LineEditor ( )

getCompletionAction()

getDefaultHistoryPath()

std::string LineEditor::getDefaultHistoryPath ( StringRef ProgName) static

getPrompt()

const std::string & llvm::LineEditor::getPrompt ( ) const inline

loadHistory()

void LineEditor::loadHistory ( )

readLine()

std::optional< std::string > LineEditor::readLine ( ) const

Reads a line.

Returns

The line, or std::optionalstd::string() on EOF.

Definition at line 302 of file LineEditor.cpp.

saveHistory()

void LineEditor::saveHistory ( )

setCompleter()

template<typename T>

void llvm::LineEditor::setCompleter ( T Comp) inline

setHistorySize()

void LineEditor::setHistorySize ( int size )

setListCompleter()

template<typename T>

void llvm::LineEditor::setListCompleter ( T Comp) inline

Set the completer for this LineEditor to the given list completer.

A list completer is a function object which takes arguments of type StringRef (the string to complete) and size_t (the zero-based cursor position in the StringRef) and returns a std::vector.

Definition at line 94 of file LineEditor.h.

References T.

setPrompt()

void llvm::LineEditor::setPrompt ( const std::string & P) inline

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