[Scummvm-git-logs] scummvm master -> 0b93a68a0d4853db495b2895c76ac67be321878f
criezy
criezy at scummvm.org
Sat Oct 31 16:57:09 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
23ce3edac9 COMMON: Add contains overload for char32_t in String
0b93a68a0d COMMON: Attempt to fix compilation for some compilers
Commit: 23ce3edac9433d3d1fcb45c60a72a21a033d2196
https://github.com/scummvm/scummvm/commit/23ce3edac9433d3d1fcb45c60a72a21a033d2196
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-31T16:56:50Z
Commit Message:
COMMON: Add contains overload for char32_t in String
Changed paths:
common/str.cpp
common/str.h
diff --git a/common/str.cpp b/common/str.cpp
index fb1dba44e6..01eed6dcea 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -176,6 +176,12 @@ bool String::contains(uint32 x) const {
return false;
}
+#ifdef USE_CXX11
+bool String::contains(char32_t x) const {
+ return contains((uint32)x);
+}
+#endif
+
#ifndef SCUMMVM_UTIL
bool String::matchString(const char *pat, bool ignoreCase, bool pathMode) const {
diff --git a/common/str.h b/common/str.h
index 6b1113aa64..9e259fbf87 100644
--- a/common/str.h
+++ b/common/str.h
@@ -118,6 +118,9 @@ public:
bool contains(const char *x) const;
bool contains(char x) const;
bool contains(uint32 x) const;
+#ifdef USE_CXX11
+ bool contains(char32_t x) const;
+#endif
/**
* Simple DOS-style pattern matching function (understands * and ? like used in DOS).
Commit: 0b93a68a0d4853db495b2895c76ac67be321878f
https://github.com/scummvm/scummvm/commit/0b93a68a0d4853db495b2895c76ac67be321878f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-31T16:56:50Z
Commit Message:
COMMON: Attempt to fix compilation for some compilers
Changed paths:
common/str.cpp
common/str.h
common/ustr.cpp
common/ustr.h
diff --git a/common/str.cpp b/common/str.cpp
index 01eed6dcea..be6a2c6e92 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -30,7 +30,7 @@
namespace Common {
String::String(char c)
- : BaseString() {
+ : BaseString<char>() {
_storage[0] = c;
_storage[1] = 0;
@@ -40,7 +40,7 @@ String::String(char c)
#ifndef SCUMMVM_UTIL
String::String(const U32String &str)
- : BaseString() {
+ : BaseString<char>() {
_storage[0] = 0;
*this = String(str.encode());
}
diff --git a/common/str.h b/common/str.h
index 9e259fbf87..aa40bd6839 100644
--- a/common/str.h
+++ b/common/str.h
@@ -67,19 +67,19 @@ public:
typedef unsigned char unsigned_type;
/** Construct a new empty string. */
- String() : BaseString() {}
+ String() : BaseString<char>() {}
/** Construct a new string from the given NULL-terminated C string. */
- String(const char *str) : BaseString(str) {}
+ String(const char *str) : BaseString<char>(str) {}
/** Construct a new string containing exactly len characters read from address str. */
- String(const char *str, uint32 len) : BaseString(str, len) {}
+ String(const char *str, uint32 len) : BaseString<char>(str, len) {}
/** Construct a new string containing the characters between beginP (including) and endP (excluding). */
- String(const char *beginP, const char *endP) : BaseString(beginP, endP) {}
+ String(const char *beginP, const char *endP) : BaseString<char>(beginP, endP) {}
/** Construct a copy of the given string. */
- String(const String &str) : BaseString(str) {};
+ String(const String &str) : BaseString<char>(str) {};
/** Construct a string consisting of the given character. */
explicit String(char c);
diff --git a/common/ustr.cpp b/common/ustr.cpp
index a4bad790a6..20047d7afa 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -28,7 +28,7 @@
namespace Common {
-U32String::U32String(const char *str) : BaseString() {
+U32String::U32String(const char *str) : BaseString<u32char_type_t>() {
if (str == nullptr) {
_storage[0] = 0;
_size = 0;
@@ -37,20 +37,20 @@ U32String::U32String(const char *str) : BaseString() {
}
}
-U32String::U32String(const char *str, uint32 len) : BaseString() {
+U32String::U32String(const char *str, uint32 len) : BaseString<u32char_type_t>() {
initWithCStr(str, len);
}
-U32String::U32String(const char *beginP, const char *endP) : BaseString() {
+U32String::U32String(const char *beginP, const char *endP) : BaseString<u32char_type_t>() {
assert(endP >= beginP);
initWithCStr(beginP, endP - beginP);
}
-U32String::U32String(const String &str) : BaseString() {
+U32String::U32String(const String &str) : BaseString<u32char_type_t>() {
initWithCStr(str.c_str(), str.size());
}
-U32String::U32String(const UnicodeBiDiText &txt) : BaseString() {
+U32String::U32String(const UnicodeBiDiText &txt) : BaseString<u32char_type_t>() {
initWithValueTypeStr(txt.visual.c_str(), txt.visual.size());
}
diff --git a/common/ustr.h b/common/ustr.h
index c602b1d1eb..f145ec655e 100644
--- a/common/ustr.h
+++ b/common/ustr.h
@@ -64,25 +64,25 @@ public:
typedef uint32 unsigned_type;
public:
/** Construct a new empty string. */
- U32String() : BaseString() {}
+ U32String() : BaseString<u32char_type_t>() {}
/** Construct a new string from the given NULL-terminated C string. */
- explicit U32String(const value_type *str) : BaseString(str) {}
+ explicit U32String(const value_type *str) : BaseString<u32char_type_t>(str) {}
/** Construct a new string containing exactly len characters read from address str. */
- U32String(const value_type *str, uint32 len) : BaseString(str, len) {}
+ U32String(const value_type *str, uint32 len) : BaseString<u32char_type_t>(str, len) {}
#ifdef USE_CXX11
- explicit U32String(const uint32 *str) : BaseString((const value_type *) str) {}
- U32String(const uint32 *str, uint32 len) : BaseString((const value_type *) str, len) {}
- U32String(const uint32 *beginP, const uint32 *endP) : BaseString((const value_type *) beginP, (const value_type *) endP) {}
+ explicit U32String(const uint32 *str) : BaseString<u32char_type_t>((const value_type *) str) {}
+ U32String(const uint32 *str, uint32 len) : BaseString<u32char_type_t>((const value_type *) str, len) {}
+ U32String(const uint32 *beginP, const uint32 *endP) : BaseString<u32char_type_t>((const value_type *) beginP, (const value_type *) endP) {}
#endif
/** Construct a new string containing the characters between beginP (including) and endP (excluding). */
- U32String(const value_type *beginP, const value_type *endP) : BaseString(beginP, endP) {}
+ U32String(const value_type *beginP, const value_type *endP) : BaseString<u32char_type_t>(beginP, endP) {}
/** Construct a copy of the given string. */
- U32String(const U32String &str) : BaseString(str) {}
+ U32String(const U32String &str) : BaseString<u32char_type_t>(str) {}
/** Construct a copy of the given unicode BiDi converted string. */
U32String(const UnicodeBiDiText &txt);
More information about the Scummvm-git-logs
mailing list