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 <string_view>
26#include <type_traits>
27
28
29namespace LIEF::pdb::types {
30
33class LIEF_API ClassLike : public Type {
34 public:
35 template<typename... Args,
36 typename = std::enable_if_t<std::is_constructible_v<Type, Args&&...>>>
37 ClassLike(Args&&... args) :
38 Type(std::forward<Args>(args)...) {}
39
42
45
47 std::string_view unique_name() const LIEF_LIFETIMEBOUND;
48
51
54
55 template<class T>
56 static bool classof(const T*,
57 std::enable_if_t<std::is_base_of_v<ClassLike, T>>* = 0) {
58 return true;
59 }
60
61 ~ClassLike() override;
62};
63
64
67 public:
68 template<typename... Args,
69 typename =
70 std::enable_if_t<std::is_constructible_v<ClassLike, Args&&...>>>
71 Structure(Args&&... args) :
72 ClassLike(std::forward<Args>(args)...) {}
73
74 static bool classof(const Type* type) {
75 return type->kind() == Type::KIND::STRUCTURE;
76 }
77
78 ~Structure() override;
79};
80
82class LIEF_API Class : public ClassLike {
83 public:
84 template<typename... Args,
85 typename =
86 std::enable_if_t<std::is_constructible_v<ClassLike, Args&&...>>>
87 Class(Args&&... args) :
88 ClassLike(std::forward<Args>(args)...) {}
89
90 static bool classof(const Type* type) {
91 return type->kind() == Type::KIND::CLASS;
92 }
93
94 ~Class() override;
95};
96
99 public:
100 template<typename... Args,
101 typename =
102 std::enable_if_t<std::is_constructible_v<ClassLike, Args&&...>>>
103 Interface(Args&&... args) :
104 ClassLike(std::forward<Args>(args)...) {}
105
106 static bool classof(const Type* type) {
107 return type->kind() == Type::KIND::INTERFACE;
108 }
109
110 ~Interface() override;
111};
112
113
114}
115
116
117#endif
Definition iterators.hpp:595
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:44
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:41
ClassLike(Args &&... args)
Definition PDB/types/ClassLike.hpp:37
static bool classof(const T *, std::enable_if_t< std::is_base_of_v< ClassLike, T > > *=0)
Definition PDB/types/ClassLike.hpp:56
attributes_iterator attributes() const
Iterator over the different attributes defined in this class-like type.
std::string_view unique_name() const
Mangled type name.
Class(Args &&... args)
Definition PDB/types/ClassLike.hpp:87
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:90
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:106
Interface(Args &&... args)
Definition PDB/types/ClassLike.hpp:103
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:74
Structure(Args &&... args)
Definition PDB/types/ClassLike.hpp:71
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Definition PDB/types/Array.hpp:23
#define LIEF_API
Definition visibility.h:45