LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
OAT/Class.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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_OAT_CLASS_H
17#define LIEF_OAT_CLASS_H
18
19#include "LIEF/iterators.hpp"
20#include "LIEF/OAT/enums.hpp"
21#include "LIEF/DEX/deopt.hpp"
22
23#include "LIEF/visibility.h"
24#include "LIEF/Object.hpp"
25
26
27namespace LIEF {
28namespace DEX {
29class Class;
30}
31namespace OAT {
32class Parser;
33class Method;
34
35class LIEF_API Class : public Object {
36 friend class Parser;
37
38 public:
39 using methods_t = std::vector<Method*>;
42
43 public:
45
47 DEX::Class* dex_class, std::vector<uint32_t> bitmap = {});
48
49 Class(const Class&);
51
52 bool has_dex_class() const;
53 const DEX::Class* dex_class() const;
55
58
59 const std::string& fullname() const;
60 size_t index() const;
61
64
65 const std::vector<uint32_t>& bitmap() const;
66
67 bool is_quickened(const DEX::Method& m) const;
68 bool is_quickened(uint32_t relative_index) const;
69
70 uint32_t method_offsets_index(const DEX::Method& m) const;
71 uint32_t method_offsets_index(uint32_t relative_index) const;
72
73 uint32_t relative_index(const DEX::Method& m) const;
74 uint32_t relative_index(uint32_t method_absolute_index) const;
75
77
78 void accept(Visitor& visitor) const override;
79
80
81 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Class& cls);
82
83 ~Class() override;
84
85 private:
86
87 DEX::Class* dex_class_ = nullptr;
88
89 OAT_CLASS_STATUS status_ = OAT_CLASS_STATUS::STATUS_NOTREADY;
90 OAT_CLASS_TYPES type_ = OAT_CLASS_TYPES::OAT_CLASS_NONE_COMPILED;
91
92 std::vector<uint32_t> method_bitmap_;
93 methods_t methods_;
94
95};
96
97} // Namespace OAT
98} // Namespace LIEF
99#endif
Class which represents a DEX Class (i.e. a Java/Kotlin class)
Definition DEX/Class.hpp:35
Class which represents a DEX::Method.
Definition DEX/Method.hpp:36
Definition OAT/Class.hpp:35
it_methods methods()
OAT_CLASS_TYPES type() const
bool is_quickened(uint32_t relative_index) const
uint32_t method_offsets_index(const DEX::Method &m) const
Class(const Class &)
uint32_t method_offsets_index(uint32_t relative_index) const
uint32_t relative_index(const DEX::Method &m) const
Class & operator=(const Class &)
void accept(Visitor &visitor) const override
const std::vector< uint32_t > & bitmap() const
~Class() override
bool is_quickened(const DEX::Method &m) const
OAT_CLASS_STATUS status() const
DEX::dex2dex_class_info_t dex2dex_info() const
std::vector< Method * > methods_t
Definition OAT/Class.hpp:39
uint32_t relative_index(uint32_t method_absolute_index) const
const DEX::Class * dex_class() const
DEX::Class * dex_class()
size_t index() const
it_const_methods methods() const
const std::string & fullname() const
Class(OAT_CLASS_STATUS status, OAT_CLASS_TYPES type, DEX::Class *dex_class, std::vector< uint32_t > bitmap={})
friend std::ostream & operator<<(std::ostream &os, const Class &cls)
bool has_dex_class() const
Class to parse an OAT file to produce an OAT::Binary.
Definition OAT/Parser.hpp:38
Definition Object.hpp:25
Definition Visitor.hpp:224
Iterator which returns reference on container's values.
Definition iterators.hpp:48
std::unordered_map< Method *, dex2dex_method_info_t > dex2dex_class_info_t
Definition deopt.hpp:28
OAT_CLASS_TYPES
Definition OAT/enums.hpp:22
OAT_CLASS_STATUS
Definition OAT/enums.hpp:29
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41