diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-02 20:53:31 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-02 20:53:31 +0000 |
commit | e488378d42777b436c6a2708d9dff2def51a5271 (patch) | |
tree | cbbd17c9a23b947bbbbb4e815e86654e8e993073 /libs/ardour/utils.cc | |
parent | 342cdda32e03be82bb071afd15c26989f54bffb2 (diff) |
string_is_affirmative() fix for 3.0
git-svn-id: svn://localhost/ardour2/branches/3.0@5723 d708f5d6-7413-0410-9779-e7cbd77b26cf
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); } } |