diff options
Diffstat (limited to 'libs/ardour/utils.cc')
-rw-r--r-- | libs/ardour/utils.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index e12ae2cd89..c8e6b1145f 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -506,6 +506,29 @@ ARDOUR::auto_style_to_string (AutoStyle as) return ""; } +std::string +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 == "1" || str == "y" || str == "Y") { + return true; + } else { + std::string str_uc; + std::transform(str.begin(), str.end(), str_uc.begin(), ::toupper); + if (str_uc == "YES") { + return true; + } + } + return false; +} + extern "C" { void c_stacktrace() { stacktrace (cerr); } } |