librime: speller.h Source File

| librime 1.2 Rime Input Method Engine, the core library

speller.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-10-27 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_SPELLER_H_
8#define RIME_SPELLER_H_
9
10#include <boost/regex.hpp>
11#include <rime/common.h>
12#include <rime/component.h>
13#include <rime/processor.h>
14
15namespace rime {
16
17class Context;
18struct Segment;
19
20 class Speller : public Processor {
21 public:
22 Speller(const Ticket& ticket);
23
24 virtual ProcessResult ProcessKeyEvent(const KeyEvent& key_event);
25
26 protected:
27 enum AutoClearMethod {
28 kClearNone,
29 kClearAuto,
30 kClearManual,
31 kClearMaxLength
32 };
33
34 bool AutoSelectAtMaxCodeLength(Context* ctx);
35 bool AutoSelectUniqueCandidate(Context* ctx);
36 bool AutoSelectPreviousMatch(Context* ctx, Segment* previous_segment);
37 bool FindEarlierMatch(Context* ctx, size_t start, size_t end);
38 bool AutoClear(Context* ctx);
39
40 string alphabet_;
41 string delimiters_;
42 string initials_;
43 string finals_;
44 int max_code_length_ = 0;
45 bool auto_select_ = false;
46 bool use_space_ = false;
47 boost::regex auto_select_pattern_;
48 AutoClearMethod auto_clear_ = kClearNone;
49};
50
51} // namespace rime
52
53#endif // RIME_SPELLER_H_
processor.h
common.h
component.h
rime
Definition algebra.cc:12
rime::ProcessResult
ProcessResult
Definition processor.h:18
rime::Context
Definition context.h:19
rime::Speller::max_code_length_
int max_code_length_
Definition speller.h:44
rime::Speller::AutoClearMethod
AutoClearMethod
Definition speller.h:27
rime::Speller::kClearNone
@ kClearNone
Definition speller.h:28
rime::Speller::kClearAuto
@ kClearAuto
Definition speller.h:29
rime::Speller::kClearManual
@ kClearManual
Definition speller.h:30
rime::Speller::kClearMaxLength
@ kClearMaxLength
Definition speller.h:31
rime::Speller::use_space_
bool use_space_
Definition speller.h:46
rime::Speller::ProcessKeyEvent
virtual ProcessResult ProcessKeyEvent(const KeyEvent &key_event)
Definition speller.cc:100
rime::Speller::auto_clear_
AutoClearMethod auto_clear_
Definition speller.h:48
rime::Speller::AutoSelectAtMaxCodeLength
bool AutoSelectAtMaxCodeLength(Context *ctx)
Definition speller.cc:148
rime::Speller::auto_select_pattern_
boost::regex auto_select_pattern_
Definition speller.h:47
rime::Speller::FindEarlierMatch
bool FindEarlierMatch(Context *ctx, size_t start, size_t end)
Definition speller.cc:229
rime::Speller::alphabet_
string alphabet_
Definition speller.h:40
rime::Speller::finals_
string finals_
Definition speller.h:43
rime::Speller::initials_
string initials_
Definition speller.h:42
rime::Speller::AutoSelectUniqueCandidate
bool AutoSelectUniqueCandidate(Context *ctx)
Definition speller.cc:162
rime::Speller::AutoClear
bool AutoClear(Context *ctx)
Definition speller.cc:219
rime::Speller::delimiters_
string delimiters_
Definition speller.h:41
rime::Speller::AutoSelectPreviousMatch
bool AutoSelectPreviousMatch(Context *ctx, Segment *previous_segment)
Definition speller.cc:189
rime::Speller::auto_select_
bool auto_select_
Definition speller.h:45
rime::Speller::Speller
Speller(const Ticket &ticket)
Definition speller.cc:71
rime::KeyEvent
Definition key_event.h:17
rime::Processor::Processor
Processor(const Ticket &ticket)
Definition processor.h:26
rime::Segment
Definition segmentation.h:18
rime::Ticket
Definition ticket.h:17