diff options
Diffstat (limited to 'gtk2_ardour/gui_object.cc')
-rw-r--r-- | gtk2_ardour/gui_object.cc | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/gtk2_ardour/gui_object.cc b/gtk2_ardour/gui_object.cc index 857ee3a770..fda1e0b29e 100644 --- a/gtk2_ardour/gui_object.cc +++ b/gtk2_ardour/gui_object.cc @@ -49,11 +49,6 @@ class gos_string_vistor : public boost::static_visitor<> { void operator() (const int64_t& i) { stream << i; } -#if 0 - void operator() (const double& d) { - stream << std::setprecision (12) << d; - } -#endif void operator() (const std::string& s) { stream << s; @@ -63,6 +58,40 @@ class gos_string_vistor : public boost::static_visitor<> { std::ostream& stream; }; +std::string +GUIObjectState::get_string (const std::string& id, const std::string& prop_name, bool* empty) +{ + StringPropertyMap::iterator i = _property_maps.find (id); + + if (i == _property_maps.end()) { + if (empty) { + *empty = true; + } + return string(); + } + + const PropertyMap& pmap (i->second); + PropertyMap::const_iterator p = pmap.find (prop_name); + + if (p == pmap.end()) { + if (empty) { + *empty = true; + } + return string(); + } + + std::stringstream ss; + gos_string_vistor gsv (ss); + + boost::apply_visitor (gsv, p->second); + + if (empty) { + *empty = false; + } + + return ss.str (); +} + XMLNode& GUIObjectState::get_state () const { |