OpenTTD Source 20241224-master-gee860a5c8e
AutoCompletion Class Referenceabstract
Inheritance diagram for AutoCompletion:
ConsoleAutoCompletion NetworkChatAutoCompletion

Public Member Functions

 AutoCompletion (Textbuf *textbuf)
 
bool AutoComplete ()
 
void Reset ()
 

Protected Attributes

Textbuftextbuf
 

Private Member Functions

void InitSuggestions (std::string_view text)
 
virtual std::vector< std::string > GetSuggestions (std::string_view prefix, std::string_view query)=0
 
virtual void ApplySuggestion (std::string_view prefix, std::string_view suggestion)=0
 

Private Attributes

std::string initial_buf
 Value of text buffer when we started current suggestion session.
 
std::string_view prefix
 Prefix of the text before the last space.
 
std::string_view query
 Last token of the text. This is used to based the suggestions on.
 
std::vector< std::string > suggestions
 
size_t current_suggestion_index
 

Detailed Description

Definition at line 15 of file autocompletion.h.

Constructor & Destructor Documentation

◆ AutoCompletion()

AutoCompletion::AutoCompletion ( Textbuf textbuf)
inline

Definition at line 29 of file autocompletion.h.

Member Function Documentation

◆ AutoComplete()

bool AutoCompletion::AutoComplete ( )

Definition at line 20 of file autocompletion.cpp.

◆ InitSuggestions()

void AutoCompletion::InitSuggestions ( std::string_view  text)
private

Definition at line 52 of file autocompletion.cpp.

◆ Reset()

void AutoCompletion::Reset ( )

Definition at line 43 of file autocompletion.cpp.

Field Documentation

◆ current_suggestion_index

size_t AutoCompletion::current_suggestion_index
private

Definition at line 26 of file autocompletion.h.

◆ initial_buf

std::string AutoCompletion::initial_buf
private

Value of text buffer when we started current suggestion session.

Definition at line 20 of file autocompletion.h.

◆ prefix

std::string_view AutoCompletion::prefix
private

Prefix of the text before the last space.

Definition at line 22 of file autocompletion.h.

◆ query

std::string_view AutoCompletion::query
private

Last token of the text. This is used to based the suggestions on.

Definition at line 23 of file autocompletion.h.

◆ suggestions

std::vector<std::string> AutoCompletion::suggestions
private

Definition at line 25 of file autocompletion.h.

◆ textbuf

Textbuf* AutoCompletion::textbuf
protected

Definition at line 17 of file autocompletion.h.


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