aboutsummaryrefslogtreecommitdiff
path: root/include/StringView.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-04-23 13:30:03 +0200
committerdec05eba <dec05eba@protonmail.com>2018-04-23 13:30:58 +0200
commit3ab4127ae3fc3b837f5350509c78db03467500cd (patch)
tree5f56c61c0129b8dff0f8feea4d6f93d4cd656560 /include/StringView.hpp
parentddff0f1b7ea84f6a1321b8eb8a4d47317873d955 (diff)
Add support for big emoji if it's the only thing on a line
TODO: Currently message board renders directly to window, it should render to render target for optimization purpose
Diffstat (limited to 'include/StringView.hpp')
-rw-r--r--include/StringView.hpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/StringView.hpp b/include/StringView.hpp
index 4e9066b..9eea387 100644
--- a/include/StringView.hpp
+++ b/include/StringView.hpp
@@ -15,7 +15,7 @@ namespace dchat
}
- BasicStringView(const BasicStringView<CharType> &other) : data(other.data), size(other.size)
+ BasicStringView(const BasicStringView<CharType> &other) : data(other.data), size(other.size)
{
}
@@ -30,13 +30,14 @@ namespace dchat
}
- BasicStringView<CharType> operator = (const BasicStringView<CharType> &other)
+ BasicStringView<CharType>& operator = (const BasicStringView<CharType> &other)
{
- BasicStringView<CharType> result(other.data, other.size);
- return result;
+ data = other.data;
+ size = other.size;
+ return *this;
}
- BasicStringView( BasicStringView<CharType> &&other)
+ BasicStringView(BasicStringView<CharType> &&other)
{
data = other.data;
size = other.size;
@@ -45,10 +46,10 @@ namespace dchat
other.size = 0;
}
- bool equals(const BasicStringView<CharType> &other) const
+ bool equals(const BasicStringView<CharType> &other) const
{
if(size != other.size) return false;
- return memcmp(data, other.data, size) == 0;
+ return memcmp(data, other.data, size * sizeof(CharType)) == 0;
}
CharType operator [] (usize index) const