16 using artifacts = std::variant<std::monostate, std::string, std::string_view, char*>;
18 static constexpr auto DIRTY_INDEX = 0, PROCESSED_INDEX = 1, BUFFER_SIZE = 2;
23 [[nodiscard]] artifacts
get_dirty() const noexcept {
return doubled_buffer.at(DIRTY_INDEX); }
27 [[nodiscard]] artifacts
get_processed() const noexcept {
return doubled_buffer.at(PROCESSED_INDEX); }
31 void set_dirty(artifacts anything)
noexcept { doubled_buffer.at(DIRTY_INDEX) = std::move(anything); }
35 void set_processed(artifacts anything)
noexcept { doubled_buffer.at(PROCESSED_INDEX) = std::move(anything); }
39 bool set(
const std::string_view sv)
noexcept
50 return std::visit([]<
typename T0>(
const T0& value) ->
bool
52 using T = std::decay_t<T0>;
53 if constexpr (std::is_same_v<T, std::monostate>)
57 else if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, std::string_view>)
61 else if constexpr (std::is_same_v<T, char*>)
63 return value ==
nullptr || *value ==
'\0';
73 std::array<artifacts, BUFFER_SIZE> doubled_buffer;
Class for managing processed text resources.
Definition processed_text.h:14
bool is_clean() const noexcept
Checks if the dirty artifact is clean - empty or null.
Definition processed_text.h:48
artifacts get_processed() const noexcept
Gets the processed artifact.
Definition processed_text.h:27
bool set(const std::string_view sv) noexcept
Required by resource_management::load(id, string_view). Stores sv as the dirty (unprocessed) value; r...
Definition processed_text.h:39
void set_processed(artifacts anything) noexcept
Sets the processed artifact.
Definition processed_text.h:35
artifacts get_dirty() const noexcept
Gets the dirty (unprocessed) artifact and the processed artifact.
Definition processed_text.h:23
void set_dirty(artifacts anything) noexcept
Sets the dirty (unprocessed) artifact and the processed artifact.
Definition processed_text.h:31