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
17class 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_
#define RIME_DLL
Definition rime_api.h:33
Definition algebra.cc:12
Definition component.h:14
static RIME_DLL Registry & instance()
Definition registry.cc:47
void Clear()
Definition registry.cc:31
map< string, ComponentBase * > ComponentMap
Definition registry.h:19
RIME_DLL ComponentBase * Find(const string &name)
Definition registry.cc:39
RIME_DLL void Register(const string &name, ComponentBase *component)
Definition registry.cc:13
RIME_DLL void Unregister(const string &name)
Definition registry.cc:22