librime: reverse_lookup_filter.h Source File

| librime 1.2 Rime Input Method Engine, the core library

reverse_lookup_filter.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2013-11-05 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_REVERSE_LOOKUP_FILTER_H_
8#define RIME_REVERSE_LOOKUP_FILTER_H_
9
10#include <rime/common.h>
11#include <rime/filter.h>
12#include <rime/algo/algebra.h>
13#include <rime/gear/filter_commons.h>
14
15namespace rime {
16
17class ReverseLookupDictionary;
18
19 class ReverseLookupFilter : public Filter, TagMatching {
20 public:
21 explicit ReverseLookupFilter(const Ticket& ticket);
22
23 virtual an<Translation> Apply(an<Translation> translation,
24 CandidateList* candidates);
25
26 virtual bool AppliesToSegment(Segment* segment) { return TagsMatch(segment); }
27
28 void Process(const an<Candidate>& cand);
29
30 protected:
31 void Initialize();
32
33 bool initialized_ = false;
34 the<ReverseLookupDictionary> rev_dict_;
35 // settings
36 bool overwrite_comment_ = false;
37 bool append_comment_ = false;
38 Projection comment_formatter_;
39};
40
41} // namespace rime
42
43#endif // RIME_REVERSE_LOOKUP_FILTER_H_
algebra.h
common.h
filter.h
filter_commons.h
rime
Definition algebra.cc:12
rime::an
std::shared_ptr< T > an
Definition common.h:60
rime::the
std::unique_ptr< T > the
Definition common.h:58
rime::CandidateList
vector< of< Candidate > > CandidateList
Definition candidate.h:52
rime::Projection
Definition algebra.h:29
rime::ReverseLookupDictionary
Definition reverse_lookup_dictionary.h:64
rime::Filter::Filter
Filter(const Ticket &ticket)
Definition filter.h:24
rime::TagMatching::TagMatching
TagMatching(const Ticket &ticket)
Definition filter_commons.cc:14
rime::TagMatching::TagsMatch
bool TagsMatch(Segment *segment)
Definition filter_commons.cc:27
rime::ReverseLookupFilter::Apply
virtual an< Translation > Apply(an< Translation > translation, CandidateList *candidates)
Definition reverse_lookup_filter.cc:61
rime::ReverseLookupFilter::ReverseLookupFilter
ReverseLookupFilter(const Ticket &ticket)
Definition reverse_lookup_filter.cc:36
rime::ReverseLookupFilter::append_comment_
bool append_comment_
Definition reverse_lookup_filter.h:37
rime::ReverseLookupFilter::initialized_
bool initialized_
Definition reverse_lookup_filter.h:33
rime::ReverseLookupFilter::overwrite_comment_
bool overwrite_comment_
Definition reverse_lookup_filter.h:36
rime::ReverseLookupFilter::Initialize
void Initialize()
Definition reverse_lookup_filter.cc:43
rime::ReverseLookupFilter::Process
void Process(const an< Candidate > &cand)
Definition reverse_lookup_filter.cc:72
rime::ReverseLookupFilter::comment_formatter_
Projection comment_formatter_
Definition reverse_lookup_filter.h:38
rime::ReverseLookupFilter::rev_dict_
the< ReverseLookupDictionary > rev_dict_
Definition reverse_lookup_filter.h:34
rime::ReverseLookupFilter::AppliesToSegment
virtual bool AppliesToSegment(Segment *segment)
Definition reverse_lookup_filter.h:26
rime::Segment
Definition segmentation.h:18
rime::Ticket
Definition ticket.h:17