| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef AAPT_SYMBOL_H |
| 18 |
#define AAPT_SYMBOL_H |
| 19 |
|
| 20 |
#include <utils/String8.h> |
| 21 |
#include <utils/String16.h> |
| 22 |
|
| 23 |
#include "ConfigDescription.h" |
| 24 |
#include "SourcePos.h" |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
struct Symbol { |
| 30 |
inline Symbol(); |
| 31 |
inline Symbol(const android::String16& p, const android::String16& t, const android::String16& n, uint32_t i); |
| 32 |
inline android::String8 toString() const; |
| 33 |
inline bool operator<(const Symbol& rhs) const; |
| 34 |
|
| 35 |
android::String16 package; |
| 36 |
android::String16 type; |
| 37 |
android::String16 name; |
| 38 |
uint32_t id; |
| 39 |
|
| 40 |
}; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
struct SymbolDefinition { |
| 46 |
inline SymbolDefinition(); |
| 47 |
inline SymbolDefinition(const Symbol& s, const ConfigDescription& c, const SourcePos& src); |
| 48 |
inline bool operator<(const SymbolDefinition& rhs) const; |
| 49 |
|
| 50 |
Symbol symbol; |
| 51 |
ConfigDescription config; |
| 52 |
SourcePos source; |
| 53 |
}; |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
Symbol::Symbol() { |
| 60 |
} |
| 61 |
|
| 62 |
Symbol::Symbol(const android::String16& p, const android::String16& t, const android::String16& n, uint32_t i) |
| 63 |
: package(p) |
| 64 |
, type(t) |
| 65 |
, name(n) |
| 66 |
, id(i) { |
| 67 |
} |
| 68 |
|
| 69 |
android::String8 Symbol::toString() const { |
| 70 |
return android::String8::format("%s:%s/%s (0x%08x)", |
| •71 |
android::String8(package).c_str(), |
| 72 |
android::String8(type).c_str(), |
| 73 |
android::String8(name).c_str(), |
| 74 |
(int) id); |
| 75 |
} |
| 76 |
|
| 77 |
bool Symbol::operator<(const Symbol& rhs) const { |
| 78 |
return (package < rhs.package) || (type < rhs.type) || (name < rhs.name) || (id < rhs.id); |
| 79 |
} |
| 80 |
|
| 81 |
SymbolDefinition::SymbolDefinition() { |
| 82 |
} |
| 83 |
|
| 84 |
SymbolDefinition::SymbolDefinition(const Symbol& s, const ConfigDescription& c, const SourcePos& src) |
| 85 |
: symbol(s) |
| 86 |
, config(c) |
| 87 |
, source(src) { |
| 88 |
} |
| 89 |
|
| 90 |
bool SymbolDefinition::operator<(const SymbolDefinition& rhs) const { |
| 91 |
return (symbol < rhs.symbol) || (config < rhs.config) || (source < rhs.source); |
| 92 |
} |
| 93 |
|
| 94 |
#endif |
| 95 |
|