diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 16:34:23 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 16:34:23 +0100 |
| commit | d1b61b02b1a6bdaa337ff060eda3d3d5fb67827d (patch) | |
| tree | de3b1d7f7907e9fc786a1b7491b9bca9b9d296b0 /lib/nes/common/path-builder.hh | |
| parent | 30b4364c772114303d9045677186a53855ea5343 (diff) | |
refactor: move containers into separate directory
Diffstat (limited to 'lib/nes/common/path-builder.hh')
| -rw-r--r-- | lib/nes/common/path-builder.hh | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/nes/common/path-builder.hh b/lib/nes/common/path-builder.hh deleted file mode 100644 index e7980ea..0000000 --- a/lib/nes/common/path-builder.hh +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include "nes/common/types.hh" -#include "nes/common/span.hh" -#include "nes/common/path-view.hh" -#include "nes/common/status.hh" -#include <string_view> - -namespace nes -{ - /// A mutable path with a fixed-length buffer. - class path_builder - { - template<u32 Capacity> - friend class path_buffer; - - span<char> buffer_; - u32 length_{ 0 }; - - public: - explicit path_builder(span<char>); - - auto get_components() const -> path_view { return path_view{ get_path() }; } - auto get_path() const -> std::string_view { return std::string_view{ buffer_.get_data(), length_ }; } - - auto push(std::string_view) -> status; - auto pop() -> status; - }; - - /// A path builder with a buffer embedded into it. - template<u32 Capacity> - class path_buffer : public path_builder - { - char buffer_[Capacity]; - - public: - explicit path_buffer() - : path_builder{ buffer_ } - { - } - - path_buffer(path_buffer const& other) - : path_builder{ buffer_ } - { - std::copy_n(other.buffer_, Capacity, buffer_); - length_ = other.length_; - } - - auto operator=(path_buffer const& other) - { - std::copy_n(other.buffer_, Capacity, buffer_); - length_ = other.length_; - } - }; -} // namespace nes
\ No newline at end of file |
