summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPDF/Forward.h
blob: 76982f2ae9f3d934598c30f155686aff6bfa52b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * 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>;

}