summaryrefslogtreecommitdiff
path: root/tools/aapt2/Resource.h
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-12-09 15:20:52 -0800
committerAdam Lesinski <adamlesinski@google.com>2015-12-10 16:24:15 -0800
commita6fe345be955368a13aea76aefb4db821aad11df (patch)
treec5385f798a6e1fb674f6f13c0f323726258618ca /tools/aapt2/Resource.h
parent01655232371d7c7ea5b58ccf66ad99917072018a (diff)
AAPT2: Fix overlay support
Supports the <add-resource> tag and mimics old AAPT behavior of not allowing new resources defined unless <add-resource> was used or --auto-add-overlay was specified. Change-Id: I9b461137357617ade37fd7045b418b8e6450b9c4
Diffstat (limited to 'tools/aapt2/Resource.h')
-rw-r--r--tools/aapt2/Resource.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h
index a7afbb5e4018..c71e249d71f2 100644
--- a/tools/aapt2/Resource.h
+++ b/tools/aapt2/Resource.h
@@ -165,6 +165,36 @@ struct ResourceFile {
std::vector<SourcedResourceName> exportedSymbols;
};
+/**
+ * Useful struct used as a key to represent a unique resource in associative containers.
+ */
+struct ResourceKey {
+ ResourceName name;
+ ConfigDescription config;
+};
+
+bool operator<(const ResourceKey& a, const ResourceKey& b);
+
+/**
+ * Useful struct used as a key to represent a unique resource in associative containers.
+ * Holds a reference to the name, so that name better live longer than this key!
+ */
+struct ResourceKeyRef {
+ ResourceNameRef name;
+ ConfigDescription config;
+
+ ResourceKeyRef() = default;
+ ResourceKeyRef(const ResourceNameRef& n, const ConfigDescription& c) : name(n), config(c) {
+ }
+
+ /**
+ * Prevent taking a reference to a temporary. This is bad.
+ */
+ ResourceKeyRef(ResourceName&& n, const ConfigDescription& c) = delete;
+};
+
+bool operator<(const ResourceKeyRef& a, const ResourceKeyRef& b);
+
//
// ResourceId implementation.
//