2023-06-25 15:42:18 +00:00
|
|
|
#include "StarDirectives.hpp"
|
2023-06-23 15:30:55 +00:00
|
|
|
#include "StarImage.hpp"
|
|
|
|
#include "StarImageProcessing.hpp"
|
2023-06-24 03:06:13 +00:00
|
|
|
#include "StarXXHash.hpp"
|
2023-06-24 13:38:27 +00:00
|
|
|
#include "StarLogging.hpp"
|
2023-06-23 15:30:55 +00:00
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
Directives::Entry::Entry(ImageOperation&& newOperation, size_t strBegin, size_t strLength) {
|
2024-02-19 15:55:19 +00:00
|
|
|
operation = std::move(newOperation);
|
2023-06-25 15:42:18 +00:00
|
|
|
begin = strBegin;
|
|
|
|
length = strLength;
|
2023-06-24 10:10:53 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
Directives::Entry::Entry(ImageOperation const& newOperation, size_t strBegin, size_t strLength) {
|
2023-06-24 12:49:47 +00:00
|
|
|
operation = newOperation;
|
2023-06-25 15:42:18 +00:00
|
|
|
begin = strBegin;
|
|
|
|
length = strLength;
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Directives::Entry::Entry(Entry const& other) {
|
|
|
|
operation = other.operation;
|
2023-06-25 15:42:18 +00:00
|
|
|
begin = other.begin;
|
|
|
|
length = other.length;
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 17:38:57 +00:00
|
|
|
ImageOperation const& Directives::Entry::loadOperation(Shared const& parent) const {
|
|
|
|
if (operation.is<NullImageOperation>()) {
|
|
|
|
try { operation = imageOperationFromString(string(parent)); }
|
|
|
|
catch (StarException const& e) { operation = ErrorImageOperation{ std::current_exception() }; }
|
|
|
|
}
|
|
|
|
return operation;
|
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
StringView Directives::Entry::string(Shared const& parent) const {
|
2023-06-25 15:51:57 +00:00
|
|
|
StringView result = parent.string;
|
|
|
|
result = result.utf8().substr(begin, length);
|
2023-06-25 15:42:18 +00:00
|
|
|
return result;
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
bool Directives::Shared::empty() const {
|
|
|
|
return entries.empty();
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2024-04-21 20:07:59 +00:00
|
|
|
Directives::Shared::Shared() {}
|
|
|
|
|
2023-06-26 05:34:41 +00:00
|
|
|
Directives::Shared::Shared(List<Entry>&& givenEntries, String&& givenString, StringView givenPrefix) {
|
2024-02-19 15:55:19 +00:00
|
|
|
entries = std::move(givenEntries);
|
|
|
|
string = std::move(givenString);
|
2023-06-26 05:34:41 +00:00
|
|
|
prefix = givenPrefix;
|
2024-03-22 08:12:45 +00:00
|
|
|
hash = string.empty() ? 0 : XXH3_64bits(string.utf8Ptr(), string.utf8Size());
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
Directives::Directives() {}
|
2024-01-03 08:17:19 +00:00
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
Directives::Directives(String const& directives) {
|
|
|
|
parse(String(directives));
|
|
|
|
}
|
|
|
|
|
|
|
|
Directives::Directives(String&& directives) {
|
2024-02-19 15:55:19 +00:00
|
|
|
parse(std::move(directives));
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
Directives::Directives(const char* directives) {
|
|
|
|
parse(directives);
|
|
|
|
}
|
|
|
|
|
2024-03-22 08:12:45 +00:00
|
|
|
Directives::Directives(Directives&& directives) noexcept {
|
2024-02-19 15:55:19 +00:00
|
|
|
*this = std::move(directives);
|
2024-01-03 08:17:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Directives::Directives(Directives const& directives) {
|
|
|
|
*this = directives;
|
|
|
|
}
|
|
|
|
|
|
|
|
Directives::~Directives() {}
|
|
|
|
|
|
|
|
Directives& Directives::operator=(String const& s) {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (m_shared && m_shared->string == s)
|
2023-08-30 17:14:48 +00:00
|
|
|
return *this;
|
|
|
|
|
2024-01-03 08:17:19 +00:00
|
|
|
parse(String(s));
|
2023-08-30 17:14:48 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2024-01-03 08:17:19 +00:00
|
|
|
Directives& Directives::operator=(String&& s) {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (m_shared && m_shared->string == s) {
|
2024-01-03 08:17:19 +00:00
|
|
|
s.clear();
|
2023-08-30 17:14:48 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2024-02-19 15:55:19 +00:00
|
|
|
parse(std::move(s));
|
2023-08-30 17:14:48 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2024-01-03 08:17:19 +00:00
|
|
|
Directives& Directives::operator=(const char* s) {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (m_shared && m_shared->string.utf8().compare(s) == 0)
|
2023-08-30 17:14:48 +00:00
|
|
|
return *this;
|
|
|
|
|
2024-01-03 08:17:19 +00:00
|
|
|
parse(s);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2024-03-22 08:12:45 +00:00
|
|
|
Directives& Directives::operator=(Directives&& other) noexcept {
|
2024-04-21 20:07:59 +00:00
|
|
|
m_shared = std::move(other.m_shared);
|
2024-01-03 08:17:19 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Directives& Directives::operator=(Directives const& other) {
|
2024-04-21 20:07:59 +00:00
|
|
|
m_shared = other.m_shared;
|
2023-08-30 17:14:48 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2023-06-26 17:38:57 +00:00
|
|
|
void Directives::loadOperations() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (!m_shared)
|
2023-06-26 17:38:57 +00:00
|
|
|
return;
|
|
|
|
|
2024-04-21 20:07:59 +00:00
|
|
|
MutexLocker locker(m_shared->mutex, false);
|
|
|
|
if (!m_shared.unique())
|
|
|
|
locker.lock();
|
|
|
|
for (auto& entry : m_shared->entries)
|
|
|
|
entry.loadOperation(*m_shared);
|
2023-06-26 17:38:57 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
void Directives::parse(String&& directives) {
|
2023-09-05 06:42:44 +00:00
|
|
|
if (directives.empty()) {
|
2024-04-21 20:07:59 +00:00
|
|
|
m_shared.reset();
|
2023-06-24 13:38:27 +00:00
|
|
|
return;
|
2023-09-05 06:42:44 +00:00
|
|
|
}
|
2023-06-24 13:38:27 +00:00
|
|
|
|
2024-02-29 08:09:10 +00:00
|
|
|
List<Entry> entries;
|
2023-06-26 05:34:41 +00:00
|
|
|
StringView view(directives);
|
|
|
|
StringView prefix = "";
|
|
|
|
view.forEachSplitView("?", [&](StringView split, size_t beg, size_t end) {
|
2023-06-25 15:42:18 +00:00
|
|
|
if (!split.empty()) {
|
2023-06-26 17:38:57 +00:00
|
|
|
if (beg == 0) {
|
|
|
|
try {
|
|
|
|
ImageOperation operation = imageOperationFromString(split);
|
2024-02-29 08:09:10 +00:00
|
|
|
entries.emplace_back(std::move(operation), beg, end);
|
2023-06-26 17:38:57 +00:00
|
|
|
}
|
|
|
|
catch (StarException const& e) {
|
2023-06-26 05:34:41 +00:00
|
|
|
prefix = split;
|
2023-06-26 17:38:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ImageOperation operation = NullImageOperation();
|
2024-02-29 08:09:10 +00:00
|
|
|
entries.emplace_back(std::move(operation), beg, end);
|
2023-06-24 15:16:40 +00:00
|
|
|
}
|
2023-06-24 09:41:52 +00:00
|
|
|
}
|
2024-02-29 08:09:10 +00:00
|
|
|
});
|
2023-06-24 13:38:27 +00:00
|
|
|
|
2024-02-29 08:09:10 +00:00
|
|
|
if (entries.empty() && !prefix.empty()) {
|
2024-04-21 20:07:59 +00:00
|
|
|
m_shared.reset();
|
2023-06-24 13:38:27 +00:00
|
|
|
return;
|
2023-09-05 06:42:44 +00:00
|
|
|
}
|
2023-06-24 13:38:27 +00:00
|
|
|
|
2024-04-21 20:07:59 +00:00
|
|
|
m_shared = std::make_shared<Shared const>(std::move(entries), std::move(directives), prefix);
|
2024-02-29 08:09:10 +00:00
|
|
|
if (view.utf8().size() < 1000) { // Pre-load short enough directives
|
2024-04-21 20:07:59 +00:00
|
|
|
for (auto& entry : m_shared->entries)
|
|
|
|
entry.loadOperation(*m_shared);
|
2023-06-27 09:24:35 +00:00
|
|
|
}
|
2023-06-25 15:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String Directives::string() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (!m_shared)
|
2023-06-25 15:42:18 +00:00
|
|
|
return "";
|
|
|
|
else
|
2024-04-21 20:07:59 +00:00
|
|
|
return m_shared->string;
|
2023-06-25 15:42:18 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 05:34:41 +00:00
|
|
|
StringView Directives::prefix() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (!m_shared)
|
2023-06-26 05:34:41 +00:00
|
|
|
return "";
|
|
|
|
else
|
2024-04-21 20:07:59 +00:00
|
|
|
return m_shared->prefix;
|
2023-06-26 05:34:41 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
String const* Directives::stringPtr() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (!m_shared)
|
2023-06-25 15:42:18 +00:00
|
|
|
return nullptr;
|
|
|
|
else
|
2024-04-21 20:07:59 +00:00
|
|
|
return &m_shared->string;
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
|
|
|
|
String Directives::buildString() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (m_shared) {
|
|
|
|
String built = m_shared->prefix;
|
2023-06-26 05:34:41 +00:00
|
|
|
|
2024-04-21 20:07:59 +00:00
|
|
|
for (auto& entry : m_shared->entries) {
|
2023-06-25 15:42:18 +00:00
|
|
|
built += "?";
|
2024-04-21 20:07:59 +00:00
|
|
|
built += entry.string(*m_shared);
|
2023-06-24 13:38:27 +00:00
|
|
|
}
|
2023-06-26 05:34:41 +00:00
|
|
|
|
|
|
|
return built;
|
2023-06-24 09:41:52 +00:00
|
|
|
}
|
2023-06-24 15:16:40 +00:00
|
|
|
|
2023-06-26 05:34:41 +00:00
|
|
|
return String();
|
2023-06-25 15:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String& Directives::addToString(String& out) const {
|
|
|
|
if (!empty())
|
2024-04-21 20:07:59 +00:00
|
|
|
out += m_shared->string;
|
2023-06-24 15:16:40 +00:00
|
|
|
return out;
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 15:42:18 +00:00
|
|
|
size_t Directives::hash() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
return m_shared ? m_shared->hash : 0;
|
2023-06-25 15:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t Directives::size() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
return m_shared ? m_shared->entries.size() : 0;
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
bool Directives::empty() const {
|
2024-04-21 20:07:59 +00:00
|
|
|
return !m_shared || m_shared->empty();
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
2024-04-21 20:07:59 +00:00
|
|
|
Directives::operator bool() const {
|
|
|
|
return !empty();
|
|
|
|
}
|
2023-06-24 12:49:47 +00:00
|
|
|
|
2024-03-22 08:12:45 +00:00
|
|
|
bool Directives::equals(Directives const& other) const {
|
|
|
|
return hash() == other.hash();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Directives::equals(String const& string) const {
|
|
|
|
auto directiveString = stringPtr();
|
|
|
|
return directiveString ? string == *directiveString : string.empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Directives::operator==(Directives const& other) const {
|
|
|
|
return equals(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Directives::operator==(String const& string) const {
|
|
|
|
return equals(string);
|
|
|
|
}
|
|
|
|
|
2023-06-24 12:49:47 +00:00
|
|
|
DataStream& operator>>(DataStream& ds, Directives& directives) {
|
|
|
|
String string;
|
|
|
|
ds.read(string);
|
|
|
|
|
2024-02-19 15:55:19 +00:00
|
|
|
directives.parse(std::move(string));
|
2023-06-24 12:49:47 +00:00
|
|
|
|
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
DataStream& operator<<(DataStream & ds, Directives const& directives) {
|
2023-06-25 15:42:18 +00:00
|
|
|
if (directives)
|
2024-04-21 20:07:59 +00:00
|
|
|
ds.write(directives->string);
|
2023-06-25 15:42:18 +00:00
|
|
|
else
|
|
|
|
ds.write(String());
|
2023-06-24 12:49:47 +00:00
|
|
|
|
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
|
2024-03-22 08:12:45 +00:00
|
|
|
bool operator==(Directives const& d1, Directives const& d2) {
|
|
|
|
return d1.equals(d2);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(String const& string, Directives const& directives) {
|
|
|
|
return directives.equals(string);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(Directives const& directives, String const& string) {
|
|
|
|
return directives.equals(string);
|
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
DirectivesGroup::DirectivesGroup() : m_count(0) {}
|
2023-06-24 15:16:40 +00:00
|
|
|
DirectivesGroup::DirectivesGroup(String const& directives) : m_count(0) {
|
|
|
|
if (directives.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Directives parsed(directives);
|
|
|
|
if (parsed) {
|
2024-02-19 15:55:19 +00:00
|
|
|
m_directives.emplace_back(std::move(parsed));
|
2023-06-25 15:42:18 +00:00
|
|
|
m_count = m_directives.back().size();
|
2023-06-24 15:16:40 +00:00
|
|
|
}
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
2023-06-24 15:16:40 +00:00
|
|
|
DirectivesGroup::DirectivesGroup(String&& directives) : m_count(0) {
|
|
|
|
if (directives.empty()) {
|
|
|
|
directives.clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-02-19 15:55:19 +00:00
|
|
|
Directives parsed(std::move(directives));
|
2023-06-24 15:16:40 +00:00
|
|
|
if (parsed) {
|
2024-02-19 15:55:19 +00:00
|
|
|
m_directives.emplace_back(std::move(parsed));
|
2023-06-25 15:42:18 +00:00
|
|
|
m_count = m_directives.back().size();
|
2023-06-24 15:16:40 +00:00
|
|
|
}
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
bool DirectivesGroup::empty() const {
|
2023-06-24 09:41:52 +00:00
|
|
|
return m_count == 0;
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
DirectivesGroup::operator bool() const {
|
2023-06-24 15:16:40 +00:00
|
|
|
return empty();
|
|
|
|
}
|
|
|
|
|
2023-06-25 08:24:54 +00:00
|
|
|
bool DirectivesGroup::compare(DirectivesGroup const& other) const {
|
2023-06-24 09:41:52 +00:00
|
|
|
if (m_count != other.m_count)
|
|
|
|
return false;
|
2023-06-23 15:30:55 +00:00
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
if (empty())
|
|
|
|
return true;
|
2023-06-23 15:30:55 +00:00
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
return hash() == other.hash();
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
void DirectivesGroup::append(Directives const& directives) {
|
2023-06-24 12:49:47 +00:00
|
|
|
m_directives.emplace_back(directives);
|
2023-06-25 15:42:18 +00:00
|
|
|
m_count += m_directives.back().size();
|
2023-06-24 12:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DirectivesGroup::clear() {
|
|
|
|
m_directives.clear();
|
|
|
|
m_count = 0;
|
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
DirectivesGroup& DirectivesGroup::operator+=(Directives const& other) {
|
|
|
|
append(other);
|
|
|
|
return *this;
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
String DirectivesGroup::toString() const {
|
2023-06-24 09:41:52 +00:00
|
|
|
String string;
|
|
|
|
addToString(string);
|
|
|
|
return string;
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
void DirectivesGroup::addToString(String& string) const {
|
2024-04-21 20:07:59 +00:00
|
|
|
for (auto& directives : m_directives) {
|
|
|
|
if (directives) {
|
|
|
|
auto& dirString = directives->string;
|
2023-11-25 12:03:46 +00:00
|
|
|
if (!dirString.empty()) {
|
|
|
|
if (dirString.utf8().front() != '?')
|
|
|
|
string += "?";
|
|
|
|
string += dirString;
|
|
|
|
}
|
|
|
|
}
|
2024-04-21 20:07:59 +00:00
|
|
|
}
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
void DirectivesGroup::forEach(DirectivesCallback callback) const {
|
|
|
|
for (auto& directives : m_directives) {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (directives) {
|
|
|
|
for (auto& entry : directives->entries)
|
2023-06-25 15:42:18 +00:00
|
|
|
callback(entry, directives);
|
2023-06-24 13:38:27 +00:00
|
|
|
}
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
bool DirectivesGroup::forEachAbortable(AbortableDirectivesCallback callback) const {
|
|
|
|
for (auto& directives : m_directives) {
|
2024-04-21 20:07:59 +00:00
|
|
|
if (directives) {
|
|
|
|
for (auto& entry : directives->entries) {
|
2023-06-25 15:42:18 +00:00
|
|
|
if (!callback(entry, directives))
|
2023-06-24 13:38:27 +00:00
|
|
|
return false;
|
|
|
|
}
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
return true;
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
Image DirectivesGroup::applyNewImage(Image const& image) const {
|
2023-06-24 09:41:52 +00:00
|
|
|
Image result = image;
|
|
|
|
applyExistingImage(result);
|
|
|
|
return result;
|
2023-06-24 03:06:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-24 09:41:52 +00:00
|
|
|
void DirectivesGroup::applyExistingImage(Image& image) const {
|
2023-06-25 15:42:18 +00:00
|
|
|
forEach([&](auto const& entry, Directives const& directives) {
|
2024-04-21 20:07:59 +00:00
|
|
|
ImageOperation const& operation = entry.loadOperation(*directives);
|
2023-06-26 17:38:57 +00:00
|
|
|
if (auto error = operation.ptr<ErrorImageOperation>())
|
2023-06-25 04:00:20 +00:00
|
|
|
std::rethrow_exception(error->exception);
|
|
|
|
else
|
2023-06-26 17:38:57 +00:00
|
|
|
processImageOperation(operation, image);
|
2023-06-24 09:41:52 +00:00
|
|
|
});
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
size_t DirectivesGroup::hash() const {
|
2023-06-24 09:41:52 +00:00
|
|
|
XXHash3 hasher;
|
2023-06-25 15:42:18 +00:00
|
|
|
for (auto& directives : m_directives) {
|
|
|
|
size_t hash = directives.hash();
|
|
|
|
hasher.push((const char*)&hash, sizeof(hash));
|
|
|
|
}
|
2023-06-24 09:41:52 +00:00
|
|
|
|
|
|
|
return hasher.digest();
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2023-06-25 08:12:54 +00:00
|
|
|
const List<Directives>& DirectivesGroup::list() const {
|
|
|
|
return m_directives;
|
|
|
|
}
|
|
|
|
|
2023-06-24 10:10:53 +00:00
|
|
|
bool operator==(DirectivesGroup const& a, DirectivesGroup const& b) {
|
|
|
|
return a.compare(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(DirectivesGroup const& a, DirectivesGroup const& b) {
|
|
|
|
return !a.compare(b);
|
|
|
|
}
|
|
|
|
|
2023-06-25 08:12:54 +00:00
|
|
|
DataStream& operator>>(DataStream& ds, DirectivesGroup& directivesGroup) {
|
|
|
|
String string;
|
|
|
|
ds.read(string);
|
|
|
|
|
2024-02-19 15:55:19 +00:00
|
|
|
directivesGroup = DirectivesGroup(std::move(string));
|
2023-06-25 08:12:54 +00:00
|
|
|
|
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataStream& operator<<(DataStream& ds, DirectivesGroup const& directivesGroup) {
|
|
|
|
ds.write(directivesGroup.toString());
|
|
|
|
|
|
|
|
return ds;
|
|
|
|
}
|
|
|
|
|
2023-06-24 10:10:53 +00:00
|
|
|
size_t hash<DirectivesGroup>::operator()(DirectivesGroup const& s) const {
|
2023-06-24 09:41:52 +00:00
|
|
|
return s.hash();
|
2023-06-23 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|