summaryrefslogtreecommitdiff
path: root/tools/aapt2/Resource.h
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2016-06-01 15:31:50 -0700
committerAdam Lesinski <adamlesinski@google.com>2016-07-25 16:02:18 -0700
commitbf0bd0f9ac1ffa0231cff0f6591dede48b3c6d52 (patch)
treefa0def8a1f754872ce6b912e30b7badc6470e208 /tools/aapt2/Resource.h
parentef556916aa75ae5e992b7c92345dc1011899a660 (diff)
AAPT2: Add support to specify stable IDs
The --stable-ids flag allows the user to specify a file containing a list of resource name and resource ID pairs in the form of: package:type/name = 0xPPTTEEEE This assigns the given resource the specified ID. It helps ensure that when adding or removing resources, IDs are assigned in a stable fashion. If a package, type, or name is not found, no error or warning is raised. Change-Id: Ibc2f4e05cc924be255fedd862d835cb5b18d7584
Diffstat (limited to 'tools/aapt2/Resource.h')
-rw-r--r--tools/aapt2/Resource.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h
index 22d75a2fb315..0ba034520563 100644
--- a/tools/aapt2/Resource.h
+++ b/tools/aapt2/Resource.h
@@ -19,9 +19,10 @@
#include "ConfigDescription.h"
#include "Source.h"
-
#include "util/StringPiece.h"
+#include <utils/JenkinsHash.h>
+
#include <iomanip>
#include <limits>
#include <sstream>
@@ -353,4 +354,18 @@ inline bool operator==(const SourcedResourceName& lhs, const SourcedResourceName
} // namespace aapt
+namespace std {
+
+template <> struct hash<aapt::ResourceName> {
+ size_t operator()(const aapt::ResourceName& name) const {
+ android::hash_t h = 0;
+ h = android::JenkinsHashMix(h, hash<string>()(name.package));
+ h = android::JenkinsHashMix(h, static_cast<uint32_t>(name.type));
+ h = android::JenkinsHashMix(h, hash<string>()(name.entry));
+ return static_cast<size_t>(h);
+ }
+};
+
+} // namespace std
+
#endif // AAPT_RESOURCE_H