summaryrefslogtreecommitdiff
path: root/lib/nes/common/containers
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nes/common/containers')
-rw-r--r--lib/nes/common/containers/string-builder.cc13
-rw-r--r--lib/nes/common/containers/string-builder.hh3
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/nes/common/containers/string-builder.cc b/lib/nes/common/containers/string-builder.cc
index ad2f97f..8182955 100644
--- a/lib/nes/common/containers/string-builder.cc
+++ b/lib/nes/common/containers/string-builder.cc
@@ -253,4 +253,17 @@ namespace nes
return status::error_invalid_format_string;
}
+
+ auto string_builder::remove_last() -> status
+ {
+ if (length_ == 0) { return status::error_buffer_overflow; }
+
+ length_ -= 1;
+ return status::success;
+ }
+
+ auto string_builder::clear() -> void
+ {
+ length_ = 0;
+ }
} // namespace nes \ No newline at end of file
diff --git a/lib/nes/common/containers/string-builder.hh b/lib/nes/common/containers/string-builder.hh
index 7dcbb34..a533461 100644
--- a/lib/nes/common/containers/string-builder.hh
+++ b/lib/nes/common/containers/string-builder.hh
@@ -92,6 +92,9 @@ namespace nes
return append_format(fmt, arg_wrappers, arg_count);
}
+ auto remove_last() -> status;
+ auto clear() -> void;
+
private:
auto append_format(string_view fmt, format_arg const* args, u32 arg_count) -> status;
auto append_format_arg(format_arg, string_view params) -> status;