diff options
author | Max Horn | 2012-02-20 16:03:39 +0100 |
---|---|---|
committer | Max Horn | 2012-02-20 16:18:27 +0100 |
commit | 4f8665fc836898ebf54fc73b1061125b748183bc (patch) | |
tree | ae393cd0822fab01bdcc38bd003ab186955eb270 /common | |
parent | 658080deeda79d20ea40643569fbcb072573e7cf (diff) | |
download | scummvm-rg350-4f8665fc836898ebf54fc73b1061125b748183bc.tar.gz scummvm-rg350-4f8665fc836898ebf54fc73b1061125b748183bc.tar.bz2 scummvm-rg350-4f8665fc836898ebf54fc73b1061125b748183bc.zip |
COMMON: Move isFoo functions to namespace Common, add doxygen comments
Diffstat (limited to 'common')
-rw-r--r-- | common/config-manager.cpp | 2 | ||||
-rw-r--r-- | common/util.cpp | 9 | ||||
-rw-r--r-- | common/util.h | 75 |
3 files changed, 67 insertions, 19 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index d4035e8b92..aaa812bc94 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -29,7 +29,7 @@ static bool isValidDomainName(const Common::String &domName) { const char *p = domName.c_str(); - while (*p && (isAlnum(*p) || *p == '-' || *p == '_')) + while (*p && (Common::isAlnum(*p) || *p == '-' || *p == '_')) p++; return *p == 0; } diff --git a/common/util.cpp b/common/util.cpp index 0a7d0f1e89..e605a267d5 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -415,9 +415,6 @@ void updateGameGUIOptions(const String &options, const String &langOption) { } } -} // End of namespace Common - - // // TODO: Instead of a blind cast, we might want to verify // if c equals EOS; and/or is in the range -255..+255; @@ -435,10 +432,6 @@ bool isDigit(int c) { return isdigit((byte)c); } -bool isNumber(int c) { - return isnumber((byte)c); -} - bool isLower(int c) { return islower((byte)c); } @@ -450,3 +443,5 @@ bool isSpace(int c) { bool isUpper(int c) { return isupper((byte)c); } + +} // End of namespace Common diff --git a/common/util.h b/common/util.h index 1df7bbb9c3..617bc3dcfa 100644 --- a/common/util.h +++ b/common/util.h @@ -34,17 +34,6 @@ ((((size_t)value) & ((alignment) - 1)) == 0) -//namespace{ -bool isAlnum(int c); -bool isAlpha(int c); -bool isDigit(int c); -bool isNumber(int c); -bool isLower(int c); -bool isSpace(int c); -bool isUpper(int c); -//} - - #ifdef MIN #undef MIN #endif @@ -144,6 +133,70 @@ extern void hexdump(const byte * data, int len, int bytesPerLine = 16, int start */ bool parseBool(const String &val, bool &valAsBool); + +/** + * Test whether the given character is alphanumeric (a-z, A-Z, 0-9). + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is alphanumeric, false otherwise. + */ +bool isAlnum(int c); + +/** + * Test whether the given character is an alphabetic letter (a-z, A-Z). + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is TODO, false otherwise. + */ +bool isAlpha(int c); + +/** + * Test whether the given character is a decimal-digit (0-9). + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is a decimal-digit, false otherwise. + */ +bool isDigit(int c); + +/** + * Test whether the given character is a lower-case letter (a-z). + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is a lower-case letter, false otherwise. + */ +bool isLower(int c); + +/** + * Test whether the given character is a white-space. + * White-space characters are ' ', '\t', '\r', '\n', '\v', '\f'. + * + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is a white-space, false otherwise. + */ +bool isSpace(int c); + +/** + * Test whether the given character is an upper-case letter (A-Z). + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is an upper-case letter, false otherwise. + */ +bool isUpper(int c); + + /** * List of game language. */ |