diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2017-04-18 13:10:58 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2017-04-19 07:49:57 +1000 |
commit | 13bfd1527aa2386dea3b6b1191a5632af9a0b72b (patch) | |
tree | 5fb9bb79f2044d4714c7b16227a98ad8b809280c /libs/pbd | |
parent | 362303f7931a510b16ada637d585eedc873e3781 (diff) |
Make boolean string values 0 and 1 to maintain backwards compatibility
I would prefer "yes" and "no" as it distinguishes boolean values from numeric
but using "yes and "no" results in PBD::Property<T>::from_string failing to
parse the correct values when opening in an older Ardour version as there is no
specialization for bool.
Using 0 and 1 also results in less change to the Session file.
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/string_convert.cc | 4 | ||||
-rw-r--r-- | libs/pbd/test/string_convert_test.cc | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libs/pbd/string_convert.cc b/libs/pbd/string_convert.cc index 3a46b8a682..a543c96ff1 100644 --- a/libs/pbd/string_convert.cc +++ b/libs/pbd/string_convert.cc @@ -210,9 +210,9 @@ bool string_to_double (const std::string& str, double& val) bool bool_to_string (bool val, std::string& str) { if (val) { - str = X_("yes"); + str = X_("1"); } else { - str = X_("no"); + str = X_("0"); } return true; } diff --git a/libs/pbd/test/string_convert_test.cc b/libs/pbd/test/string_convert_test.cc index 2f06ad9c52..27a24c54ef 100644 --- a/libs/pbd/test/string_convert_test.cc +++ b/libs/pbd/test/string_convert_test.cc @@ -564,8 +564,8 @@ StringConvertTest::test_double_conversion () } // we have to use these as CPPUNIT_ASSERT_EQUAL won't accept char arrays -static const std::string BOOL_TRUE_STR ("yes"); -static const std::string BOOL_FALSE_STR ("no"); +static const std::string BOOL_TRUE_STR ("1"); +static const std::string BOOL_FALSE_STR ("0"); void StringConvertTest::test_bool_conversion () |