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

LibPDF: Replace Value class by AK::Variant

This decreases the memory consumption by LibPDF by 4 bytes per Value,
compensating exactly for the increase in an earlier commit. :^)
This commit is contained in:
Ben Wiederhake 2021-09-19 20:56:05 +02:00 committed by Ali Mohammad Pur
parent d344253b08
commit f84a7e2e22
7 changed files with 132 additions and 243 deletions

View file

@ -102,13 +102,13 @@ public:
auto resolved = resolve(value);
if constexpr (IsSame<T, bool>)
return resolved.as_bool();
return resolved.get<bool>();
if constexpr (IsSame<T, int>)
return resolved.as_int();
return resolved.get<int>();
if constexpr (IsSame<T, float>)
return resolved.as_float();
return resolved.get<float>();
if constexpr (IsObject<T>)
return object_cast<T>(resolved.as_object());
return object_cast<T>(resolved.get<NonnullRefPtr<Object>>());
VERIFY_NOT_REACHED();
}