librime: processor.h Source File

| librime 1.2 Rime Input Method Engine, the core library

processor.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-03-14 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_PROCESSOR_H_
8#define RIME_PROCESSOR_H_
9
10#include <rime/component.h>
11#include <rime/ticket.h>
12
13namespace rime {
14
15class Engine;
16class KeyEvent;
17
18 enum ProcessResult {
19 kRejected, // do the OS default processing
20 kAccepted, // consume it
21 kNoop, // leave it to other processors
22};
23
24 class Processor : public Class<Processor, const Ticket&> {
25 public:
26 explicit Processor(const Ticket& ticket)
27 : engine_(ticket.engine), name_space_(ticket.name_space) {}
28 virtual ~Processor() = default;
29
30 virtual ProcessResult ProcessKeyEvent(const KeyEvent& key_event) {
31 return kNoop;
32 }
33
34 string name_space() const { return name_space_; }
35
36 protected:
37 Engine* engine_;
38 string name_space_;
39};
40
41} // namespace rime
42
43#endif // RIME_PROCESSOR_H_
component.h
ticket.h
rime
Definition algebra.cc:12
rime::ProcessResult
ProcessResult
Definition processor.h:18
rime::kRejected
@ kRejected
Definition processor.h:19
rime::kNoop
@ kNoop
Definition processor.h:21
rime::kAccepted
@ kAccepted
Definition processor.h:20
rime::Class
Definition component.h:21
rime::Engine
Definition engine.h:20
rime::KeyEvent
Definition key_event.h:17
rime::Processor::Processor
Processor(const Ticket &ticket)
Definition processor.h:26
rime::Processor::engine_
Engine * engine_
Definition processor.h:37
rime::Processor::name_space_
string name_space_
Definition processor.h:38
rime::Processor::~Processor
virtual ~Processor()=default
rime::Processor::name_space
string name_space() const
Definition processor.h:34
rime::Processor::ProcessKeyEvent
virtual ProcessResult ProcessKeyEvent(const KeyEvent &key_event)
Definition processor.h:30
rime::Ticket
Definition ticket.h:17