Fcitx
Public Member Functions | Protected Member Functions | List of all members
fcitx::InputBuffer Class Reference

A string buffer that come with convinient functions to handle use input. More...

#include <fcitx-utils/inputbuffer.h>

Public Member Functions

 InputBuffer (InputBufferOptions options=InputBufferOption::NoOption)
 Create a input buffer with options. More...
 
InputBufferOptions options () const
 Get the buffer option.
 
bool type (const char *s, size_t length)
 Type a C-String with length into buffer.
 
bool type (const std::string &s)
 Type an std::stirng to buffer.
 
bool type (const char *s)
 Type a C-String to buffer.
 
bool type (uint32_t unicode)
 Type a ucs4 character to buffer.
 
virtual void erase (size_t from, size_t to)
 Erase a range of character.
 
virtual void setCursor (size_t cursor)
 Set cursor position, by character.
 
size_t maxSize () const
 Get the max size of the buffer.
 
void setMaxSize (size_t s)
 Set max size of the buffer.
 
const std::string & userInput () const
 Utf8 string in the buffer.
 
size_t cursor () const
 Cursor position by utf8 character.
 
size_t cursorByChar () const
 Cursor position by char (byte).
 
size_t size () const
 Size of buffer, by number of utf8 character.
 
uint32_t charAt (size_t i) const
 UCS-4 char in the buffer. Will raise exception if i is out of range.
 
std::pair< size_t, size_t > rangeAt (size_t i) const
 Byte range for character at position i.
 
std::string_view viewAt (size_t i) const
 
size_t sizeAt (size_t i) const
 Byte size at position i.
 
bool empty () const
 Whether buffer is empty.
 
bool del ()
 Helper function to implement "delete" key.
 
bool backspace ()
 Helper function to implement "backspace" key.
 
void clear ()
 Clear all buffer.
 
void shrinkToFit ()
 Save memory by call shrink to fit to internal buffer.
 

Protected Member Functions

virtual bool typeImpl (const char *s, size_t length)
 Type a certain length of utf8 character to the buffer. More...
 

Detailed Description

A string buffer that come with convinient functions to handle use input.

Definition at line 39 of file inputbuffer.h.


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