mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
AK: Add formatters for NonnullOwnPtr and WeakPtr.
This commit is contained in:
parent
0508fdbbcd
commit
235622dc7f
2 changed files with 16 additions and 0 deletions
|
@ -193,6 +193,14 @@ inline void swap(NonnullOwnPtr<T>& a, NonnullOwnPtr<U>& b)
|
||||||
a.swap(b);
|
a.swap(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct Formatter<NonnullOwnPtr<T>> : Formatter<const T*> {
|
||||||
|
void format(TypeErasedFormatParams& params, FormatBuilder& builder, const NonnullOwnPtr<T>& value)
|
||||||
|
{
|
||||||
|
Formatter<const T*>::format(params, builder, value.ptr());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using AK::adopt_own;
|
using AK::adopt_own;
|
||||||
|
|
|
@ -102,6 +102,14 @@ inline const LogStream& operator<<(const LogStream& stream, const WeakPtr<T>& va
|
||||||
return stream << value.ptr();
|
return stream << value.ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct Formatter<WeakPtr<T>> : Formatter<const T*> {
|
||||||
|
void format(TypeErasedFormatParams& params, FormatBuilder& builder, const WeakPtr<T>& value)
|
||||||
|
{
|
||||||
|
Formatter<const T*>::format(params, builder, value.ptr());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using AK::WeakPtr;
|
using AK::WeakPtr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue