LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
visitor_macros.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_VISITOR_MACROS_H
17#define LIEF_VISITOR_MACROS_H
18#include "LIEF/config.h"
19
20// PE Support
21// ==========
22#if defined(LIEF_PE_SUPPORT)
23 #define LIEF_PE_FORWARD(OBJ) \
24 namespace PE { \
25 class OBJ; \
26 }
27
28 #define LIEF_PE_VISITABLE(OBJ) \
29 virtual void visit(const PE::OBJ&) {}
30#else
31 #define LIEF_PE_VISITABLE(OBJ)
32 #define LIEF_PE_FORWARD(OBJ)
33#endif
34
35
36// ELF Support
37// ===========
38#if defined(LIEF_ELF_SUPPORT)
39 #define LIEF_ELF_FORWARD(OBJ) \
40 namespace ELF { \
41 class OBJ; \
42 }
43 #define LIEF_ELF_VISITABLE(OBJ) \
44 virtual void visit(const ELF::OBJ&) {}
45#else
46 #define LIEF_ELF_FORWARD(OBJ)
47 #define LIEF_ELF_VISITABLE(OBJ)
48#endif
49
50// MachO Support
51// =============
52#if defined(LIEF_MACHO_SUPPORT)
53 #define LIEF_MACHO_FORWARD(OBJ) \
54 namespace MachO { \
55 class OBJ; \
56 }
57 #define LIEF_MACHO_VISITABLE(OBJ) \
58 virtual void visit(const MachO::OBJ&) {}
59#else
60 #define LIEF_MACHO_FORWARD(OBJ)
61 #define LIEF_MACHO_VISITABLE(OBJ)
62#endif
63
64
65// OAT Support
66// ===========
67#if defined(LIEF_OAT_SUPPORT)
68 #define LIEF_OAT_FORWARD(OBJ) \
69 namespace OAT { \
70 class OBJ; \
71 }
72 #define LIEF_OAT_VISITABLE(OBJ) \
73 virtual void visit(const OAT::OBJ&) {}
74#else
75 #define LIEF_OAT_FORWARD(OBJ)
76 #define LIEF_OAT_VISITABLE(OBJ)
77#endif
78
79
80// DEX Support
81// ===========
82#if defined(LIEF_DEX_SUPPORT)
83 #define LIEF_DEX_FORWARD(OBJ) \
84 namespace DEX { \
85 class OBJ; \
86 }
87 #define LIEF_DEX_VISITABLE(OBJ) \
88 virtual void visit(const DEX::OBJ&) {}
89#else
90 #define LIEF_DEX_FORWARD(OBJ)
91 #define LIEF_DEX_VISITABLE(OBJ)
92#endif
93
94
95// VDEX Support
96// ===========
97#if defined(LIEF_VDEX_SUPPORT)
98 #define LIEF_VDEX_FORWARD(OBJ) \
99 namespace VDEX { \
100 class OBJ; \
101 }
102 #define LIEF_VDEX_VISITABLE(OBJ) \
103 virtual void visit(const VDEX::OBJ&) {}
104#else
105 #define LIEF_VDEX_FORWARD(OBJ)
106 #define LIEF_VDEX_VISITABLE(OBJ)
107#endif
108
109
110// ART Support
111// ===========
112#if defined(LIEF_ART_SUPPORT)
113 #define LIEF_ART_FORWARD(OBJ) \
114 namespace ART { \
115 class OBJ; \
116 }
117 #define LIEF_ART_VISITABLE(OBJ) \
118 virtual void visit(const ART::OBJ&) {}
119#else
120 #define LIEF_ART_FORWARD(OBJ)
121 #define LIEF_ART_VISITABLE(OBJ)
122#endif
123
124// Abstract
125// ========
126#define LIEF_ABSTRACT_FORWARD(OBJ) \
127 class OBJ;
128
129#define LIEF_ABSTRACT_VISITABLE(OBJ) \
130 virtual void visit(const OBJ&) {}
131
132
133#endif