librime: registry.h Source File

| librime 1.2 Rime Input Method Engine, the core library

registry.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2011-05-07 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_REGISTRY_H_
8#define RIME_REGISTRY_H_
9
10#include <rime_api.h>
11#include <rime/common.h>
12
13namespace rime {
14
15class ComponentBase;
16
17 class Registry {
18 public:
19 using ComponentMap = map<string, ComponentBase*>;
20
21 RIME_DLL ComponentBase* Find(const string& name);
22 RIME_DLL void Register(const string& name, ComponentBase* component);
23 RIME_DLL void Unregister(const string& name);
24 void Clear();
25
26 RIME_DLL static Registry& instance();
27
28 private:
29 Registry() = default;
30
31 ComponentMap map_;
32};
33
34} // namespace rime
35
36#endif // RIME_REGISTRY_H_
rime_api.h
RIME_DLL
#define RIME_DLL
Definition rime_api.h:33
common.h
rime
Definition algebra.cc:12
rime::ComponentBase
Definition component.h:14
rime::Registry::instance
static RIME_DLL Registry & instance()
Definition registry.cc:47
rime::Registry::Clear
void Clear()
Definition registry.cc:31
rime::Registry::ComponentMap
map< string, ComponentBase * > ComponentMap
Definition registry.h:19
rime::Registry::Find
RIME_DLL ComponentBase * Find(const string &name)
Definition registry.cc:39
rime::Registry::Register
RIME_DLL void Register(const string &name, ComponentBase *component)
Definition registry.cc:13
rime::Registry::Unregister
RIME_DLL void Unregister(const string &name)
Definition registry.cc:22