From d6051c9953ea8778399ad72fc91c334c242d25e0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Apr 2012 11:45:40 +0000 Subject: move string_is_affirmative() into libpbd git-svn-id: svn://localhost/ardour2/branches/3.0@11936 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/configuration_variable.h | 3 ++- libs/ardour/ardour/utils.h | 2 -- libs/ardour/midi_clock_slave.cc | 1 + libs/ardour/mute_master.cc | 3 ++- libs/ardour/utils.cc | 20 -------------------- 5 files changed, 5 insertions(+), 24 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index da8fc1b9a1..a7fe8def48 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -24,6 +24,7 @@ #include #include "pbd/xml++.h" +#include "pbd/convert.h" #include "ardour/types.h" #include "ardour/utils.h" @@ -153,7 +154,7 @@ class ConfigVariable : public ConfigVariableBase } void set_from_string (std::string const & s) { - value = string_is_affirmative (s); + value = PBD::string_is_affirmative (s); } protected: diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 52b7c3053e..7eba3fa18c 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -32,8 +32,6 @@ #include #endif /* __APPLE__ */ -bool string_is_affirmative (const std::string&); - #include "ardour/ardour.h" #include "ardour/data_type.h" #include "ardour/dB.h" diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 892bc800ff..87ea05738d 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -26,6 +26,7 @@ #include "pbd/error.h" #include "pbd/failed_constructor.h" #include "pbd/pthread_utils.h" +#include "pbd/convert.h" #include "midi++/port.h" diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc index a58bb8a421..9f2ed08dab 100644 --- a/libs/ardour/mute_master.cc +++ b/libs/ardour/mute_master.cc @@ -20,6 +20,7 @@ #include "pbd/enumwriter.h" #include "pbd/xml++.h" +#include "pbd/convert.h" #include "ardour/types.h" #include "ardour/mute_master.h" @@ -144,7 +145,7 @@ MuteMaster::set_state (const XMLNode& node, int /*version*/) } if ((prop = node.property ("muted")) != 0) { - _muted_by_self = string_is_affirmative (prop->value()); + _muted_by_self = PBD::string_is_affirmative (prop->value()); } else { _muted_by_self = (_mute_point != MutePoint (0)); } diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 4933cd7e5c..beb003e713 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -627,26 +627,6 @@ bool_as_string (bool yn) return (yn ? "yes" : "no"); } -bool -string_is_affirmative (const std::string& str) -{ - /* to be used only with XML data - not intended to handle user input */ - - if (str.empty ()) { - return false; - } - - /* the use of g_strncasecmp() is solely to get around issues with - * charsets posed by trying to use C++ for the same - * comparison. switching a std::string to its lower- or upper-case - * version has several issues, but handled by default - * in the way we desire when doing it in C. - */ - - return str == "1" || str == "y" || str == "Y" || (!g_strncasecmp(str.c_str(), "yes", str.length())) || - (!g_strncasecmp(str.c_str(), "true", str.length())); -} - const char* native_header_format_extension (HeaderFormat hf, const DataType& type) { -- cgit v1.2.3