mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 19:51:49 +00:00
COMMON: Add Common::parseBool
svn-id: r48566
This commit is contained in:
parent
77c1e0dfe1
commit
7c510f2dfa
@ -84,6 +84,27 @@ void hexdump(const byte * data, int len, int bytesPerLine, int startOffset) {
|
||||
#pragma mark -
|
||||
|
||||
|
||||
bool parseBool(const Common::String &val, bool &valAsBool) {
|
||||
if (val.equalsIgnoreCase("true") ||
|
||||
val.equalsIgnoreCase("yes") ||
|
||||
val.equals("1")) {
|
||||
valAsBool = true;
|
||||
return true;
|
||||
}
|
||||
if (val.equalsIgnoreCase("false") ||
|
||||
val.equalsIgnoreCase("no") ||
|
||||
val.equals("0")) {
|
||||
valAsBool = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
const LanguageDescription g_languages[] = {
|
||||
{"zh-cn", "Chinese (China)", ZH_CNA},
|
||||
{"zh", "Chinese (Taiwan)", ZH_TWN},
|
||||
|
@ -76,6 +76,18 @@ namespace Common {
|
||||
extern void hexdump(const byte * data, int len, int bytesPerLine = 16, int startOffset = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Parse a string for a boolean value.
|
||||
* The strings "true", "yes", and "1" are interpreted as true.
|
||||
* The strings "false", "no", and "0" are interpreted as false.
|
||||
* This function ignores case.
|
||||
*
|
||||
* @param[in] val the string to parse
|
||||
* @param[out] valAsBool the parsing result
|
||||
* @return true if the string parsed correctly, false if an error occurred.
|
||||
*/
|
||||
bool parseBool(const Common::String &val, bool &valAsBool);
|
||||
|
||||
/**
|
||||
* List of game language.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user