From 98b27f5f6578d9f3b204bc98baf6f4e489c8a1c1 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 3 Jan 2024 19:17:19 +1100 Subject: Update StarDirectives.cpp --- source/core/StarDirectives.cpp | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'source/core/StarDirectives.cpp') 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&& 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; } -- cgit v1.2.3