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
19#include "LIEF/visibility.h"
20#include "LIEF/PDB/Type.hpp"
23#include "LIEF/iterators.hpp"
24
25#include <type_traits>
26
27namespace LIEF {
28namespace pdb {
29namespace types {
30
33class LIEF_API ClassLike : public Type {
34 public:
35 template<typename... Args,
36 typename = typename std::
37 enable_if<std::is_constructible<Type, Args&&...>::value>::type>
38 ClassLike(Args&&... args) :
39 Type(std::forward<Args>(args)...) {}
40
43
46
48 std::string unique_name() const;
49
52
55
56 template<class T>
57 static bool classof(
58 const T*,
59 typename std::enable_if<std::is_base_of<ClassLike, T>::value>::type* = 0
60 ) {
61 return true;
62 }
63
64 ~ClassLike() override;
65};
66
67
70 public:
71 template<typename... Args,
72 typename = typename std::
73 enable_if<std::is_constructible<ClassLike, Args&&...>::value>::type>
74 Structure(Args&&... args) :
75 ClassLike(std::forward<Args>(args)...) {}
76
77 static bool classof(const Type* type) {
78 return type->kind() == Type::KIND::STRUCTURE;
79 }
80
81 ~Structure() override;
82};
83
85class LIEF_API Class : public ClassLike {
86 public:
87 template<typename... Args,
88 typename = typename std::
89 enable_if<std::is_constructible<ClassLike, Args&&...>::value>::type>
90 Class(Args&&... args) :
91 ClassLike(std::forward<Args>(args)...) {}
92
93 static bool classof(const Type* type) {
94 return type->kind() == Type::KIND::CLASS;
95 }
96
97 ~Class() override;
98};
99
102 public:
103 template<typename... Args,
104 typename = typename std::
105 enable_if<std::is_constructible<ClassLike, Args&&...>::value>::type>
106 Interface(Args&&... args) :
107 ClassLike(std::forward<Args>(args)...) {}
108
109 static bool classof(const Type* type) {
110 return type->kind() == Type::KIND::INTERFACE;
111 }
112
113 ~Interface() override;
114};
115
116
117}
118}
119}
120#endif
Definition iterators.hpp:601
Type(std::unique_ptr< details::Type > impl)
@ INTERFACE
Definition PDB/Type.hpp:96
@ STRUCTURE
Definition PDB/Type.hpp:95
@ CLASS
Definition PDB/Type.hpp:86
KIND kind() const
iterator_range< Method::Iterator > methods_iterator
Methods iterator.
Definition PDB/types/ClassLike.hpp:45
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:57
iterator_range< Attribute::Iterator > attributes_iterator
Attributes iterator.
Definition PDB/types/ClassLike.hpp:42
std::string unique_name() const
Mangled type name.
ClassLike(Args &&... args)
Definition PDB/types/ClassLike.hpp:38
attributes_iterator attributes() const
Iterator over the different attributes defined in this class-like type.
Class(Args &&... args)
Definition PDB/types/ClassLike.hpp:90
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:93
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:109
Interface(Args &&... args)
Definition PDB/types/ClassLike.hpp:106
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:77
Structure(Args &&... args)
Definition PDB/types/ClassLike.hpp:74
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition PDB/types/Array.hpp:24
Definition BuildMetadata.hpp:25
LIEF namespace.
Definition Abstract/Binary.hpp:41
#define LIEF_API
Definition visibility.h:45