Lines Matching refs:root

87 inline std::string nameOf(NodeType *root) {  in nameOf()  argument
88 return root->Name() == NULL ? "" : root->Name(); in nameOf()
91 inline std::string getText(NodeType *root) { in getText() argument
92 return root->GetText() == NULL ? "" : root->GetText(); in getText()
113 inline bool getAttr(NodeType *root, const std::string &attrName, std::string *s) { in getAttr() argument
114 const char *c = root->Attribute(attrName.c_str()); in getAttr()
155 NodeType *root = createNode(this->elementName(), d); in serialize() local
156 this->mutateNode(o, root, d, flags); in serialize()
157 return root; in serialize()
166 inline bool deserialize(Object* object, NodeType* root) { in deserialize()
167 bool ret = deserialize(object, root, &mLastError); in deserialize()
174 inline bool deserialize(Object* object, NodeType* root, std::string* error) const { in deserialize()
175 if (nameOf(root) != this->elementName()) { in deserialize()
178 return this->buildObject(object, root, error); in deserialize()
248 inline bool parseOptionalAttr(NodeType* root, const std::string& attrName, T&& defaultValue, in parseOptionalAttr()
251 bool success = getAttr(root, attrName, &attrText) && in parseOptionalAttr()
260 inline bool parseAttr(NodeType* root, const std::string& attrName, T* attr, in parseAttr()
263 bool ret = getAttr(root, attrName, &attrText) && ::android::vintf::parse(attrText, attr); in parseAttr()
271 inline bool parseAttr(NodeType* root, const std::string& attrName, std::string* attr, in parseAttr()
273 bool ret = getAttr(root, attrName, attr); in parseAttr()
281 inline bool parseTextElement(NodeType* root, const std::string& elementName, std::string* s, in parseTextElement()
283 NodeType *child = getChild(root, elementName); in parseTextElement()
293 inline bool parseOptionalTextElement(NodeType* root, const std::string& elementName, in parseOptionalTextElement()
296 NodeType* child = getChild(root, elementName); in parseOptionalTextElement()
301 inline bool parseTextElements(NodeType* root, const std::string& elementName, in parseTextElements()
303 auto nodes = getChildren(root, elementName); in parseTextElements()
312 inline bool parseChild(NodeType* root, const XmlNodeConverter<T>& conv, T* t, in parseChild()
314 NodeType *child = getChild(root, conv.elementName()); in parseChild()
324 inline bool parseOptionalChild(NodeType* root, const XmlNodeConverter<T>& conv, in parseOptionalChild()
326 NodeType *child = getChild(root, conv.elementName()); in parseOptionalChild()
335 inline bool parseOptionalChild(NodeType* root, const XmlNodeConverter<T>& conv, in parseOptionalChild()
337 NodeType* child = getChild(root, conv.elementName()); in parseOptionalChild()
347 inline bool parseChildren(NodeType* root, const XmlNodeConverter<T>& conv, std::vector<T>* v, in parseChildren()
349 auto nodes = getChildren(root, conv.elementName()); in parseChildren()
363 inline bool parseChildren(NodeType* root, const XmlNodeConverter<T>& conv, Container* s, in parseChildren()
366 if (!parseChildren(root, conv, &vec, error)) { in parseChildren()
381 inline bool parseChildren(NodeType* root, const XmlNodeConverter<std::pair<K, V>>& conv, in parseChildren()
383 return parseChildren<std::map<K, V>, std::pair<K, V>>(root, conv, s, error); in parseChildren()
410 virtual void mutateNode(const Object &object, NodeType *root, DocType *d) const override { in mutateNode()
411 appendText(root, ::android::vintf::to_string(object), d); in mutateNode()
413 virtual bool buildObject(Object* object, NodeType* root, std::string* error) const override { in buildObject()
414 return this->parseText(root, object, error); in buildObject()
432 virtual void mutateNode(const Pair& pair, NodeType* root, DocType* d) const override { in mutateNode()
433 appendChild(root, mFirstConverter->serialize(pair.first, d)); in mutateNode()
434 appendChild(root, mSecondConverter->serialize(pair.second, d)); in mutateNode()
436 virtual bool buildObject(Pair* pair, NodeType* root, std::string* error) const override { in buildObject()
437 return this->parseChild(root, *mFirstConverter, &pair->first, error) && in buildObject()
438 this->parseChild(root, *mSecondConverter, &pair->second, error); in buildObject()
456 void mutateNode(const TransportArch &object, NodeType *root, DocType *d) const override { in mutateNode()
458 appendAttr(root, "arch", object.arch); in mutateNode()
460 appendText(root, ::android::vintf::to_string(object.transport), d); in mutateNode()
462 bool buildObject(TransportArch* object, NodeType* root, std::string* error) const override { in buildObject()
463 if (!parseOptionalAttr(root, "arch", Arch::ARCH_EMPTY, &object->arch, error) || in buildObject()
464 !parseText(root, &object->transport, error)) { in buildObject()
478 … void mutateNode(const KernelConfigTypedValue &object, NodeType *root, DocType *d) const override { in mutateNode()
479 appendAttr(root, "type", object.mType); in mutateNode()
480 appendText(root, ::android::vintf::to_string(object), d); in mutateNode()
482 bool buildObject(KernelConfigTypedValue* object, NodeType* root, in buildObject()
485 if (!parseAttr(root, "type", &object->mType, error) || in buildObject()
486 !parseText(root, &stringValue, error)) { in buildObject()
505 void mutateNode(const HalInterface &intf, NodeType *root, DocType *d) const override { in mutateNode()
506 appendTextElement(root, "name", intf.name(), d); in mutateNode()
507 appendTextElements(root, "instance", intf.mInstances, d); in mutateNode()
508 appendTextElements(root, "regex-instance", intf.mRegexes, d); in mutateNode()
510 bool buildObject(HalInterface* intf, NodeType* root, std::string* error) const override { in buildObject()
513 if (!parseTextElement(root, "name", &intf->mName, error) || in buildObject()
514 !parseTextElements(root, "instance", &instances, error) || in buildObject()
515 !parseTextElements(root, "regex-instance", &regexes, error)) { in buildObject()
547 void mutateNode(const MatrixHal &hal, NodeType *root, DocType *d) const override { in mutateNode()
548 appendAttr(root, "format", hal.format); in mutateNode()
549 appendAttr(root, "optional", hal.optional); in mutateNode()
550 appendTextElement(root, "name", hal.name, d); in mutateNode()
553 appendChildren(root, versionRangeConverter, hal.versionRanges, d); in mutateNode()
555 appendChildren(root, halInterfaceConverter, iterateValues(hal.interfaces), d); in mutateNode()
557 bool buildObject(MatrixHal* object, NodeType* root, std::string* error) const override { in buildObject()
559 if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format, error) || in buildObject()
560 !parseOptionalAttr(root, "optional", false /* defaultValue */, &object->optional, in buildObject()
562 !parseTextElement(root, "name", &object->name, error) || in buildObject()
563 !parseChildren(root, versionRangeConverter, &object->versionRanges, error) || in buildObject()
564 !parseChildren(root, halInterfaceConverter, &interfaces, error)) { in buildObject()
631 void mutateNode(const std::vector<KernelConfig>& conds, NodeType* root, in mutateNode()
633 appendChildren(root, matrixKernelConfigConverter, conds, d); in mutateNode()
635 bool buildObject(std::vector<KernelConfig>* object, NodeType* root, in buildObject()
637 return parseChildren(root, matrixKernelConfigConverter, object, error); in buildObject()
645 void mutateNode(const MatrixKernel& kernel, NodeType* root, DocType* d) const override { in mutateNode()
646 mutateNode(kernel, root, d, SerializeFlags::EVERYTHING); in mutateNode()
648 void mutateNode(const MatrixKernel& kernel, NodeType* root, DocType* d, in mutateNode()
654 appendAttr(root, "version", kv); in mutateNode()
657 appendAttr(root, "level", kernel.getSourceMatrixLevel()); in mutateNode()
661 appendChild(root, matrixKernelConditionsConverter(kernel.mConditions, d)); in mutateNode()
664 appendChildren(root, matrixKernelConfigConverter, kernel.mConfigs, d); in mutateNode()
667 bool buildObject(MatrixKernel* object, NodeType* root, std::string* error) const override { in buildObject()
669 if (!parseAttr(root, "version", &object->mMinLts, error) || in buildObject()
670 !parseOptionalAttr(root, "level", Level::UNSPECIFIED, &sourceMatrixLevel, error) || in buildObject()
671 !parseOptionalChild(root, matrixKernelConditionsConverter, {}, &object->mConditions, in buildObject()
673 !parseChildren(root, matrixKernelConfigConverter, &object->mConfigs, error)) { in buildObject()
687 void mutateNode(const ManifestHal& m, NodeType* root, DocType* d) const override { in mutateNode()
688 mutateNode(m, root, d, SerializeFlags::EVERYTHING); in mutateNode()
690 void mutateNode(const ManifestHal& hal, NodeType* root, DocType* d, in mutateNode()
692 appendAttr(root, "format", hal.format); in mutateNode()
693 appendTextElement(root, "name", hal.name, d); in mutateNode()
695 appendChild(root, transportArchConverter(hal.transportArch, d)); in mutateNode()
699 appendChildren(root, versionConverter, hal.versions, d); in mutateNode()
701 appendChildren(root, halInterfaceConverter, iterateValues(hal.interfaces), d); in mutateNode()
703 appendAttr(root, "override", hal.isOverride()); in mutateNode()
712 appendTextElements(root, fqInstanceConverter.elementName(), simpleFqInstances, d); in mutateNode()
715 bool buildObject(ManifestHal* object, NodeType* root, std::string* error) const override { in buildObject()
717 if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format, error) || in buildObject()
718 !parseOptionalAttr(root, "override", false, &object->mIsOverride, error) || in buildObject()
719 !parseTextElement(root, "name", &object->name, error) || in buildObject()
720 !parseOptionalChild(root, transportArchConverter, {}, &object->transportArch, error) || in buildObject()
721 !parseChildren(root, versionConverter, &object->versions, error) || in buildObject()
722 !parseChildren(root, halInterfaceConverter, &interfaces, error)) { in buildObject()
784 if (!parseChildren(root, fqInstanceConverter, &fqInstances, error)) { in buildObject()
842 void mutateNode(const Sepolicy &object, NodeType *root, DocType *d) const override { in mutateNode()
843 appendChild(root, kernelSepolicyVersionConverter(object.kernelSepolicyVersion(), d)); in mutateNode()
844 appendChildren(root, sepolicyVersionConverter, object.sepolicyVersions(), d); in mutateNode()
846 bool buildObject(Sepolicy* object, NodeType* root, std::string* error) const override { in buildObject()
847 if (!parseChild(root, kernelSepolicyVersionConverter, &object->mKernelSepolicyVersion, in buildObject()
849 !parseChildren(root, sepolicyVersionConverter, &object->mSepolicyVersionRanges, in buildObject()
865 void mutateNode(const Vndk &object, NodeType *root, DocType *d) const override { in mutateNode()
866 appendChild(root, vndkVersionRangeConverter(object.mVersionRange, d)); in mutateNode()
867 appendChildren(root, vndkLibraryConverter, object.mLibraries, d); in mutateNode()
869 bool buildObject(Vndk* object, NodeType* root, std::string* error) const override { in buildObject()
870 if (!parseChild(root, vndkVersionRangeConverter, &object->mVersionRange, error) || in buildObject()
871 !parseChildren(root, vndkLibraryConverter, &object->mLibraries, error)) { in buildObject()
882 void mutateNode(const VendorNdk& object, NodeType* root, DocType* d) const override { in mutateNode()
883 appendChild(root, vndkVersionConverter(object.mVersion, d)); in mutateNode()
884 appendChildren(root, vndkLibraryConverter, object.mLibraries, d); in mutateNode()
886 bool buildObject(VendorNdk* object, NodeType* root, std::string* error) const override { in buildObject()
887 if (!parseChild(root, vndkVersionConverter, &object->mVersion, error) || in buildObject()
888 !parseChildren(root, vndkLibraryConverter, &object->mLibraries, error)) { in buildObject()
901 void mutateNode(const SystemSdk& object, NodeType* root, DocType* d) const override { in mutateNode()
902 appendChildren(root, systemSdkVersionConverter, object.versions(), d); in mutateNode()
904 bool buildObject(SystemSdk* object, NodeType* root, std::string* error) const override { in buildObject()
905 return parseChildren(root, systemSdkVersionConverter, &object->mVersions, error); in buildObject()
913 void mutateNode(const Version &m, NodeType *root, DocType *d) const override { in mutateNode()
914 appendChild(root, versionConverter(m, d)); in mutateNode()
916 bool buildObject(Version* object, NodeType* root, std::string* error) const override { in buildObject()
917 return parseChild(root, versionConverter, object, error); in buildObject()
924 void mutateNode(const ManifestXmlFile& f, NodeType* root, DocType* d) const override { in mutateNode()
925 appendTextElement(root, "name", f.name(), d); in mutateNode()
926 appendChild(root, versionConverter(f.version(), d)); in mutateNode()
928 appendTextElement(root, "path", f.overriddenPath(), d); in mutateNode()
931 bool buildObject(ManifestXmlFile* object, NodeType* root, std::string* error) const override { in buildObject()
932 if (!parseTextElement(root, "name", &object->mName, error) || in buildObject()
933 !parseChild(root, versionConverter, &object->mVersion, error) || in buildObject()
934 !parseOptionalTextElement(root, "path", {}, &object->mOverriddenPath, error)) { in buildObject()
948 void mutateNode(const KernelInfo& o, NodeType* root, DocType* d) const override { in mutateNode()
949 mutateNode(o, root, d, SerializeFlags::EVERYTHING); in mutateNode()
951 void mutateNode(const KernelInfo& o, NodeType* root, DocType* d, in mutateNode()
954 appendAttr(root, "version", o.version()); in mutateNode()
957 appendAttr(root, "target-level", o.level()); in mutateNode()
960 appendChildren(root, kernelConfigConverter, o.configs(), d); in mutateNode()
963 bool buildObject(KernelInfo* o, NodeType* root, std::string* error) const override { in buildObject()
964 return parseOptionalAttr(root, "version", {}, &o->mVersion, error) && in buildObject()
965 parseOptionalAttr(root, "target-level", Level::UNSPECIFIED, &o->mLevel, error) && in buildObject()
966 parseChildren(root, kernelConfigConverter, &o->mConfigs, error); in buildObject()
974 void mutateNode(const HalManifest &m, NodeType *root, DocType *d) const override { in mutateNode()
975 mutateNode(m, root, d, SerializeFlags::EVERYTHING); in mutateNode()
977 void mutateNode(const HalManifest& m, NodeType* root, DocType* d, in mutateNode()
980 appendAttr(root, "version", m.getMetaVersion()); in mutateNode()
983 appendAttr(root, "type", m.mType); in mutateNode()
987 appendChildren(root, manifestHalConverter, m.getHals(), d, flags); in mutateNode()
992 appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d)); in mutateNode()
996 this->appendAttr(root, "target-level", m.mLevel); in mutateNode()
1001 appendChild(root, kernelInfoConverter.serialize(*m.kernel(), d, flags)); in mutateNode()
1008 appendChildren(root, vndkConverter, m.framework.mVndks, d); in mutateNode()
1011 appendChildren(root, vendorNdkConverter, m.framework.mVendorNdks, d); in mutateNode()
1015 appendChild(root, systemSdkConverter(m.framework.mSystemSdk, d)); in mutateNode()
1021 appendChildren(root, manifestXmlFileConverter, m.getXmlFiles(), d); in mutateNode()
1024 bool buildObject(HalManifest* object, NodeType* root, std::string* error) const override { in buildObject()
1026 if (!parseAttr(root, "version", &metaVersion, error)) return false; in buildObject()
1033 if (!parseAttr(root, "type", &object->mType, error)) { in buildObject()
1038 if (!parseChildren(root, manifestHalConverter, &hals, error)) { in buildObject()
1049 if (!parseOptionalChild(root, halManifestSepolicyConverter, {}, in buildObject()
1054 if (!parseOptionalAttr(root, "target-level", Level::UNSPECIFIED, &object->mLevel, in buildObject()
1059 if (!parseOptionalChild(root, kernelInfoConverter, &object->device.mKernel, error)) { in buildObject()
1065 if (!parseChildren(root, vndkConverter, &object->framework.mVndks, error)) { in buildObject()
1077 if (!parseChildren(root, vendorNdkConverter, &object->framework.mVendorNdks, error)) { in buildObject()
1090 if (!parseOptionalChild(root, systemSdkConverter, {}, &object->framework.mSystemSdk, in buildObject()
1104 if (!parseChildren(root, manifestXmlFileConverter, &xmlFiles, error)) { in buildObject()
1125 void mutateNode(const Version &m, NodeType *root, DocType *d) const override { in mutateNode()
1126 appendChild(root, avbVersionConverter(m, d)); in mutateNode()
1128 bool buildObject(Version* object, NodeType* root, std::string* error) const override { in buildObject()
1129 return parseChild(root, avbVersionConverter, object, error); in buildObject()
1136 void mutateNode(const MatrixXmlFile& f, NodeType* root, DocType* d) const override { in mutateNode()
1137 appendTextElement(root, "name", f.name(), d); in mutateNode()
1138 appendAttr(root, "format", f.format()); in mutateNode()
1139 appendAttr(root, "optional", f.optional()); in mutateNode()
1140 appendChild(root, versionRangeConverter(f.versionRange(), d)); in mutateNode()
1142 appendTextElement(root, "path", f.overriddenPath(), d); in mutateNode()
1145 bool buildObject(MatrixXmlFile* object, NodeType* root, std::string* error) const override { in buildObject()
1146 if (!parseTextElement(root, "name", &object->mName, error) || in buildObject()
1147 !parseAttr(root, "format", &object->mFormat, error) || in buildObject()
1148 !parseOptionalAttr(root, "optional", false, &object->mOptional, error) || in buildObject()
1149 !parseChild(root, versionRangeConverter, &object->mVersionRange, error) || in buildObject()
1150 !parseOptionalTextElement(root, "path", {}, &object->mOverriddenPath, error)) { in buildObject()
1160 void mutateNode(const CompatibilityMatrix &m, NodeType *root, DocType *d) const override { in mutateNode()
1161 mutateNode(m, root, d, SerializeFlags::EVERYTHING); in mutateNode()
1163 void mutateNode(const CompatibilityMatrix& m, NodeType* root, DocType* d, in mutateNode()
1166 appendAttr(root, "version", kMetaVersion); in mutateNode()
1169 appendAttr(root, "type", m.mType); in mutateNode()
1173 appendChildren(root, matrixHalConverter, iterateValues(m.mHals), d); in mutateNode()
1177 appendChildren(root, matrixKernelConverter, m.framework.mKernels, d, flags); in mutateNode()
1181 appendChild(root, sepolicyConverter(m.framework.mSepolicy, d)); in mutateNode()
1186 appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d)); in mutateNode()
1190 this->appendAttr(root, "level", m.mLevel); in mutateNode()
1197 appendChild(root, vndkConverter(m.device.mVndk, d)); in mutateNode()
1202 appendChild(root, vendorNdkConverter(m.device.mVendorNdk, d)); in mutateNode()
1208 appendChild(root, systemSdkConverter(m.device.mSystemSdk, d)); in mutateNode()
1214 appendChildren(root, matrixXmlFileConverter, m.getXmlFiles(), d); in mutateNode()
1217 bool buildObject(CompatibilityMatrix* object, NodeType* root, in buildObject()
1220 if (!parseAttr(root, "version", &metaVersion, error)) return false; in buildObject()
1228 if (!parseAttr(root, "type", &object->mType, error) || in buildObject()
1229 !parseChildren(root, matrixHalConverter, &hals, error)) { in buildObject()
1236 if (!parseChildren(root, matrixKernelConverter, &object->framework.mKernels, error) || in buildObject()
1237 !parseOptionalChild(root, sepolicyConverter, {}, &object->framework.mSepolicy, in buildObject()
1239 !parseOptionalChild(root, avbConverter, {}, &object->framework.mAvbMetaVersion, in buildObject()
1258 if (!parseOptionalAttr(root, "level", Level::UNSPECIFIED, &object->mLevel, error)) { in buildObject()
1267 if (!parseOptionalChild(root, vndkConverter, {}, &object->device.mVndk, error)) { in buildObject()
1272 if (!parseOptionalChild(root, vendorNdkConverter, {}, &object->device.mVendorNdk, in buildObject()
1277 if (!parseOptionalChild(root, systemSdkConverter, {}, &object->device.mSystemSdk, in buildObject()
1291 if (!parseChildren(root, matrixXmlFileConverter, &xmlFiles, error)) { in buildObject()