summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceValues.h
diff options
context:
space:
mode:
author Jeremy Meyer <jakmcbane@google.com> 2024-08-14 11:16:58 -0700
committer Jeremy Meyer <jakmcbane@google.com> 2024-08-15 14:39:42 -0700
commitd52bd6858a6b2913f46e57bca0d96d5212416f10 (patch)
tree344a52e787e6e0064193d0b176ba58fd50d71c00 /tools/aapt2/ResourceValues.h
parentd439c6190e217780329f747d18e9683fce8a5002 (diff)
Flag support for bag resource types
Test: Automated Bug: 329436914 Flag: EXEMPT Aconfig not supported on host tools Change-Id: I891c93c3ffcab172d28701b44a80c50f1e24d99e
Diffstat (limited to 'tools/aapt2/ResourceValues.h')
-rw-r--r--tools/aapt2/ResourceValues.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceValues.h b/tools/aapt2/ResourceValues.h
index 5192c2be1f98..a1b1839b19ef 100644
--- a/tools/aapt2/ResourceValues.h
+++ b/tools/aapt2/ResourceValues.h
@@ -65,6 +65,14 @@ class Value {
return translatable_;
}
+ void SetFlagStatus(FlagStatus val) {
+ flag_status_ = val;
+ }
+
+ FlagStatus GetFlagStatus() const {
+ return flag_status_;
+ }
+
// Returns the source where this value was defined.
const android::Source& GetSource() const {
return source_;
@@ -109,6 +117,10 @@ class Value {
// of brevity and readability. Default implementation just calls Print().
virtual void PrettyPrint(text::Printer* printer) const;
+ // Removes any part of the value that is beind a disabled flag.
+ virtual void RemoveFlagDisabledElements() {
+ }
+
friend std::ostream& operator<<(std::ostream& out, const Value& value);
protected:
@@ -116,6 +128,7 @@ class Value {
std::string comment_;
bool weak_ = false;
bool translatable_ = true;
+ FlagStatus flag_status_ = FlagStatus::NoFlag;
private:
virtual Value* TransformValueImpl(ValueTransformer& transformer) const = 0;
@@ -346,6 +359,7 @@ struct Array : public TransformableValue<Array, BaseValue<Array>> {
bool Equals(const Value* value) const override;
void Print(std::ostream* out) const override;
+ void RemoveFlagDisabledElements() override;
};
struct Plural : public TransformableValue<Plural, BaseValue<Plural>> {