Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-24 20:10:53 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-24 20:10:53 +1000
commitaa08eaac993a309d3aebc2cd4321513a1e413254 (patch)
tree90f1ed94fbc001dac8a3719b70bc725f0fb03b9c /source/core
parent7bde128a87268751e1f46174a64ffd78b03bf8bc (diff)
Compileable now
Diffstat (limited to 'source/core')
-rw-r--r--source/core/StarDirectives.cpp23
-rw-r--r--source/core/StarDirectives.hpp8
2 files changed, 19 insertions, 12 deletions
diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp
index 766b4d9..e486ea9 100644
--- a/source/core/StarDirectives.cpp
+++ b/source/core/StarDirectives.cpp
@@ -5,6 +5,11 @@
namespace Star {
+Directives::Entry::Entry(ImageOperation&& newOperation, String&& newString) {
+ operation = move(newOperation);
+ string = move(newString);
+}
+
Directives::Directives() {}
Directives::Directives(String const& directives) {
parse(directives);
@@ -60,14 +65,6 @@ inline bool DirectivesGroup::compare(DirectivesGroup const& other) const {
return hash() == other.hash();
}
-inline bool DirectivesGroup::operator==(DirectivesGroup const& other) const {
- return compare(other);
-}
-
-inline bool DirectivesGroup::operator!=(DirectivesGroup const& other) const {
- return !compare(other);
-}
-
void DirectivesGroup::append(Directives const& directives) {
m_directives.push_back(directives);
m_count += m_directives.back().entries->size();
@@ -127,7 +124,15 @@ inline size_t DirectivesGroup::hash() const {
return hasher.digest();
}
-inline size_t hash<DirectivesGroup>::operator()(DirectivesGroup const& s) const {
+bool operator==(DirectivesGroup const& a, DirectivesGroup const& b) {
+ return a.compare(b);
+}
+
+bool operator!=(DirectivesGroup const& a, DirectivesGroup const& b) {
+ return !a.compare(b);
+}
+
+size_t hash<DirectivesGroup>::operator()(DirectivesGroup const& s) const {
return s.hash();
}
diff --git a/source/core/StarDirectives.hpp b/source/core/StarDirectives.hpp
index 92dfd46..e954387 100644
--- a/source/core/StarDirectives.hpp
+++ b/source/core/StarDirectives.hpp
@@ -15,7 +15,7 @@ struct Directives {
ImageOperation operation;
String string;
- Entry(ImageOperation&& operation, String&& string);
+ Entry(ImageOperation&& newOperation, String&& newString);
};
Directives();
@@ -40,8 +40,6 @@ public:
inline bool empty() const;
bool compare(DirectivesGroup const& other) const;
- inline bool operator==(DirectivesGroup const& other) const;
- inline bool operator!=(DirectivesGroup const& other) const;
void append(Directives const& other);
DirectivesGroup& operator+=(Directives const& other);
@@ -58,6 +56,9 @@ public:
void applyExistingImage(Image& image) const;
inline size_t hash() const;
+
+ friend bool operator==(DirectivesGroup const& a, DirectivesGroup const& b);
+ friend bool operator!=(DirectivesGroup const& a, DirectivesGroup const& b);
private:
void buildString(String& string, const DirectivesGroup& directives) const;
@@ -65,6 +66,7 @@ private:
size_t m_count;
};
+
template <>
struct hash<DirectivesGroup> {
size_t operator()(DirectivesGroup const& s) const;