librime: custom_settings.h Source File

| librime 1.2 Rime Input Method Engine, the core library

custom_settings.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2012-02-26 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_CUSTOM_SETTINGS_H_
8#define RIME_CUSTOM_SETTINGS_H_
9
10#include <rime/config.h>
11
12namespace rime {
13
14class Deployer;
15
16 class CustomSettings {
17 public:
18 CustomSettings(Deployer* deployer,
19 const string& config_id,
20 const string& generator_id);
21 virtual ~CustomSettings() = default;
22
23 virtual bool Load();
24 virtual bool Save();
25 an<ConfigValue> GetValue(const string& key);
26 an<ConfigList> GetList(const string& key);
27 an<ConfigMap> GetMap(const string& key);
28 bool Customize(const string& key, const an<ConfigItem>& item);
29 bool IsFirstRun();
30 bool modified() const { return modified_; }
31 Config* config() { return &config_; }
32
33 protected:
34 Deployer* deployer_;
35 bool modified_ = false;
36 string config_id_;
37 string generator_id_;
38 Config config_;
39 Config custom_config_;
40};
41
42} // namespace rime
43
44#endif // RIME_CUSTOM_SETTINGS_H_
config.h
rime
Definition algebra.cc:12
rime::an
std::shared_ptr< T > an
Definition common.h:60
rime::Config
Definition config_component.h:21
rime::Deployer
Definition deployer.h:32
rime::CustomSettings::Save
virtual bool Save()
Definition custom_settings.cc:49
rime::CustomSettings::generator_id_
string generator_id_
Definition custom_settings.h:37
rime::CustomSettings::~CustomSettings
virtual ~CustomSettings()=default
rime::CustomSettings::GetValue
an< ConfigValue > GetValue(const string &key)
Definition custom_settings.cc:61
rime::CustomSettings::custom_config_
Config custom_config_
Definition custom_settings.h:39
rime::CustomSettings::deployer_
Deployer * deployer_
Definition custom_settings.h:34
rime::CustomSettings::CustomSettings
CustomSettings(Deployer *deployer, const string &config_id, const string &generator_id)
Definition custom_settings.cc:25
rime::CustomSettings::GetList
an< ConfigList > GetList(const string &key)
Definition custom_settings.cc:65
rime::CustomSettings::config_
Config config_
Definition custom_settings.h:38
rime::CustomSettings::config_id_
string config_id_
Definition custom_settings.h:36
rime::CustomSettings::GetMap
an< ConfigMap > GetMap(const string &key)
Definition custom_settings.cc:69
rime::CustomSettings::IsFirstRun
bool IsFirstRun()
Definition custom_settings.cc:86
rime::CustomSettings::modified_
bool modified_
Definition custom_settings.h:35
rime::CustomSettings::Customize
bool Customize(const string &key, const an< ConfigItem > &item)
Definition custom_settings.cc:73
rime::CustomSettings::Load
virtual bool Load()
Definition custom_settings.cc:30
rime::CustomSettings::config
Config * config()
Definition custom_settings.h:31
rime::CustomSettings::modified
bool modified() const
Definition custom_settings.h:30