librime: filter.h Source File

| librime 1.2 Rime Input Method Engine, the core library

filter.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-12-11 GONG Chen <chen.sst@gmail.com>
6//
7
8#ifndef RIME_FILTER_H_
9#define RIME_FILTER_H_
10
11#include <rime/candidate.h>
12#include <rime/common.h>
13#include <rime/component.h>
14#include <rime/ticket.h>
15
16namespace rime {
17
18class Engine;
19struct Segment;
20class Translation;
21
22 class Filter : public Class<Filter, const Ticket&> {
23 public:
24 explicit Filter(const Ticket& ticket)
25 : engine_(ticket.engine), name_space_(ticket.name_space) {}
26 virtual ~Filter() = default;
27
28 virtual an<Translation> Apply(an<Translation> translation,
29 CandidateList* candidates) = 0;
30
31 virtual bool AppliesToSegment(Segment* segment) { return true; }
32
33 string name_space() const { return name_space_; }
34
35 protected:
36 Engine* engine_;
37 string name_space_;
38};
39
40} // namespace rime
41
42#endif // RIME_FILTER_H_
ticket.h
candidate.h
common.h
component.h
rime
Definition algebra.cc:12
rime::an
std::shared_ptr< T > an
Definition common.h:60
rime::CandidateList
vector< of< Candidate > > CandidateList
Definition candidate.h:52
rime::Class
Definition component.h:21
rime::Engine
Definition engine.h:20
rime::Filter::AppliesToSegment
virtual bool AppliesToSegment(Segment *segment)
Definition filter.h:31
rime::Filter::~Filter
virtual ~Filter()=default
rime::Filter::name_space_
string name_space_
Definition filter.h:37
rime::Filter::Apply
virtual an< Translation > Apply(an< Translation > translation, CandidateList *candidates)=0
rime::Filter::Filter
Filter(const Ticket &ticket)
Definition filter.h:24
rime::Filter::engine_
Engine * engine_
Definition filter.h:36
rime::Filter::name_space
string name_space() const
Definition filter.h:33
rime::Segment
Definition segmentation.h:18
rime::Ticket
Definition ticket.h:17
rime::Translation
Definition translation.h:17