From 5e7c838160f67774d633120ee3ed8df7f9e9261c Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 24 Apr 2023 21:37:34 +0200 Subject: 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. --- AK/Stream.cpp | 2 +- AK/Stream.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'AK') 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 Stream::write_until_depleted(ReadonlyBytes buffer) return {}; } -ErrorOr Stream::format_impl(StringView fmtstr, TypeErasedFormatParams& parameters) +ErrorOr 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 format_impl(StringView, TypeErasedFormatParams&); - template - ErrorOr format(CheckedFormatString&& fmtstr, Parameters const&... parameters) + ErrorOr write_formatted(CheckedFormatString&& fmtstr, Parameters const&... parameters) { VariadicFormatParams 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 read_until_eof_impl(size_t block_size, size_t expected_file_size = 0); + +private: + ErrorOr write_formatted_impl(StringView, TypeErasedFormatParams&); }; enum class SeekMode { -- cgit v1.2.3