LIEF: Library to Instrument Executable Formats
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
DEX
DEX/Type.hpp
Go to the documentation of this file.
1
/* Copyright 2017 - 2026 R. Thomas
2
* Copyright 2017 - 2026 Quarkslab
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#ifndef LIEF_DEX_TYPE_H
17
#define LIEF_DEX_TYPE_H
18
19
#include <string_view>
20
#include <ostream>
21
#include <string>
22
#include <vector>
23
24
#include "
LIEF/Object.hpp
"
25
#include "
LIEF/visibility.h
"
26
27
28
namespace
LIEF::DEX
{
29
class
Parser
;
30
class
Class
;
31
35
class
LIEF_API
Type
:
public
Object
{
36
friend
class
Parser
;
37
38
public
:
39
enum class
TYPES
{
40
UNKNOWN = 0,
41
PRIMITIVE = 1,
42
CLASS = 2,
43
ARRAY = 3,
44
};
45
46
enum class
PRIMITIVES
{
47
VOID_T = 0x01,
48
BOOLEAN = 0x02,
49
BYTE = 0x03,
50
SHORT = 0x04,
51
CHAR = 0x05,
52
INT = 0x06,
53
LONG = 0x07,
54
FLOAT = 0x08,
55
DOUBLE = 0x09,
56
};
57
58
using
array_t
= std::vector<Type>;
59
60
public
:
61
static
std::string
pretty_name
(
PRIMITIVES
p);
62
63
public
:
64
Type
();
65
Type
(std::string_view mangled);
66
Type
(
const
Type
& other);
67
69
TYPES
type
()
const
;
70
71
const
Class
&
cls
()
const
;
72
const
array_t
&
array
()
const
;
73
const
PRIMITIVES
&
primitive
()
const
;
74
77
Class
&
cls
();
78
81
array_t
&
array
();
82
85
PRIMITIVES
&
primitive
();
86
89
size_t
dim
()
const
;
90
92
const
Type
&
underlying_array_type
() const
LIEF_LIFETIMEBOUND
;
93
Type
&
underlying_array_type
()
LIEF_LIFETIMEBOUND
;
94
95
void
accept
(
Visitor
& visitor) const override;
96
97
98
LIEF_API
friend std::ostream& operator<<(std::ostream& os, const
Type
&
type
);
99
100
~
Type
() override;
101
102
private:
103
void
parse(std::string_view
type
);
104
105
TYPES
type_{
TYPES::UNKNOWN
};
106
union
{
107
Class
* cls_{
nullptr
};
108
array_t* array_;
109
PRIMITIVES* basic_;
110
};
111
};
112
113
}
// Namespace DEX
114
// Namespace LIEF
115
#endif
Object.hpp
LIEF::DEX::Class
Class which represents a DEX Class (i.e. a Java/Kotlin class).
Definition
DEX/Class.hpp:37
LIEF::DEX::Parser
Class which parses a DEX file to produce a DEX::File object.
Definition
DEX/Parser.hpp:40
LIEF::DEX::Type::cls
Class & cls()
IF the current type is a TYPES::CLASS, return the associated DEX::CLASS. Otherwise,...
LIEF::DEX::Type::Type
Type(std::string_view mangled)
LIEF::DEX::Type::primitive
const PRIMITIVES & primitive() const
LIEF::DEX::Type::PRIMITIVES
PRIMITIVES
Definition
DEX/Type.hpp:46
LIEF::DEX::Type::dim
size_t dim() const
Return the array dimension if the current type is an array. Otherwise, it returns 0.
LIEF::DEX::Type::accept
void accept(Visitor &visitor) const override
LIEF::DEX::Type::array_t
std::vector< Type > array_t
Definition
DEX/Type.hpp:58
LIEF::DEX::Type::underlying_array_type
const Type & underlying_array_type() const
In the case of a TYPES::ARRAY, return the array's type.
LIEF::DEX::Type::primitive
PRIMITIVES & primitive()
IF the current type is a TYPES::PRIMITIVE, return the associated PRIMITIVES. Otherwise,...
LIEF::DEX::Type::array
array_t & array()
IF the current type is a TYPES::ARRAY, return the associated array. Otherwise, the returned value is ...
LIEF::DEX::Type::Type
Type()
LIEF::DEX::Type::Type
Type(const Type &other)
LIEF::DEX::Type::cls
const Class & cls() const
LIEF::DEX::Type::pretty_name
static std::string pretty_name(PRIMITIVES p)
LIEF::DEX::Type::Parser
friend class Parser
Definition
DEX/Type.hpp:36
LIEF::DEX::Type::array
const array_t & array() const
LIEF::DEX::Type::TYPES
TYPES
Definition
DEX/Type.hpp:39
LIEF::DEX::Type::TYPES::UNKNOWN
@ UNKNOWN
Definition
DEX/Type.hpp:40
LIEF::DEX::Type::type
TYPES type() const
Whether it is a primitive type, a class, ...
LIEF::Object::Object
Object()
LIEF::Visitor
Definition
Visitor.hpp:212
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
LIEF::DEX
Definition
DEX/Class.hpp:31
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.19.0