summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-05-17 20:36:08 -0500
committerYifan Hong2017-05-19 15:59:22 -0500
commit9cd9eb0f06e77347beaf141c011fb1989af82475 (patch)
tree96b36eb988d83897d6ce1d189760469a8cafcd19 /parse_xml.cpp
parent476b63fcdca477971fb33da225efcb4cdc6104b1 (diff)
downloadplatform-system-libvintf-9cd9eb0f06e77347beaf141c011fb1989af82475.tar.gz
platform-system-libvintf-9cd9eb0f06e77347beaf141c011fb1989af82475.tar.xz
platform-system-libvintf-9cd9eb0f06e77347beaf141c011fb1989af82475.zip
Add HalInterface to compatibility matrix
Test: libvintf_test Test: vintf_object_test Bug: 38395193 Change-Id: I6dfc21bbfb63b575558405e441f3926ff3813eb8 Merged-In: I6dfc21bbfb63b575558405e441f3926ff3813eb8
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 7287604..8caab4f 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -470,14 +470,25 @@ struct MatrixHalConverter : public XmlNodeConverter<MatrixHal> {
470 appendAttr(root, "optional", hal.optional); 470 appendAttr(root, "optional", hal.optional);
471 appendTextElement(root, "name", hal.name, d); 471 appendTextElement(root, "name", hal.name, d);
472 appendChildren(root, versionRangeConverter, hal.versionRanges, d); 472 appendChildren(root, versionRangeConverter, hal.versionRanges, d);
473 appendChildren(root, halInterfaceConverter, iterateValues(hal.interfaces), d);
473 } 474 }
474 bool buildObject(MatrixHal *object, NodeType *root) const override { 475 bool buildObject(MatrixHal *object, NodeType *root) const override {
476 std::vector<HalInterface> interfaces;
475 if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format) || 477 if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format) ||
476 !parseOptionalAttr(root, "optional", false /* defaultValue */, &object->optional) || 478 !parseOptionalAttr(root, "optional", false /* defaultValue */, &object->optional) ||
477 !parseTextElement(root, "name", &object->name) || 479 !parseTextElement(root, "name", &object->name) ||
478 !parseChildren(root, versionRangeConverter, &object->versionRanges)) { 480 !parseChildren(root, versionRangeConverter, &object->versionRanges) ||
481 !parseChildren(root, halInterfaceConverter, &interfaces)) {
479 return false; 482 return false;
480 } 483 }
484 for (auto&& interface : interfaces) {
485 std::string name{interface.name};
486 auto res = object->interfaces.emplace(std::move(name), std::move(interface));
487 if (!res.second) {
488 this->mLastError = "Duplicated instance entry " + res.first->first;
489 return false;
490 }
491 }
481 return true; 492 return true;
482 } 493 }
483}; 494};