librime 1.2
Rime Input Method Engine, the core library
user_dict_manager.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2012-03-23 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_USER_DICT_MANAGER_H_
8#define RIME_USER_DICT_MANAGER_H_
9
10#include <rime/common.h>
11#include <rime/dict/user_db.h>
12
13namespace rime {
14
15class Deployer;
16
17using UserDictList = vector<string>;
18
20 public:
21 UserDictManager(Deployer* deployer);
22
23 // If component is null, the current userdb component is used.
24 void GetUserDictList(UserDictList* user_dict_list,
25 UserDb::Component* component = nullptr);
26
27 // CAVEAT: the user dict should be closed before the following operations
28 bool Backup(const string& dict_name);
29 bool Restore(const path& snapshot_file);
30 bool UpgradeUserDict(const string& dict_name);
31 // returns num of exported entries, -1 denotes failure
32 int Export(const string& dict_name, const path& text_file);
33 // returns num of imported entries, -1 denotes failure
34 int Import(const string& dict_name, const path& text_file);
35
36 bool Synchronize(const string& dict_name);
37 bool SynchronizeAll();
38
39 protected:
43};
44
45} // namespace rime
46
47#endif // RIME_USER_DICT_MANAGER_H_
#define RIME_DLL
Definition rime_api.h:33
Definition algebra.cc:12
vector< string > UserDictList
Definition user_dict_manager.h:17
Definition common.h:84
Definition deployer.h:32
Abstract class for a user db component.
Definition user_db.h:44
bool Restore(const path &snapshot_file)
Definition user_dict_manager.cc:73
Deployer * deployer_
Definition user_dict_manager.h:40
void GetUserDictList(UserDictList *user_dict_list, UserDb::Component *component=nullptr)
Definition user_dict_manager.cc:30
bool Synchronize(const string &dict_name)
Definition user_dict_manager.cc:178
int Import(const string &dict_name, const path &text_file)
Definition user_dict_manager.cc:131
bool SynchronizeAll()
Definition user_dict_manager.cc:210
UserDictManager(Deployer *deployer)
Definition user_dict_manager.cc:23
bool Backup(const string &dict_name)
Definition user_dict_manager.cc:51
UserDb::Component * user_db_component_
Definition user_dict_manager.h:42
bool UpgradeUserDict(const string &dict_name)
Definition user_dict_manager.cc:154
int Export(const string &dict_name, const path &text_file)
Definition user_dict_manager.cc:107
path path_
Definition user_dict_manager.h:41