mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-22 13:17:17 +01:00
slightly improved string_is_affirmative() implementation
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5722 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b2d08a44b4
commit
8f7aa040f7
1 changed files with 6 additions and 10 deletions
|
|
@ -581,25 +581,21 @@ ARDOUR::auto_style_to_string (AutoStyle as)
|
|||
/*NOTREACHED*/
|
||||
return "";
|
||||
}
|
||||
|
||||
bool
|
||||
string_is_affirmative (const std::string& str)
|
||||
{
|
||||
/* to be used only with XML data - not intended to handle user input */
|
||||
|
||||
if (str.length() == 1) {
|
||||
if (str[0] == '1' || str[0] == 'y' || str[0] == 'Y') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (str == "1" || str == "y" || str == "Y") {
|
||||
return true;
|
||||
} else {
|
||||
if (str == "yes" || str == "Yes" || str == "YES") {
|
||||
std::string str_uc;
|
||||
std::transform(str.begin(), str.end(), str_uc.begin(), ::toupper);
|
||||
if (str_uc == "YES") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue