operator== for Directives, skips reparse if equal
This commit is contained in:
parent
6f7f3800d3
commit
182d3052c5
@ -62,6 +62,32 @@ Directives::Directives(const char* directives) {
|
|||||||
parse(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 {
|
void Directives::loadOperations() const {
|
||||||
if (!shared)
|
if (!shared)
|
||||||
return;
|
return;
|
||||||
|
@ -45,6 +45,10 @@ public:
|
|||||||
Directives(String&& directives);
|
Directives(String&& directives);
|
||||||
Directives(const char* directives);
|
Directives(const char* directives);
|
||||||
|
|
||||||
|
Directives& operator=(String const& s);
|
||||||
|
Directives& operator=(String&& s);
|
||||||
|
Directives& operator=(const char* s);
|
||||||
|
|
||||||
void loadOperations() const;
|
void loadOperations() const;
|
||||||
void parse(String&& directives);
|
void parse(String&& directives);
|
||||||
String string() const;
|
String string() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user