summaryrefslogtreecommitdiff
path: root/lib/nes/common/string-builder.cc
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-04 19:59:47 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-04 19:59:47 +0100
commit9c45e9c7df1efa5bc1c8e73b6eaef4726b828d3e (patch)
tree4be985efa8e697fd6ef5838eec69c32c40c5d4a5 /lib/nes/common/string-builder.cc
parente791ac9a46095e0241181da89c35a7c702982c21 (diff)
add span type
Diffstat (limited to 'lib/nes/common/string-builder.cc')
-rw-r--r--lib/nes/common/string-builder.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/nes/common/string-builder.cc b/lib/nes/common/string-builder.cc
index efc1326..087f0d4 100644
--- a/lib/nes/common/string-builder.cc
+++ b/lib/nes/common/string-builder.cc
@@ -2,22 +2,21 @@
namespace nes
{
- string_builder::string_builder(char* buffer, u32 buffer_length)
+ string_builder::string_builder(span<char> const buffer)
: buffer_{ buffer }
- , buffer_length_{ buffer_length }
{
}
auto string_builder::append_char(char const value) -> string_builder&
{
- if (actual_length_ == buffer_length_)
+ if (length_ == buffer_.get_length())
{
is_good_ = false;
return *this;
}
- buffer_[actual_length_] = value;
- actual_length_ += 1;
+ buffer_[length_] = value;
+ length_ += 1;
return *this;
}