summaryrefslogtreecommitdiff
path: root/lib/nes/common/path-builder.hh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nes/common/path-builder.hh')
-rw-r--r--lib/nes/common/path-builder.hh12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/nes/common/path-builder.hh b/lib/nes/common/path-builder.hh
index 727d18c..b64fb28 100644
--- a/lib/nes/common/path-builder.hh
+++ b/lib/nes/common/path-builder.hh
@@ -1,6 +1,7 @@
#pragma once
#include "nes/common/types.hh"
+#include "nes/common/span.hh"
#include "nes/common/path-view.hh"
#include <string_view>
@@ -9,15 +10,14 @@ namespace nes
/// A mutable path with a fixed-length buffer.
class path_builder
{
- char* buffer_{ nullptr };
- u32 buffer_length_{ 0 };
- u32 actual_length_{ 0 };
+ span<char> buffer_;
+ u32 length_{ 0 };
public:
- explicit path_builder(char* buffer, u32 buffer_length);
+ 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_, actual_length_ }; }
+ auto get_path() const -> std::string_view { return std::string_view{ buffer_.get_data(), length_ }; }
auto push(std::string_view) -> bool;
auto pop() -> bool;
@@ -31,7 +31,7 @@ namespace nes
public:
explicit path_buffer()
- : path_builder{ buffer_, Capacity }
+ : path_builder{ buffer_ }
{
}
};