diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-01-03 19:17:19 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-01-03 19:17:19 +1100 |
commit | 98b27f5f6578d9f3b204bc98baf6f4e489c8a1c1 (patch) | |
tree | 11760927a0a3869d7b9fefca302a92a27692d461 /source/core/StarDirectives.cpp | |
parent | 9e605b182da26bd9fc2f28805d5f08c6764e47a3 (diff) |
Update StarDirectives.cpp
Diffstat (limited to 'source/core/StarDirectives.cpp')
-rw-r--r-- | source/core/StarDirectives.cpp | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp index 4db3837..6c335a5 100644 --- a/source/core/StarDirectives.cpp +++ b/source/core/StarDirectives.cpp @@ -50,6 +50,7 @@ Directives::Shared::Shared(List<Entry>&& givenEntries, String&& givenString, Str } Directives::Directives() {} + Directives::Directives(String const& directives) { parse(String(directives)); } @@ -62,29 +63,49 @@ Directives::Directives(const char* directives) { parse(directives); } -Directives& Directives::operator=(String const& directives) { - if (shared && shared->string == directives) +Directives::Directives(Directives&& directives) { + *this = move(directives); +} + +Directives::Directives(Directives const& directives) { + *this = directives; +} + +Directives::~Directives() {} + +Directives& Directives::operator=(String const& s) { + if (shared && shared->string == s) return *this; - parse(String(directives)); + parse(String(s)); return *this; } -Directives& Directives::operator=(String&& directives) { - if (shared && shared->string == directives) { - directives.clear(); +Directives& Directives::operator=(String&& s) { + if (shared && shared->string == s) { + s.clear(); return *this; } - parse(move(directives)); + parse(move(s)); return *this; } -Directives& Directives::operator=(const char* directives) { - if (shared && shared->string.utf8().compare(directives) == 0) +Directives& Directives::operator=(const char* s) { + if (shared && shared->string.utf8().compare(s) == 0) return *this; - parse(directives); + parse(s); + return *this; +} + +Directives& Directives::operator=(Directives&& other) { + shared = move(other.shared); + return *this; +} + +Directives& Directives::operator=(Directives const& other) { + shared = other.shared; return *this; } |