summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-05-17 20:15:01 -0500
committerYifan Hong2017-05-19 15:59:14 -0500
commit476b63fcdca477971fb33da225efcb4cdc6104b1 (patch)
tree1eef114ad49e7b15f6f321a1581b894d0a27c2c6 /parse_xml.cpp
parentcc519864dbd810eb7267e07c744ea4220e8db48e (diff)
downloadplatform-system-libvintf-476b63fcdca477971fb33da225efcb4cdc6104b1.tar.gz
platform-system-libvintf-476b63fcdca477971fb33da225efcb4cdc6104b1.tar.xz
platform-system-libvintf-476b63fcdca477971fb33da225efcb4cdc6104b1.zip
Renamed ManifestHalInterface to HalInterface
because it is used by compatibility matrix as well. Bug: 38395193 Test: compiles Change-Id: I186fdf4e7fd7076f2ac9d7e95eda5ba7510f9dad Merged-In: I186fdf4e7fd7076f2ac9d7e95eda5ba7510f9dad
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 9f144f4..7287604 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -439,6 +439,30 @@ struct KernelConfigConverter : public XmlNodeConverter<KernelConfig> {
439 439
440const KernelConfigConverter kernelConfigConverter{}; 440const KernelConfigConverter kernelConfigConverter{};
441 441
442struct HalInterfaceConverter : public XmlNodeConverter<HalInterface> {
443 std::string elementName() const override { return "interface"; }
444 void mutateNode(const HalInterface &intf, NodeType *root, DocType *d) const override {
445 appendTextElement(root, "name", intf.name, d);
446 appendTextElements(root, "instance", intf.instances, d);
447 }
448 bool buildObject(HalInterface *intf, NodeType *root) const override {
449 std::vector<std::string> instances;
450 if (!parseTextElement(root, "name", &intf->name) ||
451 !parseTextElements(root, "instance", &instances)) {
452 return false;
453 }
454 intf->instances.clear();
455 intf->instances.insert(instances.begin(), instances.end());
456 if (intf->instances.size() != instances.size()) {
457 this->mLastError = "Duplicated instances in " + intf->name;
458 return false;
459 }
460 return true;
461 }
462};
463
464const HalInterfaceConverter halInterfaceConverter{};
465
442struct MatrixHalConverter : public XmlNodeConverter<MatrixHal> { 466struct MatrixHalConverter : public XmlNodeConverter<MatrixHal> {
443 std::string elementName() const override { return "hal"; } 467 std::string elementName() const override { return "hal"; }
444 void mutateNode(const MatrixHal &hal, NodeType *root, DocType *d) const override { 468 void mutateNode(const MatrixHal &hal, NodeType *root, DocType *d) const override {
@@ -477,30 +501,6 @@ struct MatrixKernelConverter : public XmlNodeConverter<MatrixKernel> {
477 501
478const MatrixKernelConverter matrixKernelConverter{}; 502const MatrixKernelConverter matrixKernelConverter{};
479 503
480struct ManfiestHalInterfaceConverter : public XmlNodeConverter<ManifestHalInterface> {
481 std::string elementName() const override { return "interface"; }
482 void mutateNode(const ManifestHalInterface &intf, NodeType *root, DocType *d) const override {
483 appendTextElement(root, "name", intf.name, d);
484 appendTextElements(root, "instance", intf.instances, d);
485 }
486 bool buildObject(ManifestHalInterface *intf, NodeType *root) const override {
487 std::vector<std::string> instances;
488 if (!parseTextElement(root, "name", &intf->name) ||
489 !parseTextElements(root, "instance", &instances)) {
490 return false;
491 }
492 intf->instances.clear();
493 intf->instances.insert(instances.begin(), instances.end());
494 if (intf->instances.size() != instances.size()) {
495 this->mLastError = "Duplicated instances in " + intf->name;
496 return false;
497 }
498 return true;
499 }
500};
501
502const ManfiestHalInterfaceConverter manfiestHalInterfaceConverter{};
503
504struct ManifestHalConverter : public XmlNodeConverter<ManifestHal> { 504struct ManifestHalConverter : public XmlNodeConverter<ManifestHal> {
505 std::string elementName() const override { return "hal"; } 505 std::string elementName() const override { return "hal"; }
506 void mutateNode(const ManifestHal &hal, NodeType *root, DocType *d) const override { 506 void mutateNode(const ManifestHal &hal, NodeType *root, DocType *d) const override {
@@ -510,15 +510,15 @@ struct ManifestHalConverter : public XmlNodeConverter<ManifestHal> {
510 appendChild(root, transportArchConverter(hal.transportArch, d)); 510 appendChild(root, transportArchConverter(hal.transportArch, d));
511 } 511 }
512 appendChildren(root, versionConverter, hal.versions, d); 512 appendChildren(root, versionConverter, hal.versions, d);
513 appendChildren(root, manfiestHalInterfaceConverter, iterateValues(hal.interfaces), d); 513 appendChildren(root, halInterfaceConverter, iterateValues(hal.interfaces), d);
514 } 514 }
515 bool buildObject(ManifestHal *object, NodeType *root) const override { 515 bool buildObject(ManifestHal *object, NodeType *root) const override {
516 std::vector<ManifestHalInterface> interfaces; 516 std::vector<HalInterface> interfaces;
517 if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format) || 517 if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format) ||
518 !parseTextElement(root, "name", &object->name) || 518 !parseTextElement(root, "name", &object->name) ||
519 !parseChild(root, transportArchConverter, &object->transportArch) || 519 !parseChild(root, transportArchConverter, &object->transportArch) ||
520 !parseChildren(root, versionConverter, &object->versions) || 520 !parseChildren(root, versionConverter, &object->versions) ||
521 !parseChildren(root, manfiestHalInterfaceConverter, &interfaces)) { 521 !parseChildren(root, halInterfaceConverter, &interfaces)) {
522 return false; 522 return false;
523 } 523 }
524 object->interfaces.clear(); 524 object->interfaces.clear();