diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-24 22:49:47 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-24 22:49:47 +1000 |
commit | 7eb010d4a1c6a90d5040b3ec2e7d189fb387b9b2 (patch) | |
tree | 44445bce5cee5387511ac0045072539f5a928294 /source/core/StarDirectives.hpp | |
parent | aa08eaac993a309d3aebc2cd4321513a1e413254 (diff) |
Pretty much working now
Diffstat (limited to 'source/core/StarDirectives.hpp')
-rw-r--r-- | source/core/StarDirectives.hpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/core/StarDirectives.hpp b/source/core/StarDirectives.hpp index e954387..ca4364c 100644 --- a/source/core/StarDirectives.hpp +++ b/source/core/StarDirectives.hpp @@ -3,28 +3,40 @@ #include "StarImageProcessing.hpp" #include "StarHash.hpp" +#include "StarDataStream.hpp" namespace Star { +STAR_CLASS(Directives); STAR_CLASS(DirectivesGroup); STAR_EXCEPTION(DirectivesException, StarException); // Kae: My attempt at reducing memory allocation and per-frame string parsing for extremely long directives -struct Directives { +// entries must never be a null ptr! +class Directives { +public: struct Entry { ImageOperation operation; String string; Entry(ImageOperation&& newOperation, String&& newString); + Entry(ImageOperation const& newOperation, String const& newString); + Entry(Entry const& other); }; Directives(); Directives(String const& directives); Directives(String&& directives); + Directives(const char* directives); + Directives(List<Entry>&& entries); void parse(String const& directives); - void buildString(String& out) const; + String toString() const; + inline bool empty() const; + + friend DataStream& operator>>(DataStream& ds, Directives& directives); + friend DataStream& operator<<(DataStream& ds, Directives const& directives); std::shared_ptr<List<Entry> const> entries; size_t hash = 0; @@ -41,6 +53,9 @@ public: inline bool empty() const; bool compare(DirectivesGroup const& other) const; void append(Directives const& other); + void append(List<Directives::Entry>&& entries); + void clear(); + DirectivesGroup& operator+=(Directives const& other); inline String toString() const; |