1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +00:00

Applications: Add a very simple PDFViewer

This commit is contained in:
Matthew Olsson 2021-05-10 11:50:15 -07:00 committed by Andreas Kling
parent 309105678b
commit f7ea1eb610
13 changed files with 264 additions and 18 deletions

View file

@ -65,7 +65,21 @@ public:
// Like resolve, but unwraps the Value into the given type. Accepts
// any object type, and the three primitive Value types.
template<IsValueType T>
UnwrappedValueType<T> resolve_to(const Value& value);
UnwrappedValueType<T> resolve_to(const Value& value)
{
auto resolved = resolve(value);
if constexpr (IsSame<T, bool>)
return resolved.as_bool();
if constexpr (IsSame<T, int>)
return resolved.as_int();
if constexpr (IsSame<T, float>)
return resolved.as_float();
if constexpr (IsObject<T>)
return object_cast<T>(resolved.as_object());
VERIFY_NOT_REACHED();
}
private:
// FIXME: Currently, to improve performance, we don't load any pages at Document