LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
PDB/types/ClassLike.hpp
Go to the documentation of this file.
1/* Copyright 2022 - 2024 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 {
29class LIEF_API ClassLike : public Type {
33 public:
34 using Type::Type;
35 using attributes_iterator = iterator_range<Attribute::Iterator>;
38 using methods_iterator = iterator_range<Method::Iterator>;
41 std::string unique_name() const;
44 std::string name() const;
47 attributes_iterator attributes() const;
50 methods_iterator methods() const;
53 uint64_t size() const;
57
58 template <class T>
59 static bool classof(const T*, typename std::enable_if<std::is_base_of<ClassLike, T>::value>::type* = 0)
60 {
61 return true;
62 }
63
64 ~ClassLike() override;
65};
66
67class LIEF_API Structure : public ClassLike {
70 public:
71 using ClassLike::ClassLike;
72
73 static bool classof(const Type* type) {
74 return type->kind() == Type::KIND::STRUCTURE;
75 }
76
77 ~Structure() override;
78};
79class LIEF_API Class : public ClassLike {
82 public:
83 using ClassLike::ClassLike;
84
85 static bool classof(const Type* type) {
86 return type->kind() == Type::KIND::CLASS;
87 }
88
89 ~Class() override;
90};
91class LIEF_API Interface : public ClassLike {
94 public:
95 using ClassLike::ClassLike;
96
97 static bool classof(const Type* type) {
98 return type->kind() == Type::KIND::INTERFACE;
99 }
100
101 ~Interface() override;
102};
103
104
105}
106}
107}
108#endif
109
110
Type.hpp
Attribute.hpp
Method.hpp
LIEF::pdb::Type::kind
KIND kind() const
LIEF::pdb::types::ClassLike
This class abstracts the following PDB types: LF_STRUCTURE, LF_INTERFACE, LF_CLASS or LF_UNION.
Definition PDB/types/ClassLike.hpp:32
LIEF::pdb::types::ClassLike::size
uint64_t size() const
Size of the type including all its attributes. This size should match the sizeof(....
LIEF::pdb::types::ClassLike::methods
methods_iterator methods() const
Iterator over the different methods implemented in this class-type type.
LIEF::pdb::types::ClassLike::classof
static bool classof(const T *, typename std::enable_if< std::is_base_of< ClassLike, T >::value >::type *=0)
Definition PDB/types/ClassLike.hpp:59
LIEF::pdb::types::ClassLike::unique_name
std::string unique_name() const
Mangled type name.
LIEF::pdb::types::ClassLike::attributes
attributes_iterator attributes() const
Iterator over the different attributes defined in this class-like type.
LIEF::pdb::types::ClassLike::~ClassLike
~ClassLike() override
LIEF::pdb::types::ClassLike::name
std::string name() const
Demangled type name.
LIEF::pdb::types::Class
Interface for the LF_CLASS PDB type.
Definition PDB/types/ClassLike.hpp:81
LIEF::pdb::types::Class::classof
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:85
LIEF::pdb::types::Class::~Class
~Class() override
LIEF::pdb::types::Interface
Interface for the LF_INTERFACE PDB type.
Definition PDB/types/ClassLike.hpp:93
LIEF::pdb::types::Interface::classof
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:97
LIEF::pdb::types::Interface::~Interface
~Interface() override
LIEF::pdb::types::Structure
Interface for the LF_STRUCTURE PDB type.
Definition PDB/types/ClassLike.hpp:69
LIEF::pdb::types::Structure::classof
static bool classof(const Type *type)
Definition PDB/types/ClassLike.hpp:73
LIEF::pdb::types::Structure::~Structure
~Structure() override
iterators.hpp
LIEF::pdb::types
Definition PDB/types/Array.hpp:23
LIEF::pdb
Definition PDB/CompilationUnit.hpp:27
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41