LIEF: Library to Instrument Executable Formats Version 2.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/PDB/Type.hpp"
22#include "LIEF/iterators.hpp"
23#include "LIEF/visibility.h"
24
25#include <type_traits>
26
27
28namespace LIEF::pdb::types {
29
32class LIEF_API ClassLike : public Type {
33 public:
34 template<typename... Args,
35 typename = std::enable_if_t<std::is_constructible_v<Type, Args&&...>>>
36 ClassLike(Args&&... args) :
37 Type(std::forward<Args>(args)...) {}
38
41
44
46 std::string unique_name() const;
47
50
53
54 template<class T>
55 static bool classof(const T*,
56 std::enable_if_t<std::is_base_of_v<ClassLike, T>>* = 0) {
57 return true;
58 }
59
60 ~ClassLike() override;
61};
62
63
66 public:
67 template<typename... Args,
68 typename =
69 std::enable_if_t<std::is_constructible_v<ClassLike, Args&&...>>>
70 Structure(Args&&... args) :
71 ClassLike(std::forward<Args>(args)...) {}
72
73 static bool classof(const Type* type) {
74 return type->kind() == Type::KIND::STRUCTURE;
75 }
76
77 ~Structure() override;
78};
79
81class LIEF_API Class : public ClassLike {
82 public:
83 template<typename... Args,
84 typename =
85 std::enable_if_t<std::is_constructible_v<ClassLike, Args&&...>>>
86 Class(Args&&... args) :
87 ClassLike(std::forward<Args>(args)...) {}
88
89 static bool classof(const Type* type) {
90 return type->kind() == Type::KIND::CLASS;
91 }
92
93 ~Class() override;
94};
95
98 public:
99 template<typename... Args,
100 typename =
101 std::enable_if_t<std::is_constructible_v<ClassLike, Args&&...>>>
102 Interface(Args&&... args) :
103 ClassLike(std::forward<Args>(args)...) {}
104
105 static bool classof(const Type* type) {
106 return type->kind() == Type::KIND::INTERFACE;
107 }
108
109 ~Interface() override;
110};
111
112
113}
114
115
116#endif
Definition iterators.hpp:591
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:43
methods_iterator methods() const
Iterator over the different methods implemented in this class-type type.
iterator_range< Attribute::Iterator > attributes_iterator
Attributes iterator.
Definition PDB/types/ClassLike.hpp:40
std::string unique_name() const
Mangled type name.
ClassLike(Args &&... args)
Definition PDB/types/ClassLike.hpp:36
static bool classof(const T *, std::enable_if_t< std::is_base_of_v< ClassLike, T > > *=0)
Definition PDB/types/ClassLike.hpp:55
attributes_iterator attributes() const
Iterator over the different attributes defined in this class-like type.
Class(Args &&... args)
Definition PDB/types/ClassLike.hpp:86
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:89
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:105
Interface(Args &&... args)
Definition PDB/types/ClassLike.hpp:102
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:73
Structure(Args &&... args)
Definition PDB/types/ClassLike.hpp:70
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition PDB/types/Array.hpp:23
#define LIEF_API
Definition visibility.h:45