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
diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h
index 22d75a2..0ba0345 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 @@
 
 } // 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