summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-08-07 19:44:10 -0500
committerYifan Hong2018-08-08 12:07:39 -0500
commita1b112d010c403ccdddba10b1882054b3b48da8d (patch)
tree41fa70e46dcf16c4ea80374d382d5e59e91e30d9 /parse_xml.cpp
parent5c9ff706f0a8363bef1e205334892ace33855c6b (diff)
downloadplatform-system-libvintf-a1b112d010c403ccdddba10b1882054b3b48da8d.tar.gz
platform-system-libvintf-a1b112d010c403ccdddba10b1882054b3b48da8d.tar.xz
platform-system-libvintf-a1b112d010c403ccdddba10b1882054b3b48da8d.zip
SerializeFlags: Remove legacy APIs
Remove legacy bitwise operators and boolean conversions that are meant to be compatible with the old negative flags usage. Also fix all such usages. Bug: 110711640 Test: libvintf_test Change-Id: Ic69a7066dd3ae320aeb0a1848eb7719f67da29d3
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index fba8dfd..0aec6b8 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -607,7 +607,7 @@ struct MatrixKernelConverter : public XmlNodeConverter<MatrixKernel> {
607 void mutateNode(const MatrixKernel& kernel, NodeType* root, DocType* d, 607 void mutateNode(const MatrixKernel& kernel, NodeType* root, DocType* d,
608 SerializeFlags flags) const override { 608 SerializeFlags flags) const override {
609 KernelVersion kv = kernel.mMinLts; 609 KernelVersion kv = kernel.mMinLts;
610 if (flags & SerializeFlags::NO_KERNEL_MINOR_REVISION) { 610 if (!flags.isKernelMinorRevisionEnabled()) {
611 kv.minorRev = 0u; 611 kv.minorRev = 0u;
612 } 612 }
613 appendAttr(root, "version", kv); 613 appendAttr(root, "version", kv);
@@ -615,7 +615,7 @@ struct MatrixKernelConverter : public XmlNodeConverter<MatrixKernel> {
615 if (!kernel.mConditions.empty()) { 615 if (!kernel.mConditions.empty()) {
616 appendChild(root, matrixKernelConditionsConverter(kernel.mConditions, d)); 616 appendChild(root, matrixKernelConditionsConverter(kernel.mConditions, d));
617 } 617 }
618 if (!(flags & SerializeFlags::NO_KERNEL_CONFIGS)) { 618 if (flags.isKernelConfigsEnabled()) {
619 appendChildren(root, kernelConfigConverter, kernel.mConfigs, d); 619 appendChildren(root, kernelConfigConverter, kernel.mConfigs, d);
620 } 620 }
621 } 621 }
@@ -650,7 +650,7 @@ struct ManifestHalConverter : public XmlNodeConverter<ManifestHal> {
650 appendAttr(root, "override", hal.isOverride()); 650 appendAttr(root, "override", hal.isOverride());
651 } 651 }
652 652
653 if (!(flags & SerializeFlags::NO_FQNAME)) { 653 if (flags.isFqnameEnabled()) {
654 std::set<FqInstance> fqInstances; 654 std::set<FqInstance> fqInstances;
655 hal.forEachInstance([&fqInstances](const auto& manifestInstance) { 655 hal.forEachInstance([&fqInstances](const auto& manifestInstance) {
656 fqInstances.emplace(manifestInstance.getFqInstanceNoPackage()); 656 fqInstances.emplace(manifestInstance.getFqInstanceNoPackage());
@@ -868,18 +868,18 @@ struct HalManifestConverter : public XmlNodeConverter<HalManifest> {
868 appendAttr(root, "version", m.getMetaVersion()); 868 appendAttr(root, "version", m.getMetaVersion());
869 appendAttr(root, "type", m.mType); 869 appendAttr(root, "type", m.mType);
870 870
871 if (!(flags & SerializeFlags::NO_HALS)) { 871 if (flags.isHalsEnabled()) {
872 appendChildren(root, manifestHalConverter, m.getHals(), d, flags); 872 appendChildren(root, manifestHalConverter, m.getHals(), d, flags);
873 } 873 }
874 if (m.mType == SchemaType::DEVICE) { 874 if (m.mType == SchemaType::DEVICE) {
875 if (!(flags & SerializeFlags::NO_SEPOLICY)) { 875 if (flags.isSepolicyEnabled()) {
876 appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d)); 876 appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d));
877 } 877 }
878 if (m.mLevel != Level::UNSPECIFIED) { 878 if (m.mLevel != Level::UNSPECIFIED) {
879 this->appendAttr(root, "target-level", m.mLevel); 879 this->appendAttr(root, "target-level", m.mLevel);
880 } 880 }
881 } else if (m.mType == SchemaType::FRAMEWORK) { 881 } else if (m.mType == SchemaType::FRAMEWORK) {
882 if (!(flags & SerializeFlags::NO_VNDK)) { 882 if (flags.isVndkEnabled()) {
883#pragma clang diagnostic push 883#pragma clang diagnostic push
884#pragma clang diagnostic ignored "-Wdeprecated-declarations" 884#pragma clang diagnostic ignored "-Wdeprecated-declarations"
885 appendChildren(root, vndkConverter, m.framework.mVndks, d); 885 appendChildren(root, vndkConverter, m.framework.mVndks, d);
@@ -887,14 +887,14 @@ struct HalManifestConverter : public XmlNodeConverter<HalManifest> {
887 887
888 appendChildren(root, vendorNdkConverter, m.framework.mVendorNdks, d); 888 appendChildren(root, vendorNdkConverter, m.framework.mVendorNdks, d);
889 } 889 }
890 if (!(flags & SerializeFlags::NO_SSDK)) { 890 if (flags.isSsdkEnabled()) {
891 if (!m.framework.mSystemSdk.empty()) { 891 if (!m.framework.mSystemSdk.empty()) {
892 appendChild(root, systemSdkConverter(m.framework.mSystemSdk, d)); 892 appendChild(root, systemSdkConverter(m.framework.mSystemSdk, d));
893 } 893 }
894 } 894 }
895 } 895 }
896 896
897 if (!(flags & SerializeFlags::NO_XMLFILES)) { 897 if (flags.isXmlFilesEnabled()) {
898 appendChildren(root, manifestXmlFileConverter, m.getXmlFiles(), d); 898 appendChildren(root, manifestXmlFileConverter, m.getXmlFiles(), d);
899 } 899 }
900 } 900 }
@@ -1029,19 +1029,19 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
1029 appendAttr(root, "version", m.getMinimumMetaVersion()); 1029 appendAttr(root, "version", m.getMinimumMetaVersion());
1030 appendAttr(root, "type", m.mType); 1030 appendAttr(root, "type", m.mType);
1031 1031
1032 if (!(flags & SerializeFlags::NO_HALS)) { 1032 if (flags.isHalsEnabled()) {
1033 appendChildren(root, matrixHalConverter, iterateValues(m.mHals), d); 1033 appendChildren(root, matrixHalConverter, iterateValues(m.mHals), d);
1034 } 1034 }
1035 if (m.mType == SchemaType::FRAMEWORK) { 1035 if (m.mType == SchemaType::FRAMEWORK) {
1036 if (!(flags & SerializeFlags::NO_KERNEL)) { 1036 if (flags.isKernelEnabled()) {
1037 appendChildren(root, matrixKernelConverter, m.framework.mKernels, d, flags); 1037 appendChildren(root, matrixKernelConverter, m.framework.mKernels, d, flags);
1038 } 1038 }
1039 if (!(flags & SerializeFlags::NO_SEPOLICY)) { 1039 if (flags.isSepolicyEnabled()) {
1040 if (!(m.framework.mSepolicy == Sepolicy{})) { 1040 if (!(m.framework.mSepolicy == Sepolicy{})) {
1041 appendChild(root, sepolicyConverter(m.framework.mSepolicy, d)); 1041 appendChild(root, sepolicyConverter(m.framework.mSepolicy, d));
1042 } 1042 }
1043 } 1043 }
1044 if (!(flags & SerializeFlags::NO_AVB)) { 1044 if (flags.isAvbEnabled()) {
1045 if (!(m.framework.mAvbMetaVersion == Version{})) { 1045 if (!(m.framework.mAvbMetaVersion == Version{})) {
1046 appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d)); 1046 appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d));
1047 } 1047 }
@@ -1050,7 +1050,7 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
1050 this->appendAttr(root, "level", m.mLevel); 1050 this->appendAttr(root, "level", m.mLevel);
1051 } 1051 }
1052 } else if (m.mType == SchemaType::DEVICE) { 1052 } else if (m.mType == SchemaType::DEVICE) {
1053 if (!(flags & SerializeFlags::NO_VNDK)) { 1053 if (flags.isVndkEnabled()) {
1054#pragma clang diagnostic push 1054#pragma clang diagnostic push
1055#pragma clang diagnostic ignored "-Wdeprecated-declarations" 1055#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1056 if (!(m.device.mVndk == Vndk{})) { 1056 if (!(m.device.mVndk == Vndk{})) {
@@ -1063,14 +1063,14 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
1063 } 1063 }
1064 } 1064 }
1065 1065
1066 if (!(flags & SerializeFlags::NO_SSDK)) { 1066 if (flags.isSsdkEnabled()) {
1067 if (!m.device.mSystemSdk.empty()) { 1067 if (!m.device.mSystemSdk.empty()) {
1068 appendChild(root, systemSdkConverter(m.device.mSystemSdk, d)); 1068 appendChild(root, systemSdkConverter(m.device.mSystemSdk, d));
1069 } 1069 }
1070 } 1070 }
1071 } 1071 }
1072 1072
1073 if (!(flags & SerializeFlags::NO_XMLFILES)) { 1073 if (flags.isXmlFilesEnabled()) {
1074 appendChildren(root, matrixXmlFileConverter, m.getXmlFiles(), d); 1074 appendChildren(root, matrixXmlFileConverter, m.getXmlFiles(), d);
1075 } 1075 }
1076 } 1076 }