forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDexFile.cpp
More file actions
97 lines (72 loc) · 2.19 KB
/
Copy pathDexFile.cpp
File metadata and controls
97 lines (72 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* Copyright 2017 - 2025 R. Thomas
* Copyright 2017 - 2025 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "LIEF/OAT/DexFile.hpp"
#include "LIEF/OAT/hash.hpp"
#include <ostream>
namespace LIEF {
namespace OAT {
DexFile::DexFile(const DexFile&) = default;
DexFile& DexFile::operator=(const DexFile&) = default;
DexFile::DexFile() = default;
const std::string& DexFile::location() const {
return location_;
}
uint32_t DexFile::checksum() const {
return checksum_;
}
uint32_t DexFile::dex_offset() const {
return dex_offset_;
}
bool DexFile::has_dex_file() const {
return dex_file_ != nullptr;
}
const DEX::File* DexFile::dex_file() const {
return dex_file_;
}
void DexFile::location(const std::string& location) {
location_ = location;
}
void DexFile::checksum(uint32_t checksum) {
checksum_ = checksum;
}
void DexFile::dex_offset(uint32_t dex_offset) {
dex_offset_ = dex_offset;
}
const std::vector<uint32_t>& DexFile::classes_offsets() const {
return classes_offsets_;
}
// Android 7.X.X and Android 8.0.0
// ===============================
uint32_t DexFile::lookup_table_offset() const {
return lookup_table_offset_;
}
void DexFile::lookup_table_offset(uint32_t offset) {
lookup_table_offset_ = offset;
}
// ===============================
DEX::File* DexFile::dex_file() {
return const_cast<DEX::File*>(static_cast<const DexFile*>(this)->dex_file());
}
void DexFile::accept(Visitor& visitor) const {
visitor.visit(*this);
}
std::ostream& operator<<(std::ostream& os, const DexFile& dex_file) {
os << dex_file.location() << " - " << std::hex << std::showbase << "(Checksum: " << dex_file.checksum() << ")";
return os;
}
DexFile::~DexFile() = default;
}
}