diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-10-22 12:48:43 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-10-22 16:35:47 -0700 |
commit | e78fd617ec60139a973a01925fa7adad31febb39 (patch) | |
tree | b64f9590b16dfb2e6e9ea8bf2eb5d54a02230b0a /tools/aapt2/ValueVisitor.h | |
parent | 3b7acbb86207df78eccfeb40aabcc8543703a58f (diff) |
AAPT2: Move comments and source into Value
Values are closely related to where they were defined, so
this information should live inside the Value.
This also enables comments to be attached to nested Values.
Change-Id: Ic7481b5a5f26d0ef248d638e2e29252f88154581
Diffstat (limited to 'tools/aapt2/ValueVisitor.h')
-rw-r--r-- | tools/aapt2/ValueVisitor.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/aapt2/ValueVisitor.h b/tools/aapt2/ValueVisitor.h index ee058aa1a37b..94042e3c2618 100644 --- a/tools/aapt2/ValueVisitor.h +++ b/tools/aapt2/ValueVisitor.h @@ -115,6 +115,18 @@ struct DynCastVisitor : public RawValueVisitor { }; /** + * Specialization that checks if the value is an Item. + */ +template <> +struct DynCastVisitor<Item> : public RawValueVisitor { + Item* value = nullptr; + + void visitItem(Item* item) override { + value = item; + } +}; + +/** * Returns a valid pointer to T if the Value is of subtype T. * Otherwise, returns nullptr. */ |