X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fconfiguration_variable.h;h=da8fc1b9a119c26d60372168d0de01fe39be0101;hb=18bc80a01c7154569f49d4c33b92e5753b65b438;hp=e05952417d4ccbbd15962f997e0f08d9c20aa3bb;hpb=a473d630eb165272992e90f8d854b1d66ec0be63;p=ardour.git diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index e05952417d..da8fc1b9a1 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -88,6 +88,42 @@ class ConfigVariable : public ConfigVariableBase T value; }; +/** Specialisation of ConfigVariable for std::string to cope with whitespace properly */ +template<> +class ConfigVariable : public ConfigVariableBase +{ + public: + + ConfigVariable (std::string str) : ConfigVariableBase (str) {} + ConfigVariable (std::string str, std::string val) : ConfigVariableBase (str), value (val) {} + + std::string get() const { + return value; + } + + std::string get_as_string () const { + return value; + } + + virtual bool set (std::string val) { + if (val == value) { + miss (); + return false; + } + value = val; + notify (); + return true; + } + + virtual void set_from_string (std::string const & s) { + value = s; + } + + protected: + virtual std::string get_for_save() { return value; } + std::string value; +}; + template<> class ConfigVariable : public ConfigVariableBase {