summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceValues.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2024-12-13 17:29:18 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-12-13 17:29:18 -0800
commit7b1f850c50427ff38c20c83721c2e7aa173e62c2 (patch)
tree92f02a12a16318cde6d9a3b3761ca2c0040ce557 /tools/aapt2/ResourceValues.cpp
parent3f4c4881a31f0a24979df539b9d1e9c557a3619d (diff)
parent10e260fc86f8b879e9a88610994344f30bea7520 (diff)
Merge "Merge 24Q4 into AOSP main" into main
Diffstat (limited to 'tools/aapt2/ResourceValues.cpp')
-rw-r--r--tools/aapt2/ResourceValues.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceValues.cpp b/tools/aapt2/ResourceValues.cpp
index 166b01bd9154..b75e87c90128 100644
--- a/tools/aapt2/ResourceValues.cpp
+++ b/tools/aapt2/ResourceValues.cpp
@@ -971,6 +971,16 @@ void Array::Print(std::ostream* out) const {
*out << "(array) [" << util::Joiner(elements, ", ") << "]";
}
+void Array::RemoveFlagDisabledElements() {
+ const auto end_iter = elements.end();
+ const auto remove_iter = std::stable_partition(
+ elements.begin(), end_iter, [](const std::unique_ptr<Item>& item) -> bool {
+ return item->GetFlagStatus() != FlagStatus::Disabled;
+ });
+
+ elements.erase(remove_iter, end_iter);
+}
+
bool Plural::Equals(const Value* value) const {
const Plural* other = ValueCast<Plural>(value);
if (!other) {
@@ -1092,6 +1102,7 @@ template <typename T>
std::unique_ptr<T> CopyValueFields(std::unique_ptr<T> new_value, const T* value) {
new_value->SetSource(value->GetSource());
new_value->SetComment(value->GetComment());
+ new_value->SetFlagStatus(value->GetFlagStatus());
return new_value;
}