diff plugin/PluginXml.cpp @ 81:f277a171749d

* Pull out temporary directory management into its own class * Make sure playback plugins get a default sample path in their original play parameters configuration * Save play parameters to .sv file (we aren't reloading yet though)
author Chris Cannam
date Tue, 25 Apr 2006 22:14:43 +0000
parents 163f3428bbe0
children c30728d5625c
line wrap: on
line diff
--- a/plugin/PluginXml.cpp	Mon Apr 24 17:06:32 2006 +0000
+++ b/plugin/PluginXml.cpp	Tue Apr 25 22:14:43 2006 +0000
@@ -36,6 +36,24 @@
 PluginXml::~PluginXml() { }
 
 QString
+PluginXml::encodeConfigurationChars(QString text)
+{
+    QString rv(text);
+    rv.replace(";", "[[SEMICOLON]]");
+    rv.replace("=", "[[EQUALS]]");
+    return rv;
+}
+
+QString
+PluginXml::decodeConfigurationChars(QString text)
+{
+    QString rv(text);
+    rv.replace("[[SEMICOLON]]", ";");
+    rv.replace("[[EQUALS]]", "=");
+    return rv;
+}
+    
+QString
 PluginXml::toXmlString(QString indent, QString extraAttributes) const
 {
     QString s;
@@ -74,10 +92,8 @@
              i != configurePairs.end(); ++i) {
             QString key = i->first.c_str();
             QString value = i->second.c_str();
-            key.replace(";", "[[SEMICOLON]]");
-            key.replace("=", "[[EQUALS]]");
-            value.replace(";", "[[SEMICOLON]]");
-            value.replace("=", "[[EQUALS]]");
+            key = encodeConfigurationChars(key);
+            value = encodeConfigurationChars(value);
             if (config != "") config += ";";
             config += QString("%1=%2").arg(key).arg(value);
         }
@@ -128,10 +144,8 @@
                     continue;
                 }
                 QString key(kv[0]), value(kv[1]);
-                key.replace("[[SEMICOLON]]", ";");
-                key.replace("[[EQUALS]]", ";");
-                value.replace("[[SEMICOLON]]", ";");
-                value.replace("[[SEMICOLON]]", ";");
+                key = decodeConfigurationChars(key);
+                value = decodeConfigurationChars(value);
                 rtpi->configure(key.toStdString(), value.toStdString());
             }
         }