add mike start (linux dsp) to author list
[ardour.git] / gtk2_ardour / gui_object.cc
index 857ee3a770f7a9ef8ded97489a25c4fa8364739f..fa708b25ad4ffb4319e81b44713450eb1f327de7 100644 (file)
@@ -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
 {
@@ -140,3 +169,18 @@ GUIObjectState::operator= (const GUIObjectState& other)
 
        return *this;
 }
+
+/** @return begin iterator into our StringPropertyMap */
+GUIObjectState::StringPropertyMap::const_iterator
+GUIObjectState::begin () const
+{
+       return _property_maps.begin ();
+}
+
+/** @return end iterator into our StringPropertyMap */
+GUIObjectState::StringPropertyMap::const_iterator
+GUIObjectState::end () const
+{
+       return _property_maps.end ();
+}
+