blob: 493f238b033da420f38a81939b47d7de527d0777 [file] [log] [blame]
Adam Lesinski6f6ceb72014-11-14 14:48:12 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
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
17#ifndef AAPT_RESOURCE_H
18#define AAPT_RESOURCE_H
19
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080020#include <iomanip>
Adam Lesinskica2fc352015-04-03 12:08:26 -070021#include <limits>
Adam Lesinskid0f116b2016-07-08 15:00:32 -070022#include <sstream>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080023#include <string>
24#include <tuple>
Adam Lesinski1ab598f2015-08-14 14:26:04 -070025#include <vector>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080026
Adam Lesinskid5083f62017-01-16 15:07:21 -080027#include "androidfw/StringPiece.h"
Adam Lesinskice5e56e2016-10-21 17:56:45 -070028#include "utils/JenkinsHash.h"
29
30#include "ConfigDescription.h"
31#include "Source.h"
Adam Lesinskice5e56e2016-10-21 17:56:45 -070032
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080033namespace aapt {
34
35/**
36 * The various types of resource types available. Corresponds
37 * to the 'type' in package:type/entry.
38 */
39enum class ResourceType {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070040 kAnim,
41 kAnimator,
42 kArray,
43 kAttr,
44 kAttrPrivate,
45 kBool,
46 kColor,
Adam Lesinski86d67df2017-01-31 13:47:27 -080047
48 // Not really a type, but it shows up in some CTS tests and
49 // we need to continue respecting it.
50 kConfigVarying,
51
Adam Lesinskicacb28f2016-10-19 12:18:14 -070052 kDimen,
53 kDrawable,
Adam Lesinskic0c36632016-10-19 18:37:53 -070054 kFont,
Adam Lesinskicacb28f2016-10-19 12:18:14 -070055 kFraction,
56 kId,
57 kInteger,
58 kInterpolator,
59 kLayout,
60 kMenu,
61 kMipmap,
62 kPlurals,
63 kRaw,
64 kString,
65 kStyle,
66 kStyleable,
67 kTransition,
68 kXml,
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080069};
70
Adam Lesinskid5083f62017-01-16 15:07:21 -080071android::StringPiece ToString(ResourceType type);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080072
73/**
74 * Returns a pointer to a valid ResourceType, or nullptr if
75 * the string was invalid.
76 */
Adam Lesinskid5083f62017-01-16 15:07:21 -080077const ResourceType* ParseResourceType(const android::StringPiece& str);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080078
79/**
80 * A resource's name. This can uniquely identify
81 * a resource in the ResourceTable.
82 */
83struct ResourceName {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070084 std::string package;
Adam Lesinskice5e56e2016-10-21 17:56:45 -070085 ResourceType type = ResourceType::kRaw;
Adam Lesinskicacb28f2016-10-19 12:18:14 -070086 std::string entry;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080087
Adam Lesinskice5e56e2016-10-21 17:56:45 -070088 ResourceName() = default;
Adam Lesinskid5083f62017-01-16 15:07:21 -080089 ResourceName(const android::StringPiece& p, ResourceType t, const android::StringPiece& e);
Adam Lesinski9ba47d82015-10-13 11:37:10 -070090
Adam Lesinskicacb28f2016-10-19 12:18:14 -070091 int compare(const ResourceName& other) const;
Adam Lesinski8197cc462016-08-19 12:16:49 -070092
Adam Lesinskice5e56e2016-10-21 17:56:45 -070093 bool is_valid() const;
94 std::string ToString() const;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080095};
96
97/**
98 * Same as ResourceName, but uses StringPieces instead.
99 * Use this if you need to avoid copying and know that
100 * the lifetime of this object is shorter than that
101 * of the original string.
102 */
103struct ResourceNameRef {
Adam Lesinskid5083f62017-01-16 15:07:21 -0800104 android::StringPiece package;
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700105 ResourceType type = ResourceType::kRaw;
Adam Lesinskid5083f62017-01-16 15:07:21 -0800106 android::StringPiece entry;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800107
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700108 ResourceNameRef() = default;
109 ResourceNameRef(const ResourceNameRef&) = default;
110 ResourceNameRef(ResourceNameRef&&) = default;
111 ResourceNameRef(const ResourceName& rhs); // NOLINT(implicit)
Adam Lesinskid5083f62017-01-16 15:07:21 -0800112 ResourceNameRef(const android::StringPiece& p, ResourceType t, const android::StringPiece& e);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700113 ResourceNameRef& operator=(const ResourceNameRef& rhs) = default;
114 ResourceNameRef& operator=(ResourceNameRef&& rhs) = default;
115 ResourceNameRef& operator=(const ResourceName& rhs);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800116
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700117 ResourceName ToResourceName() const;
118 bool is_valid() const;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800119};
120
Adam Lesinskib5dc4bd2017-02-22 19:29:29 -0800121constexpr const uint8_t kAppPackageId = 0x7fu;
122constexpr const uint8_t kFrameworkPackageId = 0x01u;
123
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800124/**
125 * A binary identifier representing a resource. Internally it
126 * is a 32bit integer split as follows:
127 *
128 * 0xPPTTEEEE
129 *
130 * PP: 8 bit package identifier. 0x01 is reserved for system
131 * and 0x7f is reserved for the running app.
132 * TT: 8 bit type identifier. 0x00 is invalid.
133 * EEEE: 16 bit entry identifier.
134 */
135struct ResourceId {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700136 uint32_t id;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800137
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700138 ResourceId();
139 ResourceId(const ResourceId& rhs);
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700140 ResourceId(uint32_t res_id); // NOLINT(implicit)
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700141 ResourceId(uint8_t p, uint8_t t, uint16_t e);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800142
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700143 bool is_valid() const;
Adam Lesinskiceb9b2f2017-02-16 12:05:42 -0800144
145 // Returns true if the ID is a valid ID or dynamic ID (package ID can be 0).
146 bool is_valid_dynamic() const;
147
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700148 uint8_t package_id() const;
149 uint8_t type_id() const;
150 uint16_t entry_id() const;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800151};
152
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700153struct SourcedResourceName {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700154 ResourceName name;
155 size_t line;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700156};
157
158struct ResourceFile {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700159 // Name
160 ResourceName name;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700161
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700162 // Configuration
163 ConfigDescription config;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700164
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700165 // Source
166 Source source;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700167
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700168 // Exported symbols
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700169 std::vector<SourcedResourceName> exported_symbols;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700170};
171
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800172/**
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700173 * Useful struct used as a key to represent a unique resource in associative
174 * containers.
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800175 */
176struct ResourceKey {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700177 ResourceName name;
178 ConfigDescription config;
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800179};
180
181bool operator<(const ResourceKey& a, const ResourceKey& b);
182
183/**
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700184 * Useful struct used as a key to represent a unique resource in associative
185 * containers.
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800186 * Holds a reference to the name, so that name better live longer than this key!
187 */
188struct ResourceKeyRef {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700189 ResourceNameRef name;
190 ConfigDescription config;
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800191
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700192 ResourceKeyRef() = default;
193 ResourceKeyRef(const ResourceNameRef& n, const ConfigDescription& c)
194 : name(n), config(c) {}
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800195
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700196 /**
197 * Prevent taking a reference to a temporary. This is bad.
198 */
199 ResourceKeyRef(ResourceName&& n, const ConfigDescription& c) = delete;
Adam Lesinskia6fe3452015-12-09 15:20:52 -0800200};
201
202bool operator<(const ResourceKeyRef& a, const ResourceKeyRef& b);
203
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800204//
205// ResourceId implementation.
206//
207
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700208inline ResourceId::ResourceId() : id(0) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800209
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700210inline ResourceId::ResourceId(const ResourceId& rhs) : id(rhs.id) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800211
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700212inline ResourceId::ResourceId(uint32_t res_id) : id(res_id) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800213
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700214inline ResourceId::ResourceId(uint8_t p, uint8_t t, uint16_t e)
215 : id((p << 24) | (t << 16) | e) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800216
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700217inline bool ResourceId::is_valid() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700218 return (id & 0xff000000u) != 0 && (id & 0x00ff0000u) != 0;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800219}
220
Adam Lesinskiceb9b2f2017-02-16 12:05:42 -0800221inline bool ResourceId::is_valid_dynamic() const { return (id & 0x00ff0000u) != 0; }
222
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700223inline uint8_t ResourceId::package_id() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700224 return static_cast<uint8_t>(id >> 24);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800225}
226
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700227inline uint8_t ResourceId::type_id() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700228 return static_cast<uint8_t>(id >> 16);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800229}
230
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700231inline uint16_t ResourceId::entry_id() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700232 return static_cast<uint16_t>(id);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800233}
234
Adam Lesinski74605cd2016-03-03 15:39:50 -0800235inline bool operator<(const ResourceId& lhs, const ResourceId& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700236 return lhs.id < rhs.id;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800237}
238
Adam Lesinski74605cd2016-03-03 15:39:50 -0800239inline bool operator>(const ResourceId& lhs, const ResourceId& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700240 return lhs.id > rhs.id;
Adam Lesinski24aad162015-04-24 19:19:30 -0700241}
242
Adam Lesinski74605cd2016-03-03 15:39:50 -0800243inline bool operator==(const ResourceId& lhs, const ResourceId& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700244 return lhs.id == rhs.id;
Adam Lesinski74605cd2016-03-03 15:39:50 -0800245}
246
247inline bool operator!=(const ResourceId& lhs, const ResourceId& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700248 return lhs.id != rhs.id;
Adam Lesinski74605cd2016-03-03 15:39:50 -0800249}
250
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700251inline ::std::ostream& operator<<(::std::ostream& out,
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700252 const ResourceId& res_id) {
253 std::ios_base::fmtflags old_flags = out.flags();
254 char old_fill = out.fill();
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700255 out << "0x" << std::internal << std::setfill('0') << std::setw(8) << std::hex
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700256 << res_id.id;
257 out.flags(old_flags);
258 out.fill(old_fill);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700259 return out;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800260}
261
262//
263// ResourceType implementation.
264//
265
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700266inline ::std::ostream& operator<<(::std::ostream& out,
267 const ResourceType& val) {
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700268 return out << ToString(val);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800269}
270
271//
272// ResourceName implementation.
273//
274
Adam Lesinskid5083f62017-01-16 15:07:21 -0800275inline ResourceName::ResourceName(const android::StringPiece& p, ResourceType t,
276 const android::StringPiece& e)
277 : package(p.to_string()), type(t), entry(e.to_string()) {}
Adam Lesinski9ba47d82015-10-13 11:37:10 -0700278
Adam Lesinski8197cc462016-08-19 12:16:49 -0700279inline int ResourceName::compare(const ResourceName& other) const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700280 int cmp = package.compare(other.package);
281 if (cmp != 0) return cmp;
282 cmp = static_cast<int>(type) - static_cast<int>(other.type);
283 if (cmp != 0) return cmp;
284 cmp = entry.compare(other.entry);
285 return cmp;
Adam Lesinski8197cc462016-08-19 12:16:49 -0700286}
287
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700288inline bool ResourceName::is_valid() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700289 return !package.empty() && !entry.empty();
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800290}
291
Adam Lesinski74605cd2016-03-03 15:39:50 -0800292inline bool operator<(const ResourceName& lhs, const ResourceName& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700293 return std::tie(lhs.package, lhs.type, lhs.entry) <
294 std::tie(rhs.package, rhs.type, rhs.entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800295}
296
Adam Lesinski74605cd2016-03-03 15:39:50 -0800297inline bool operator==(const ResourceName& lhs, const ResourceName& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700298 return std::tie(lhs.package, lhs.type, lhs.entry) ==
299 std::tie(rhs.package, rhs.type, rhs.entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800300}
301
Adam Lesinski74605cd2016-03-03 15:39:50 -0800302inline bool operator!=(const ResourceName& lhs, const ResourceName& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700303 return std::tie(lhs.package, lhs.type, lhs.entry) !=
304 std::tie(rhs.package, rhs.type, rhs.entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800305}
306
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700307inline ::std::ostream& operator<<(::std::ostream& out,
308 const ResourceName& name) {
309 if (!name.package.empty()) {
310 out << name.package << ":";
311 }
312 return out << name.type << "/" << name.entry;
Adam Lesinski769de982015-04-10 19:43:55 -0700313}
314
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700315inline std::string ResourceName::ToString() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700316 std::stringstream stream;
317 stream << *this;
318 return stream.str();
Adam Lesinskid0f116b2016-07-08 15:00:32 -0700319}
Adam Lesinski769de982015-04-10 19:43:55 -0700320
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800321//
322// ResourceNameRef implementation.
323//
324
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700325inline ResourceNameRef::ResourceNameRef(const ResourceName& rhs)
326 : package(rhs.package), type(rhs.type), entry(rhs.entry) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800327
Adam Lesinskid5083f62017-01-16 15:07:21 -0800328inline ResourceNameRef::ResourceNameRef(const android::StringPiece& p, ResourceType t,
329 const android::StringPiece& e)
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700330 : package(p), type(t), entry(e) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800331
332inline ResourceNameRef& ResourceNameRef::operator=(const ResourceName& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700333 package = rhs.package;
334 type = rhs.type;
335 entry = rhs.entry;
336 return *this;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800337}
338
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700339inline ResourceName ResourceNameRef::ToResourceName() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700340 return ResourceName(package, type, entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800341}
342
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700343inline bool ResourceNameRef::is_valid() const {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700344 return !package.empty() && !entry.empty();
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800345}
346
Adam Lesinski74605cd2016-03-03 15:39:50 -0800347inline bool operator<(const ResourceNameRef& lhs, const ResourceNameRef& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700348 return std::tie(lhs.package, lhs.type, lhs.entry) <
349 std::tie(rhs.package, rhs.type, rhs.entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800350}
351
Adam Lesinski74605cd2016-03-03 15:39:50 -0800352inline bool operator==(const ResourceNameRef& lhs, const ResourceNameRef& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700353 return std::tie(lhs.package, lhs.type, lhs.entry) ==
354 std::tie(rhs.package, rhs.type, rhs.entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800355}
356
Adam Lesinski74605cd2016-03-03 15:39:50 -0800357inline bool operator!=(const ResourceNameRef& lhs, const ResourceNameRef& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700358 return std::tie(lhs.package, lhs.type, lhs.entry) !=
359 std::tie(rhs.package, rhs.type, rhs.entry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800360}
361
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700362inline ::std::ostream& operator<<(::std::ostream& out,
363 const ResourceNameRef& name) {
364 if (!name.package.empty()) {
365 out << name.package << ":";
366 }
367 return out << name.type << "/" << name.entry;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800368}
369
Adam Lesinski74605cd2016-03-03 15:39:50 -0800370inline bool operator<(const ResourceName& lhs, const ResourceNameRef& b) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700371 return ResourceNameRef(lhs) < b;
Adam Lesinski74605cd2016-03-03 15:39:50 -0800372}
373
374inline bool operator!=(const ResourceName& lhs, const ResourceNameRef& rhs) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700375 return ResourceNameRef(lhs) != rhs;
Adam Lesinski74605cd2016-03-03 15:39:50 -0800376}
377
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700378inline bool operator==(const SourcedResourceName& lhs,
379 const SourcedResourceName& rhs) {
380 return lhs.name == rhs.name && lhs.line == rhs.line;
Adam Lesinski74605cd2016-03-03 15:39:50 -0800381}
382
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700383} // namespace aapt
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800384
Adam Lesinskibf0bd0f2016-06-01 15:31:50 -0700385namespace std {
386
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700387template <>
388struct hash<aapt::ResourceName> {
389 size_t operator()(const aapt::ResourceName& name) const {
390 android::hash_t h = 0;
391 h = android::JenkinsHashMix(h, hash<string>()(name.package));
392 h = android::JenkinsHashMix(h, static_cast<uint32_t>(name.type));
393 h = android::JenkinsHashMix(h, hash<string>()(name.entry));
394 return static_cast<size_t>(h);
395 }
Adam Lesinskibf0bd0f2016-06-01 15:31:50 -0700396};
397
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700398} // namespace std
Adam Lesinskibf0bd0f2016-06-01 15:31:50 -0700399
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700400#endif // AAPT_RESOURCE_H