mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
Added move semantics to FString class
This commit is contained in:
parent
7d97963005
commit
3e43572a87
2 changed files with 17 additions and 0 deletions
|
@ -211,6 +211,21 @@ FString &FString::operator = (const FString &other)
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FString &FString::operator = (FString &&other)
|
||||||
|
{
|
||||||
|
assert (Chars != NULL);
|
||||||
|
|
||||||
|
if (&other != this)
|
||||||
|
{
|
||||||
|
Data()->Release();
|
||||||
|
Chars = other.Chars;
|
||||||
|
other.ResetToNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
FString &FString::operator = (const char *copyStr)
|
FString &FString::operator = (const char *copyStr)
|
||||||
{
|
{
|
||||||
if (copyStr != Chars)
|
if (copyStr != Chars)
|
||||||
|
|
|
@ -124,6 +124,7 @@ public:
|
||||||
|
|
||||||
// Copy constructors
|
// Copy constructors
|
||||||
FString (const FString &other) { AttachToOther (other); }
|
FString (const FString &other) { AttachToOther (other); }
|
||||||
|
FString (FString &&other) : Chars(other.Chars) { other.ResetToNull(); }
|
||||||
FString (const char *copyStr);
|
FString (const char *copyStr);
|
||||||
FString (const char *copyStr, size_t copyLen);
|
FString (const char *copyStr, size_t copyLen);
|
||||||
FString (char oneChar);
|
FString (char oneChar);
|
||||||
|
@ -165,6 +166,7 @@ public:
|
||||||
const char &operator[] (unsigned long long index) const { return Chars[index]; }
|
const char &operator[] (unsigned long long index) const { return Chars[index]; }
|
||||||
|
|
||||||
FString &operator = (const FString &other);
|
FString &operator = (const FString &other);
|
||||||
|
FString &operator = (FString &&other);
|
||||||
FString &operator = (const char *copyStr);
|
FString &operator = (const char *copyStr);
|
||||||
|
|
||||||
FString operator + (const FString &tail) const;
|
FString operator + (const FString &tail) const;
|
||||||
|
|
Loading…
Reference in a new issue