librime: composition.h Source File

| librime 1.2 Rime Input Method Engine, the core library

composition.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-06-19 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_COMPOSITION_H_
8#define RIME_COMPOSITION_H_
9
10#include <rime/segmentation.h>
11
12namespace rime {
13
14 struct Preedit {
15 string text;
16 size_t caret_pos = 0;
17 size_t sel_start = 0;
18 size_t sel_end = 0;
19};
20
21 class Composition : public Segmentation {
22 public:
23 Composition() = default;
24
25 bool HasFinishedComposition() const;
26 Preedit GetPreedit(const string& full_input,
27 size_t caret_pos,
28 const string& caret) const;
29 string GetPrompt() const;
30 string GetCommitText() const;
31 string GetScriptText(bool keep_selection = true) const;
32 RIME_DLL string GetDebugText() const;
33 // Returns text of the last segment before the given position.
34 string GetTextBefore(size_t pos) const;
35};
36
37} // namespace rime
38
39#endif // RIME_COMPOSITION_H_
segmentation.h
RIME_DLL
#define RIME_DLL
Definition rime_api.h:33
rime
Definition algebra.cc:12
rime::Preedit
Definition composition.h:14
rime::Preedit::caret_pos
size_t caret_pos
Definition composition.h:16
rime::Preedit::sel_start
size_t sel_start
Definition composition.h:17
rime::Preedit::text
string text
Definition composition.h:15
rime::Preedit::sel_end
size_t sel_end
Definition composition.h:18
rime::Composition::GetCommitText
string GetCommitText() const
Definition composition.cc:102
rime::Composition::HasFinishedComposition
bool HasFinishedComposition() const
Definition composition.cc:15
rime::Composition::Composition
Composition()=default
rime::Composition::GetPrompt
string GetPrompt() const
Definition composition.cc:98
rime::Composition::GetScriptText
string GetScriptText(bool keep_selection=true) const
Definition composition.cc:122
rime::Composition::GetDebugText
RIME_DLL string GetDebugText() const
Definition composition.cc:144
rime::Composition::GetTextBefore
string GetTextBefore(size_t pos) const
Definition composition.cc:169
rime::Composition::GetPreedit
Preedit GetPreedit(const string &full_input, size_t caret_pos, const string &caret) const
Definition composition.cc:24
rime::Segmentation::Segmentation
Segmentation()
Definition segmentation.cc:55