diff --git a/plugins/ladspa_effect/calf/calf/utils.h b/plugins/ladspa_effect/calf/calf/utils.h index 406c71ee7..ecb9105de 100644 --- a/plugins/ladspa_effect/calf/calf/utils.h +++ b/plugins/ladspa_effect/calf/calf/utils.h @@ -147,6 +147,9 @@ extern std::string f2s(double value); /// float-to-string-that-doesn't-resemble-an-int extern std::string ff2s(double value); +/// Encode a key-value pair as XML attribute +std::string to_xml_attr(const std::string &key, const std::string &value); + /// Escape a string to be used in XML file std::string xml_escape(const std::string &src); diff --git a/plugins/ladspa_effect/calf/src/utils.cpp b/plugins/ladspa_effect/calf/src/utils.cpp index 338587f2c..837698732 100644 --- a/plugins/ladspa_effect/calf/src/utils.cpp +++ b/plugins/ladspa_effect/calf/src/utils.cpp @@ -69,6 +69,11 @@ std::string xml_escape(const std::string &src) return dest; } +std::string to_xml_attr(const std::string &key, const std::string &value) +{ + return " " + key + "=\"" + xml_escape(value) + "\""; +} + std::string load_file(const std::string &src) { std::string str;