diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp index 3381f1f..dfea7b0 100644 --- a/source/core/StarDirectives.cpp +++ b/source/core/StarDirectives.cpp @@ -62,6 +62,32 @@ Directives::Directives(const char* directives) { parse(directives); } +Directives& Directives::operator=(String const& directives) { + if (shared && shared->string == directives) + return *this; + + parse(String(directives)); + return *this; +} + +Directives& Directives::operator=(String&& directives) { + if (shared && shared->string == directives) { + directives.clear(); + return *this; + } + + parse(move(directives)); + return *this; +} + +Directives& Directives::operator=(const char* directives) { + if (shared && shared->string.utf8().compare(directives) == 0) + return *this; + + parse(directives); + return *this; +} + void Directives::loadOperations() const { if (!shared) return; diff --git a/source/core/StarDirectives.hpp b/source/core/StarDirectives.hpp index 9936c51..d15d095 100644 --- a/source/core/StarDirectives.hpp +++ b/source/core/StarDirectives.hpp @@ -45,6 +45,10 @@ public: Directives(String&& directives); Directives(const char* directives); + Directives& operator=(String const& s); + Directives& operator=(String&& s); + Directives& operator=(const char* s); + void loadOperations() const; void parse(String&& directives); String string() const;