28 shared_ptr<MergedPreferences> MergedPreferences::Create(
const shared_ptr<Ws::IWorkspace>& w,
29 const shared_ptr<Ws::IProject>& p)
31 auto result = shared_ptr<MergedPreferences>(
new MergedPreferences(w,p));
32 w->Subject<Ws::Event::PreferencesChanged, std::weak_ptr<const void>>::Register(
33 result, bind(&MergedPreferences::ListenPreferencesChanged, result.get(), _1));
34 p->Subject<Ws::Event::PreferencesChanged, std::weak_ptr<const void>>::Register(
35 result, bind(&MergedPreferences::ListenPreferencesChanged, result.get(), _1));
40 MergedPreferences::MergedPreferences(
const shared_ptr<Ws::IWorkspace>& w,
41 const shared_ptr<Ws::IProject>& p)
42 : m_path(), m_workspace(w), m_project(p)
46 MergedPreferences::MergedPreferences(
const boost::property_tree::ptree::path_type& p,
const MergedPreferences& other)
47 : m_path(p), m_workspace(other.m_workspace), m_project(other.m_project)
51 MergedPreferences::~MergedPreferences()
55 shared_ptr<MergedPreferences> MergedPreferences::GetChild(
const boost::property_tree::ptree::path_type& p)
const
57 auto result = shared_ptr<MergedPreferences>(
new MergedPreferences(m_path / p, *
this));
60 result, bind(&MergedPreferences::ListenPreferencesChanged, result.get(), _1));
62 result, bind(&MergedPreferences::ListenPreferencesChanged, result.get(), _1));
67 shared_ptr<MergedPreferences> MergedPreferences::GetGlobal()
const
69 boost::property_tree::ptree::path_type empty_path;
70 auto result = shared_ptr<MergedPreferences>(
new MergedPreferences(empty_path, *
this));
73 result, bind(&MergedPreferences::ListenPreferencesChanged, result.get(), _1));
75 result, bind(&MergedPreferences::ListenPreferencesChanged, result.get(), _1));
80 const std::string& MergedPreferences::GetPath()
const
82 return m_project->GetPath();
85 const boost::property_tree::ptree& MergedPreferences::GetProjectPreferencesTree()
88 return m_project->GetPreferences();
94 Notify({shared_from_this()});
Event used to inform some observer that preferences have changed.
Wrapper around workspace to have read and write access to merged (workspace + project) preferences...
Interface for MergedPreferences.
Namespace for generic graphical shell for simulators.