OpenTTD Source 20260421-master-gc2fbc6fdeb
NetworkChatAutoCompletion Class Referencefinal

Implementation of AutoCompletion for nicknames and town names in the chat. More...

Inheritance diagram for NetworkChatAutoCompletion:
AutoCompletion

Public Member Functions

 AutoCompletion (Textbuf *textbuf)
Public Member Functions inherited from AutoCompletion
 AutoCompletion (Textbuf *textbuf)
virtual ~AutoCompletion ()=default
 Ensure the destructor of the sub classes are called as well.
bool AutoComplete ()
void Reset ()

Private Member Functions

std::vector< std::string > GetSuggestions (std::string_view prefix, std::string_view query) override
 Get suggestions for auto completion with the given 'query' input text.
void ApplySuggestion (std::string_view prefix, std::string_view suggestion) override
 Format the given suggestion after the given prefix, and write that to the buffer.

Additional Inherited Members

Protected Attributes inherited from AutoCompletion
Textbuftextbuf

Detailed Description

Implementation of AutoCompletion for nicknames and town names in the chat.

Definition at line 273 of file network_chat_gui.cpp.

Member Function Documentation

◆ ApplySuggestion()

void NetworkChatAutoCompletion::ApplySuggestion ( std::string_view prefix,
std::string_view suggestion )
inlineoverrideprivatevirtual

Format the given suggestion after the given prefix, and write that to the buffer.

For example, in case of a name in chat format '{name}: ' when the prefix is empty, otherwise '{prefix}{name}'.

Parameters
prefixThe text before the token that was auto completed on.
suggestionThe chosen suggestion.

Implements AutoCompletion.

Definition at line 296 of file network_chat_gui.cpp.

References AutoCompletion::prefix.

◆ AutoCompletion()

AutoCompletion::AutoCompletion ( Textbuf * textbuf)
inline

Definition at line 29 of file autocompletion.h.

◆ GetSuggestions()

std::vector< std::string > NetworkChatAutoCompletion::GetSuggestions ( std::string_view prefix,
std::string_view query )
inlineoverrideprivatevirtual

Get suggestions for auto completion with the given 'query' input text.

Parameters
prefixThe text before the token that is auto completed on.
queryThe token to perform the auto completion on.
Returns
All potential auto complete suggestions.

Implements AutoCompletion.

Definition at line 278 of file network_chat_gui.cpp.

References GetString(), AutoCompletion::prefix, and AutoCompletion::query.


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