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 2011 Google Inc. All Rights Reserved.
#ifndef ART_SRC_DEX_FILE_H_
#define ART_SRC_DEX_FILE_H_
#include "globals.h"
#include "macros.h"
#include "object.h"
namespace art {
class Class;
class Field;
class Method;
class String;
union JValue;
class DexFile : public ObjectArray {
public:
enum ArrayIndexes {
kStrings = 0,
kClasses = 1,
kMethods = 2,
kFields = 3,
kMax = 4,
};
void Init(ObjectArray* strings, ObjectArray* classes, ObjectArray* methods, ObjectArray* fields);
size_t NumStrings() const {
return GetStrings()->GetLength();
}
size_t NumClasses() const {
return GetClasses()->GetLength();
}
size_t NumMethods() const {
return GetMethods()->GetLength();
}
size_t NumFields() const {
return GetFields()->GetLength();
}
String* GetResolvedString(uint32_t string_idx) const {
return down_cast<String*>(GetStrings()->Get(string_idx));
}
void SetResolvedString(uint32_t string_idx, String* resolved) {
GetStrings()->Set(string_idx, resolved);
}
Class* GetResolvedClass(uint32_t class_idx) const {
return down_cast<Class*>(GetClasses()->Get(class_idx));
}
void SetResolvedClass(uint32_t class_idx, Class* resolved) {
GetClasses()->Set(class_idx, resolved);
}
Method* GetResolvedMethod(uint32_t method_idx) const {
return down_cast<Method*>(GetMethods()->Get(method_idx));
}
void SetResolvedMethod(uint32_t method_idx, Method* resolved) {
GetMethods()->Set(method_idx, resolved);
}
Field* GetResolvedField(uint32_t field_idx) const {
return down_cast<Field*>(GetFields()->Get(field_idx));
}
void SetResolvedfield(uint32_t field_idx, Field* resolved) {
GetFields()->Set(field_idx, resolved);
}
private:
ObjectArray* GetStrings() const {
return down_cast<ObjectArray*>(Get(kStrings));
}
ObjectArray* GetClasses() const {
return down_cast<ObjectArray*>(Get(kClasses));
}
ObjectArray* GetMethods() const {
return down_cast<ObjectArray*>(Get(kMethods));
}
ObjectArray* GetFields() const {
return down_cast<ObjectArray*>(Get(kFields));
}
DexFile();
};
} // namespace art
#endif // ART_SRC_DEX_FILE_H_
|