mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
be6e4b6f3c
IndirectValueRef is so simple that it can be stored directly in the Value class instead of being heap allocated. As the comment in Value says, however, in theory the max bits needed to store is 48 (16 for the generation index and 32(?) for the object index), but 32 should be good enough for now. We can increase it to u64 later if necessary.
42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
namespace PDF {
|
|
|
|
class Document;
|
|
class Object;
|
|
|
|
// Note: This macro doesn't care about PlainTextStreamObject and EncodedStreamObject because
|
|
// we never need to work directly with either of them.
|
|
|
|
#define ENUMERATE_OBJECT_TYPES(V) \
|
|
V(StringObject, string) \
|
|
V(NameObject, name) \
|
|
V(ArrayObject, array) \
|
|
V(DictObject, dict) \
|
|
V(StreamObject, stream) \
|
|
V(IndirectValue, indirect_value)
|
|
|
|
#define FORWARD_DECL(class_name, _) class class_name;
|
|
ENUMERATE_OBJECT_TYPES(FORWARD_DECL)
|
|
#undef FORWARD_DECL
|
|
|
|
template<typename T>
|
|
concept IsObject = IsBaseOf<Object, T>;
|
|
|
|
template<typename T>
|
|
concept IsValuePrimitive = IsSame<T, bool> || IsSame<T, int> || IsSame<T, float>;
|
|
|
|
template<typename T>
|
|
concept IsValueType = IsValuePrimitive<T> || IsObject<T>;
|
|
|
|
template<IsValueType T>
|
|
using UnwrappedValueType = Conditional<IsObject<T>, NonnullRefPtr<T>, T>;
|
|
|
|
}
|