diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-08-24 16:03:48 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-08-26 19:40:50 -0700 |
commit | 5c3464c75fc517c0306a4ffd39c59671ccfde544 (patch) | |
tree | 6a20580de33238d2c16a761f880a442eb5c74c0b /tools/aapt2/ResourceTable.h | |
parent | e637f31581787efc533b2115ca7d71fa8d92e98b (diff) |
AAPT2: Fix merging of styleables the right way
Styleables should only be merged when processing overlays.
This moves the styleable merging code out of ResourceTable
and into TableMerger.
Change-Id: I3aae05cf4dd875cd25ac2ac744b61194409b2fee
Diffstat (limited to 'tools/aapt2/ResourceTable.h')
-rw-r--r-- | tools/aapt2/ResourceTable.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h index 6b52a4360b7a..df6081456605 100644 --- a/tools/aapt2/ResourceTable.h +++ b/tools/aapt2/ResourceTable.h @@ -38,8 +38,8 @@ namespace aapt { enum class SymbolState { kUndefined, + kPrivate, kPublic, - kPrivate }; /** @@ -185,13 +185,18 @@ class ResourceTable { public: ResourceTable() = default; + enum class CollisionResult { + kKeepOriginal, + kConflict, + kTakeNew + }; + + using CollisionResolverFunc = std::function<CollisionResult(Value*, Value*)>; + /** * When a collision of resources occurs, this method decides which value to keep. - * Returns -1 if the existing value should be chosen. - * Returns 0 if the collision can not be resolved (error). - * Returns 1 if the incoming value should be chosen. */ - static int resolveValueCollision(Value* existing, Value* incoming); + static CollisionResult resolveValueCollision(Value* existing, Value* incoming); bool addResource(const ResourceNameRef& name, const ConfigDescription& config, @@ -299,7 +304,7 @@ private: const StringPiece& product, std::unique_ptr<Value> value, const char* validChars, - const std::function<int(Value*,Value*)>& conflictResolver, + const CollisionResolverFunc& conflictResolver, IDiagnostics* diag); bool setSymbolStateImpl(const ResourceNameRef& name, |