1 #include <pajlada/settings/settingdata.hpp> 2 3 using namespace std; 4 5 namespace pajlada { 6 namespace Settings { 7 SettingData(string _path,weak_ptr<SettingManager> _instance)8SettingData::SettingData(string _path, weak_ptr<SettingManager> _instance) 9 : path(move(_path)) 10 , instance(_instance) 11 { 12 } 13 14 const string & getPath() const15SettingData::getPath() const 16 { 17 return this->path; 18 } 19 20 void notifyUpdate(const rapidjson::Value & value,SignalArgs args)21SettingData::notifyUpdate(const rapidjson::Value &value, SignalArgs args) 22 { 23 ++this->updateIteration; 24 25 this->updated.invoke(value, args); 26 } 27 28 int getUpdateIteration() const29SettingData::getUpdateIteration() const 30 { 31 return this->updateIteration; 32 } 33 34 rapidjson::Value * get() const35SettingData::get() const 36 { 37 auto locked = this->instance.lock(); 38 if (!locked) { 39 return nullptr; 40 } 41 42 return locked->get(this->path.c_str()); 43 } 44 45 } // namespace Settings 46 } // namespace pajlada 47