[Scummvm-git-logs] scummvm master -> efa9a0f2504f8136c3937b1282a009e27773b40a
criezy
criezy at scummvm.org
Sat Nov 7 18:13:27 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
efa9a0f250 COMMON: Add conversion operator from UnicodeBiDiText to U32String
Commit: efa9a0f2504f8136c3937b1282a009e27773b40a
https://github.com/scummvm/scummvm/commit/efa9a0f2504f8136c3937b1282a009e27773b40a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-11-07T18:10:44Z
Commit Message:
COMMON: Add conversion operator from UnicodeBiDiText to U32String
This replaces the U32String constructor that takes a UnicodeBiDiText
and serves the same purpose, but avoids making a copy.
Changed paths:
common/unicode-bidi.h
common/ustr.cpp
common/ustr.h
diff --git a/common/unicode-bidi.h b/common/unicode-bidi.h
index 995673802a..6c7465489c 100644
--- a/common/unicode-bidi.h
+++ b/common/unicode-bidi.h
@@ -42,6 +42,11 @@ public:
UnicodeBiDiText(const Common::String &str, const Common::CodePage page);
~UnicodeBiDiText();
+ /**
+ * Implicit conversion to U32String to get the visual representation.
+ */
+ operator const U32String &() const { return visual; }
+
uint32 getVisualPosition(uint32 logicalPos) const;
uint32 getLogicalPosition(uint32 visualPos) const;
uint32 size() const { return logical.size(); }
diff --git a/common/ustr.cpp b/common/ustr.cpp
index 76e1b6d1e8..85bd362047 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -24,7 +24,6 @@
#include "common/str.h"
#include "common/memorypool.h"
#include "common/util.h"
-#include "unicode-bidi.h"
namespace Common {
@@ -50,10 +49,6 @@ U32String::U32String(const String &str) : BaseString<u32char_type_t>() {
initWithCStr(str.c_str(), str.size());
}
-U32String::U32String(const UnicodeBiDiText &txt) : BaseString<u32char_type_t>() {
- initWithValueTypeStr(txt.visual.c_str(), txt.visual.size());
-}
-
U32String &U32String::operator=(const U32String &str) {
assign(str);
return *this;
diff --git a/common/ustr.h b/common/ustr.h
index b7973bb862..53cb795879 100644
--- a/common/ustr.h
+++ b/common/ustr.h
@@ -39,7 +39,6 @@ namespace Common {
*/
class String;
-class UnicodeBiDiText;
/**
* Very simple string class for UTF-32 strings in ScummVM. The main intention
@@ -84,9 +83,6 @@ public:
/** Construct a copy of the given string. */
U32String(const U32String &str) : BaseString<u32char_type_t>(str) {}
- /** Construct a copy of the given unicode BiDi converted string. */
- U32String(const UnicodeBiDiText &txt);
-
/** Construct a new string from the given NULL-terminated C string. */
explicit U32String(const char *str);
More information about the Scummvm-git-logs
mailing list