diff options
Diffstat (limited to 'tools/aapt2/Resource.h')
-rw-r--r-- | tools/aapt2/Resource.h | 30 |
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. // |