From dd22e1ab7ab7b5bac841dae2b62bfa200b36c4d8 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Wed, 12 Feb 2025 23:57:32 +0100 Subject: add encryption/decryption --- lib/nes/common/containers/string-builder.cc | 13 +++++++++++++ lib/nes/common/containers/string-builder.hh | 3 +++ 2 files changed, 16 insertions(+) (limited to 'lib/nes/common/containers') 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; -- cgit v1.3.1