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 <ostream>
20
#include <string>
21
#include <vector>
22
23
#include "
LIEF/Object.hpp
"
24
#include "
LIEF/visibility.h
"
25
26
27
namespace
LIEF::DEX
{
28
class
Parser
;
29
class
Class
;
30
34
class
LIEF_API
Type
:
public
Object
{
35
friend
class
Parser
;
36
37
public
:
38
enum class
TYPES
{
39
UNKNOWN = 0,
40
PRIMITIVE = 1,
41
CLASS = 2,
42
ARRAY = 3,
43
};
44
45
enum class
PRIMITIVES
{
46
VOID_T = 0x01,
47
BOOLEAN = 0x02,
48
BYTE = 0x03,
49
SHORT = 0x04,
50
CHAR = 0x05,
51
INT = 0x06,
52
LONG = 0x07,
53
FLOAT = 0x08,
54
DOUBLE = 0x09,
55
};
56
57
using
array_t
= std::vector<Type>;
58
59
public
:
60
static
std::string
pretty_name
(
PRIMITIVES
p);
61
62
public
:
63
Type
();
64
Type
(
const
std::string& mangled);
65
Type
(
const
Type
& other);
66
68
TYPES
type
()
const
;
69
70
const
Class
&
cls
()
const
;
71
const
array_t
&
array
()
const
;
72
const
PRIMITIVES
&
primitive
()
const
;
73
76
Class
&
cls
();
77
80
array_t
&
array
();
81
84
PRIMITIVES
&
primitive
();
85
88
size_t
dim
()
const
;
89
91
const
Type
&
underlying_array_type
() const
LIEF_LIFETIMEBOUND
;
92
Type
&
underlying_array_type
()
LIEF_LIFETIMEBOUND
;
93
94
void
accept
(
Visitor
& visitor) const override;
95
96
97
LIEF_API
friend std::ostream& operator<<(std::ostream& os, const
Type
&
type
);
98
99
~
Type
() override;
100
101
private:
102
void
parse(const std::
string
&
type
);
103
104
TYPES
type_{
TYPES::UNKNOWN
};
105
union
{
106
Class
*
cls_
{
nullptr
};
107
array_t
*
array_
;
108
PRIMITIVES
*
basic_
;
109
};
110
};
111
112
}
// Namespace DEX
113
// Namespace LIEF
114
#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:38
LIEF::DEX::Type::cls
Class & cls()
IF the current type is a TYPES::CLASS, return the associated DEX::CLASS. Otherwise the returned value...
LIEF::DEX::Type::primitive
const PRIMITIVES & primitive() const
LIEF::DEX::Type::cls_
Class * cls_
Definition
DEX/Type.hpp:106
LIEF::DEX::Type::PRIMITIVES
PRIMITIVES
Definition
DEX/Type.hpp:45
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::Type
Type(const std::string &mangled)
LIEF::DEX::Type::array_
array_t * array_
Definition
DEX/Type.hpp:107
LIEF::DEX::Type::array_t
std::vector< Type > array_t
Definition
DEX/Type.hpp:57
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 the returned v...
LIEF::DEX::Type::array
array_t & array()
IF the current type is a TYPES::ARRAY, return the associated array. Otherwise the returned value is u...
LIEF::DEX::Type::Type
Type()
LIEF::DEX::Type::basic_
PRIMITIVES * basic_
Definition
DEX/Type.hpp:108
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:35
LIEF::DEX::Type::array
const array_t & array() const
LIEF::DEX::Type::TYPES
TYPES
Definition
DEX/Type.hpp:38
LIEF::DEX::Type::TYPES::UNKNOWN
@ UNKNOWN
Definition
DEX/Type.hpp:39
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.18.0