Compileable now

This commit is contained in:
Kae 2023-06-24 20:10:53 +10:00
parent 7bde128a87
commit aa08eaac99
2 changed files with 19 additions and 12 deletions

View File

@ -5,6 +5,11 @@
namespace Star { namespace Star {
Directives::Entry::Entry(ImageOperation&& newOperation, String&& newString) {
operation = move(newOperation);
string = move(newString);
}
Directives::Directives() {} Directives::Directives() {}
Directives::Directives(String const& directives) { Directives::Directives(String const& directives) {
parse(directives); parse(directives);
@ -60,14 +65,6 @@ inline bool DirectivesGroup::compare(DirectivesGroup const& other) const {
return hash() == other.hash(); 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) { void DirectivesGroup::append(Directives const& directives) {
m_directives.push_back(directives); m_directives.push_back(directives);
m_count += m_directives.back().entries->size(); m_count += m_directives.back().entries->size();
@ -127,7 +124,15 @@ inline size_t DirectivesGroup::hash() const {
return hasher.digest(); 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(); return s.hash();
} }

View File

@ -15,7 +15,7 @@ struct Directives {
ImageOperation operation; ImageOperation operation;
String string; String string;
Entry(ImageOperation&& operation, String&& string); Entry(ImageOperation&& newOperation, String&& newString);
}; };
Directives(); Directives();
@ -40,8 +40,6 @@ public:
inline bool empty() const; inline bool empty() const;
bool compare(DirectivesGroup const& other) 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); void append(Directives const& other);
DirectivesGroup& operator+=(Directives const& other); DirectivesGroup& operator+=(Directives const& other);
@ -58,6 +56,9 @@ public:
void applyExistingImage(Image& image) const; void applyExistingImage(Image& image) const;
inline size_t hash() 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: private:
void buildString(String& string, const DirectivesGroup& directives) const; void buildString(String& string, const DirectivesGroup& directives) const;
@ -65,6 +66,7 @@ private:
size_t m_count; size_t m_count;
}; };
template <> template <>
struct hash<DirectivesGroup> { struct hash<DirectivesGroup> {
size_t operator()(DirectivesGroup const& s) const; size_t operator()(DirectivesGroup const& s) const;