1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

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.
This commit is contained in:
Tim Schumacher 2023-04-24 21:37:34 +02:00 committed by Sam Atkins
parent ddbe65e2f8
commit 5e7c838160
3 changed files with 8 additions and 7 deletions

View file

@ -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 {