diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Runtime/common/string/utf-8-case.cpp | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Runtime/common/string/utf-8-case.cpp')
-rw-r--r-- | src/VBox/Runtime/common/string/utf-8-case.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/VBox/Runtime/common/string/utf-8-case.cpp b/src/VBox/Runtime/common/string/utf-8-case.cpp index 7a0bf2eb..e674944f 100644 --- a/src/VBox/Runtime/common/string/utf-8-case.cpp +++ b/src/VBox/Runtime/common/string/utf-8-case.cpp @@ -338,3 +338,82 @@ RTDECL(char *) RTStrToUpper(char *psz) } RT_EXPORT_SYMBOL(RTStrToUpper); + +RTDECL(bool) RTStrIsCaseFoldable(const char *psz) +{ + /* + * Loop the code points in the string, checking them one by one until we + * find something that can be folded. + */ + RTUNICP uc; + do + { + int rc = RTStrGetCpEx(&psz, &uc); + if (RT_SUCCESS(rc)) + { + if (RTUniCpIsFoldable(uc)) + return true; + } + else + { + /* bad encoding, just skip it quietly (uc == RTUNICP_INVALID (!= 0)). */ + AssertRC(rc); + } + } while (uc != 0); + + return false; +} +RT_EXPORT_SYMBOL(RTStrIsCaseFoldable); + + +RTDECL(bool) RTStrIsUpperCased(const char *psz) +{ + /* + * Check that there are no lower case chars in the string. + */ + RTUNICP uc; + do + { + int rc = RTStrGetCpEx(&psz, &uc); + if (RT_SUCCESS(rc)) + { + if (RTUniCpIsLower(uc)) + return false; + } + else + { + /* bad encoding, just skip it quietly (uc == RTUNICP_INVALID (!= 0)). */ + AssertRC(rc); + } + } while (uc != 0); + + return true; +} +RT_EXPORT_SYMBOL(RTStrIsUpperCased); + + +RTDECL(bool) RTStrIsLowerCased(const char *psz) +{ + /* + * Check that there are no lower case chars in the string. + */ + RTUNICP uc; + do + { + int rc = RTStrGetCpEx(&psz, &uc); + if (RT_SUCCESS(rc)) + { + if (RTUniCpIsUpper(uc)) + return false; + } + else + { + /* bad encoding, just skip it quietly (uc == RTUNICP_INVALID (!= 0)). */ + AssertRC(rc); + } + } while (uc != 0); + + return true; +} +RT_EXPORT_SYMBOL(RTStrIsLowerCased); + |