diff options
Diffstat (limited to 'src/3rdparty/angle/src/common/string_utils.h')
-rw-r--r-- | src/3rdparty/angle/src/common/string_utils.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/3rdparty/angle/src/common/string_utils.h b/src/3rdparty/angle/src/common/string_utils.h index 131b17e086..07bf1ff81a 100644 --- a/src/3rdparty/angle/src/common/string_utils.h +++ b/src/3rdparty/angle/src/common/string_utils.h @@ -13,6 +13,8 @@ #include <string> #include <vector> +#include "common/Optional.h" + namespace angle { @@ -44,6 +46,40 @@ bool HexStringToUInt(const std::string &input, unsigned int *uintOut); bool ReadFileToString(const std::string &path, std::string *stringOut); -} +Optional<std::vector<wchar_t>> WidenString(size_t length, const char *cString); + +// Check if the string str begins with the given prefix. +// The comparison is case sensitive. +bool BeginsWith(const std::string &str, const std::string &prefix); + +// Check if the string str begins with the given prefix. +// Prefix may not be NULL and needs to be NULL terminated. +// The comparison is case sensitive. +bool BeginsWith(const std::string &str, const char *prefix); + +// Check if the string str begins with the given prefix. +// str and prefix may not be NULL and need to be NULL terminated. +// The comparison is case sensitive. +bool BeginsWith(const char *str, const char *prefix); + +// Check if the string str begins with the first prefixLength characters of the given prefix. +// The length of the prefix string should be greater than or equal to prefixLength. +// The comparison is case sensitive. +bool BeginsWith(const std::string &str, const std::string &prefix, const size_t prefixLength); + +// Check if the string str ends with the given suffix. +// Suffix may not be NUL and needs to be NULL terminated. +// The comparison is case sensitive. +bool EndsWith(const std::string& str, const char* suffix); + +// Convert to lower-case. +void ToLower(std::string *str); + +// Replaces the substring 'substring' in 'str' with 'replacement'. Returns true if successful. +bool ReplaceSubstring(std::string *str, + const std::string &substring, + const std::string &replacement); + +} // namespace angle #endif // LIBANGLE_STRING_UTILS_H_ |