diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-04-24 21:37:34 +0200 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-04-25 07:30:16 +0100 |
commit | 5e7c838160f67774d633120ee3ed8df7f9e9261c (patch) | |
tree | 02c9eb2c0384e47d7cddcaefd0466361f5abbf20 /AK | |
parent | ddbe65e2f82777c4bd3c14eeb6cca829c3444910 (diff) | |
download | serenity-5e7c838160f67774d633120ee3ed8df7f9e9261c.zip |
AK: Rename `Stream::format()` to `Stream::write_formatted()`
This brings the function name in line with how we usually name those
functions, which is with a `read_` or `write_` prefix depending on what
they do.
While at it, make the internal `_impl` function private and not-virtual,
since there is no good reason to ever override that function.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Stream.cpp | 2 | ||||
-rw-r--r-- | AK/Stream.h | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/AK/Stream.cpp b/AK/Stream.cpp index 8ea84d84a7..233224fd6a 100644 --- a/AK/Stream.cpp +++ b/AK/Stream.cpp @@ -98,7 +98,7 @@ ErrorOr<void> Stream::write_until_depleted(ReadonlyBytes buffer) return {}; } -ErrorOr<void> Stream::format_impl(StringView fmtstr, TypeErasedFormatParams& parameters) +ErrorOr<void> Stream::write_formatted_impl(StringView fmtstr, TypeErasedFormatParams& parameters) { StringBuilder builder; TRY(vformat(builder, fmtstr, parameters)); diff --git a/AK/Stream.h b/AK/Stream.h index b821a10ea6..bc2db6f12d 100644 --- a/AK/Stream.h +++ b/AK/Stream.h @@ -77,13 +77,11 @@ public: return write_until_depleted({ &value, sizeof(value) }); } - virtual ErrorOr<void> format_impl(StringView, TypeErasedFormatParams&); - template<typename... Parameters> - ErrorOr<void> format(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters) + ErrorOr<void> write_formatted(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters) { VariadicFormatParams<AllowDebugOnlyFormatters::No, Parameters...> variadic_format_params { parameters... }; - TRY(format_impl(fmtstr.view(), variadic_format_params)); + TRY(write_formatted_impl(fmtstr.view(), variadic_format_params)); return {}; } @@ -108,6 +106,9 @@ protected: /// content size to be in order to reduce allocations (does not affect /// actual reading). ErrorOr<ByteBuffer> read_until_eof_impl(size_t block_size, size_t expected_file_size = 0); + +private: + ErrorOr<void> write_formatted_impl(StringView, TypeErasedFormatParams&); }; enum class SeekMode { |