class LineEditor
Declaration
class LineEditor { /* full declaration omitted */ };
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:22
Method Overview
- public LineEditor(llvm::StringRef ProgName, llvm::StringRef HistoryPath = "", FILE * In = stdin, FILE * Out = stdout, FILE * Err = stderr)
- public llvm::LineEditor::CompletionAction getCompletionAction(llvm::StringRef Buffer, size_t Pos) const
- public static std::string getDefaultHistoryPath(llvm::StringRef ProgName)
- public const std::string & getPrompt() const
- public void loadHistory()
- public llvm::Optional<std::string> readLine() const
- public void saveHistory()
- public template <typename T>void setCompleter(T Comp)
- public template <typename T>void setListCompleter(T Comp)
- public void setPrompt(const std::string & P)
- public ~LineEditor()
Methods
¶LineEditor(llvm::StringRef ProgName,
llvm::StringRef HistoryPath = "",
FILE* In = stdin,
FILE* Out = stdout,
FILE* Err = stderr)
LineEditor(llvm::StringRef ProgName,
llvm::StringRef HistoryPath = "",
FILE* In = stdin,
FILE* Out = stdout,
FILE* Err = stderr)
Description
Create a LineEditor object.
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:33
Parameters
- llvm::StringRef ProgName
- The name of the current program. Used to form a default prompt.
- llvm::StringRef HistoryPath = ""
- Path to the file in which to store history data, if possible.
- FILE* In = stdin
- The input stream used by the editor.
- FILE* Out = stdout
- The output stream used by the editor.
- FILE* Err = stderr
- The error stream used by the editor.
¶llvm::LineEditor::CompletionAction
getCompletionAction(llvm::StringRef Buffer,
size_t Pos) const
llvm::LineEditor::CompletionAction
getCompletionAction(llvm::StringRef Buffer,
size_t Pos) const
Description
Use the current completer to produce a CompletionAction for the given completion request. If the current completer is a list completer, this will return an AK_Insert CompletionAction if each completion has a common prefix, or an AK_ShowCompletions CompletionAction otherwise.
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:103
Parameters
- llvm::StringRef Buffer
- The string to complete
- size_t Pos
- The zero-based cursor position in the StringRef
¶static std::string getDefaultHistoryPath(
llvm::StringRef ProgName)
static std::string getDefaultHistoryPath(
llvm::StringRef ProgName)
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:45
Parameters
- llvm::StringRef ProgName
¶const std::string& getPrompt() const
const std::string& getPrompt() const
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:105
¶void loadHistory()
void loadHistory()
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:43
¶llvm::Optional<std::string> readLine() const
llvm::Optional<std::string> readLine() const
Description
Reads a line.
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:40
Returns
The line, or llvm::Optional <std ::string>() on EOF.
¶void saveHistory()
void saveHistory()
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:42
¶template <typename T>
void setCompleter(T Comp)
template <typename T>
void setCompleter(T Comp)
Description
Set the completer for this LineEditor. A 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 CompletionAction.
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:84
Templates
- T
Parameters
- T Comp
¶template <typename T>
void setListCompleter(T Comp)
template <typename T>
void setListCompleter(T Comp)
Description
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 <Completion >.
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:92
Templates
- T
Parameters
- T Comp
¶void setPrompt(const std::string& P)
void setPrompt(const std::string& P)
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:106
Parameters
- const std::string& P
¶~LineEditor()
~LineEditor()
Declared at: llvm/include/llvm/LineEditor/LineEditor.h:35