librime: translator.h Source File

| librime 1.2 Rime Input Method Engine, the core library

translator.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-05-02 Wensong He <snowhws@gmail.com>
6//
7
8#ifndef RIME_TRANSLATOR_H_
9#define RIME_TRANSLATOR_H_
10
11#include <rime/common.h>
12#include <rime/component.h>
13#include <rime/ticket.h>
14
15namespace rime {
16
17class Context;
18class Engine;
19class Translation;
20struct Segment;
21
22 class Translator : public Class<Translator, const Ticket&> {
23 public:
24 explicit Translator(const Ticket& ticket)
25 : engine_(ticket.engine), name_space_(ticket.name_space) {}
26 virtual ~Translator() = default;
27
28 virtual an<Translation> Query(const string& input,
29 const Segment& segment) = 0;
30
31 string name_space() const { return name_space_; }
32
33 protected:
34 Engine* engine_;
35 string name_space_;
36};
37
38} // namespace rime
39
40#endif // RIME_TRANSLATOR_H_
common.h
component.h
ticket.h
rime
Definition algebra.cc:12
rime::an
std::shared_ptr< T > an
Definition common.h:60
rime::Class
Definition component.h:21
rime::Context
Definition context.h:19
rime::Engine
Definition engine.h:20
rime::Segment
Definition segmentation.h:18
rime::Ticket
Definition ticket.h:17
rime::Translation
Definition translation.h:17
rime::Translator::name_space
string name_space() const
Definition translator.h:31
rime::Translator::~Translator
virtual ~Translator()=default
rime::Translator::engine_
Engine * engine_
Definition translator.h:34
rime::Translator::name_space_
string name_space_
Definition translator.h:35
rime::Translator::Translator
Translator(const Ticket &ticket)
Definition translator.h:24
rime::Translator::Query
virtual an< Translation > Query(const string &input, const Segment &segment)=0