libime
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
libime::TableContext Class Reference

Input context for table input method. More...

#include <libime/table/tablecontext.h>

Inheritance diagram for libime::TableContext:
Inheritance graph
[legend]
Collaboration diagram for libime::TableContext:
Collaboration graph
[legend]

Public Types

using CandidateRange = boost::any_range< const SentenceResult, boost::random_access_traversal_tag >
 

Public Member Functions

 TableContext (TableBasedDictionary &dict, UserLanguageModel &model)
 
void erase (size_t from, size_t to) override
 
void select (size_t idx)
 
bool isValidInput (uint32_t c) const
 
CandidateRange candidates () const
 
std::string candidateHint (size_t idx, bool custom=false) const
 
bool selected () const
 
size_t selectedSize () const
 
std::tuple< std::string, bool > selectedSegment (size_t idx) const
 
std::string selectedCode (size_t idx) const
 
size_t selectedSegmentLength (size_t idx) const
 
std::string preedit () const
 A simple preedit implementation. More...
 
const std::string & currentCode () const
 Current unselected code.
 
std::string selectedSentence () const
 The concatenation of all selectedSegment where bool == true.
 
size_t selectedLength () const
 
void learn ()
 Save the current selected text.
 
void learnLast ()
 Save the last selected text.
 
void learnAutoPhrase (std::string_view history)
 Learn auto word from string. More...
 
void learnAutoPhrase (std::string_view history, const std::vector< std::string > &hints)
 Learn auto word from string. More...
 
const TableBasedDictionarydict () const
 
TableBasedDictionarymutableDict ()
 
const UserLanguageModelmodel () const
 
UserLanguageModelmutableModel ()
 
void autoSelect ()
 
void setAutoSelectIndex (size_t index)
 Set the auto select index, usually, this is the candidate cursor index. More...
 
- Public Member Functions inherited from libime::InputBuffer
bool type (std::string_view s)
 
std::string_view at (size_t i) const
 
std::string_view operator[] (size_t i) const
 
iterator begin ()
 
iterator end ()
 

Static Public Member Functions

static std::string code (const SentenceResult &sentence)
 
static PhraseFlag flag (const SentenceResult &sentence)
 
static bool isPinyin (const SentenceResult &sentence)
 
static bool isAuto (const SentenceResult &sentence)
 

Protected Member Functions

bool typeImpl (const char *s, size_t length) override
 

Detailed Description

Input context for table input method.

Definition at line 37 of file tablecontext.h.

Member Function Documentation

◆ learnAutoPhrase() [1/2]

void libime::TableContext::learnAutoPhrase ( std::string_view  history)

Learn auto word from string.

Depending on the tableOptions, it will try to learn the word in history.

Definition at line 823 of file tablecontext.cpp.

◆ learnAutoPhrase() [2/2]

void libime::TableContext::learnAutoPhrase ( std::string_view  history,
const std::vector< std::string > &  hints 
)

Learn auto word from string.

Similar to its overload, but with hint of given code.

Definition at line 827 of file tablecontext.cpp.

◆ preedit()

std::string libime::TableContext::preedit ( ) const

A simple preedit implementation.

The value is derived from function selectedSegment and currentCode.

Definition at line 724 of file tablecontext.cpp.

◆ setAutoSelectIndex()

void libime::TableContext::setAutoSelectIndex ( size_t  index)

Set the auto select index, usually, this is the candidate cursor index.

Since
1.0.12

Definition at line 467 of file tablecontext.cpp.


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