vintf: Clean up private member fields for CompatibilityMatrix.
Test: mma
Test: libvintf_test
Bug: 34620633
Change-Id: Id606442e087b6a0c00e6ecf712754d9e520b3e17
diff --git a/CompatibilityMatrix.cpp b/CompatibilityMatrix.cpp
index c089425..4e6bff5 100644
--- a/CompatibilityMatrix.cpp
+++ b/CompatibilityMatrix.cpp
@@ -22,25 +22,25 @@
constexpr Version CompatibilityMatrix::kVersion;
bool CompatibilityMatrix::add(MatrixHal &&hal) {
- return hals.emplace(hal.name, std::move(hal)).second;
+ return mHals.emplace(hal.name, std::move(hal)).second;
}
bool CompatibilityMatrix::add(MatrixKernel &&kernel) {
- kernels.push_back(std::move(kernel));
+ mKernels.push_back(std::move(kernel));
return true;
}
void CompatibilityMatrix::clear() {
- hals.clear();
- kernels.clear();
+ mHals.clear();
+ mKernels.clear();
}
ConstMapValueIterable<std::string, MatrixHal> CompatibilityMatrix::getHals() const {
- return ConstMapValueIterable<std::string, MatrixHal>(hals);
+ return ConstMapValueIterable<std::string, MatrixHal>(mHals);
}
const MatrixKernel *CompatibilityMatrix::findKernel(const KernelVersion &v) const {
- for (const MatrixKernel &matrixKernel : kernels) {
+ for (const MatrixKernel &matrixKernel : mKernels) {
if (matrixKernel.minLts().version == v.version &&
matrixKernel.minLts().majorRev == v.majorRev) {
return matrixKernel.minLts().minorRev <= v.minorRev ? &matrixKernel : nullptr;
@@ -50,7 +50,7 @@
}
const Sepolicy &CompatibilityMatrix::getSepolicy() const {
- return sepolicy;
+ return mSepolicy;
}
} // namespace vintf
diff --git a/include/vintf/CompatibilityMatrix.h b/include/vintf/CompatibilityMatrix.h
index ad0e9d8..51d21c6 100644
--- a/include/vintf/CompatibilityMatrix.h
+++ b/include/vintf/CompatibilityMatrix.h
@@ -50,11 +50,11 @@
friend struct LibVintfTest;
// sorted map from component name to the entry.
- std::map<std::string, MatrixHal> hals;
+ std::map<std::string, MatrixHal> mHals;
- std::vector<MatrixKernel> kernels;
+ std::vector<MatrixKernel> mKernels;
- Sepolicy sepolicy;
+ Sepolicy mSepolicy;
};
} // namespace vintf
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 8816539..bacae6c 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -480,19 +480,19 @@
std::string elementName() const override { return "compatibility-matrix"; }
void mutateNode(const CompatibilityMatrix &m, NodeType *root, DocType *d) const override {
appendAttr(root, "version", CompatibilityMatrix::kVersion);
- for (const auto &pair : m.hals) {
+ for (const auto &pair : m.mHals) {
appendChild(root, matrixHalConverter(pair.second, d));
}
- for (const auto &kernel : m.kernels) {
+ for (const auto &kernel : m.mKernels) {
appendChild(root, matrixKernelConverter(kernel, d));
}
- appendChild(root, sepolicyConverter(m.sepolicy, d));
+ appendChild(root, sepolicyConverter(m.mSepolicy, d));
}
bool buildObject(CompatibilityMatrix *object, NodeType *root) const override {
std::vector<MatrixHal> hals;
if (!parseChildren(root, matrixHalConverter, &hals) ||
- !parseChildren(root, matrixKernelConverter, &object->kernels) ||
- !parseChild(root, sepolicyConverter, &object->sepolicy)) {
+ !parseChildren(root, matrixKernelConverter, &object->mKernels) ||
+ !parseChild(root, sepolicyConverter, &object->mSepolicy)) {
return false;
}
for (auto &&hal : hals) {
diff --git a/test/main.cpp b/test/main.cpp
index 3aa2e14..a33ec82 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -45,7 +45,7 @@
return vm.add(std::move(hal));
}
void set(CompatibilityMatrix &cm, Sepolicy &&sepolicy) {
- cm.sepolicy = sepolicy;
+ cm.mSepolicy = sepolicy;
}
const ManifestHal *getHal(VendorManifest &vm, const std::string &name) {
return vm.getHal(name);
@@ -54,7 +54,7 @@
return vm.getHals();
}
bool isEqual(const CompatibilityMatrix &cm1, const CompatibilityMatrix &cm2) {
- return cm1.hals == cm2.hals && cm1.kernels == cm2.kernels;
+ return cm1.mHals == cm2.mHals && cm1.mKernels == cm2.mKernels;
}
bool isValid(const ManifestHal &mh) {
return mh.isValid();