LibCore: Add formatter for Object.
This commit is contained in:
parent
235622dc7f
commit
56cf272ed5
Notes:
sideshowbarker
2024-07-19 01:52:26 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/56cf272ed54 Pull-request: https://github.com/SerenityOS/serenity/pull/3776 Reviewed-by: https://github.com/alimpfard
2 changed files with 16 additions and 0 deletions
|
@ -264,3 +264,12 @@ const LogStream& operator<<(const LogStream& stream, const Object& object)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
||||
void Formatter<Core::Object>::format(TypeErasedFormatParams& params, FormatBuilder& builder, const Core::Object& value)
|
||||
{
|
||||
Formatter<StringView>::format(params, builder, String::formatted("{}({})", value.class_name(), &value));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -170,6 +170,13 @@ private:
|
|||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
template<>
|
||||
struct Formatter<Core::Object> : Formatter<StringView> {
|
||||
void format(TypeErasedFormatParams&, FormatBuilder&, const Core::Object&);
|
||||
};
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
template<typename T, typename Callback>
|
||||
inline void Object::for_each_child_of_type(Callback callback)
|
||||
|
|
Loading…
Add table
Reference in a new issue