LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
PDB/types/ClassLike.hpp
Go to the documentation of this file.
1/* Copyright 2022 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_PDB_TYPE_CLASS_H
16#define LIEF_PDB_TYPE_CLASS_H
17
18#include "LIEF/visibility.h"
19#include "LIEF/PDB/Type.hpp"
22#include "LIEF/iterators.hpp"
23
24#include <type_traits>
25
26namespace LIEF {
27namespace pdb {
28namespace types {
29
32class LIEF_API ClassLike : public Type {
33 public:
34 template<typename... Args,
35 typename = typename std::
36 enable_if<std::is_constructible<Type, Args&&...>::value>::type>
37 ClassLike(Args&&... args) :
38 Type(std::forward<Args>(args)...) {}
39
42
45
47 std::string unique_name() const;
48
51
54
55 template<class T>
56 static bool classof(
57 const T*,
58 typename std::enable_if<std::is_base_of<ClassLike, T>::value>::type* = 0
59 ) {
60 return true;
61 }
62
63 ~ClassLike() override;
64};
65
66
69 public:
70 template<typename... Args,
71 typename = typename std::
72 enable_if<std::is_constructible<ClassLike, Args&&...>::value>::type>
73 Structure(Args&&... args) :
74 ClassLike(std::forward<Args>(args)...) {}
75
76 static bool classof(const Type* type) {
77 return type->kind() == Type::KIND::STRUCTURE;
78 }
79
80 ~Structure() override;
81};
82
84class LIEF_API Class : public ClassLike {
85 public:
86 template<typename... Args,
87 typename = typename std::
88 enable_if<std::is_constructible<ClassLike, Args&&...>::value>::type>
89 Class(Args&&... args) :
90 ClassLike(std::forward<Args>(args)...) {}
91
92 static bool classof(const Type* type) {
93 return type->kind() == Type::KIND::CLASS;
94 }
95
96 ~Class() override;
97};
98
101 public:
102 template<typename... Args,
103 typename = typename std::
104 enable_if<std::is_constructible<ClassLike, Args&&...>::value>::type>
105 Interface(Args&&... args) :
106 ClassLike(std::forward<Args>(args)...) {}
107
108 static bool classof(const Type* type) {
109 return type->kind() == Type::KIND::INTERFACE;
110 }
111
112 ~Interface() override;
113};
114
115
116}
117}
118}
119#endif
Definition iterators.hpp:601
Type(std::unique_ptr< details::Type > impl)
@ INTERFACE
Definition PDB/Type.hpp:97
@ STRUCTURE
Definition PDB/Type.hpp:96
@ CLASS
Definition PDB/Type.hpp:87
KIND kind() const
iterator_range< Method::Iterator > methods_iterator
Methods iterator.
Definition PDB/types/ClassLike.hpp:44
methods_iterator methods() const
Iterator over the different methods implemented in this class-type type.
static bool classof(const T *, typename std::enable_if< std::is_base_of< ClassLike, T >::value >::type *=0)
Definition PDB/types/ClassLike.hpp:56
iterator_range< Attribute::Iterator > attributes_iterator
Attributes iterator.
Definition PDB/types/ClassLike.hpp:41
std::string unique_name() const
Mangled type name.
ClassLike(Args &&... args)
Definition PDB/types/ClassLike.hpp:37
attributes_iterator attributes() const
Iterator over the different attributes defined in this class-like type.
Class(Args &&... args)
Definition PDB/types/ClassLike.hpp:89
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:92
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:108
Interface(Args &&... args)
Definition PDB/types/ClassLike.hpp:105
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:76
Structure(Args &&... args)
Definition PDB/types/ClassLike.hpp:73
Definition PDB/types/Array.hpp:23
Definition BuildMetadata.hpp:24
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:45