1 #define LOG_TAG "android.hardware.automotive.audiocontrol" 2 #include "android_hardware_automotive_audiocontrol.h" 3 4 #include <assert.h> 5 #ifndef __BIONIC__ 6 #define __assert2(f,n,fun,e) do { fprintf(stderr, "%s:%d: %s: Assertion `%s' failed", (f), (n), (fun), (e)); abort(); } while (false) 7 #endif 8 #define _xsdc_assert(e) do if (!(e)) __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e); while (false) 9 10 namespace android { 11 namespace hardware { 12 namespace automotive { 13 namespace audiocontrol { 14 template <class T> 15 constexpr void (*xmlDeleter)(T* t); 16 template <> 17 constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; 18 template <> __anon44c4da180102(xmlChar *s) 19 auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; 20 21 template <class T> make_xmlUnique(T * t)22 constexpr auto make_xmlUnique(T *t) { 23 auto deleter = [](T *t) { xmlDeleter<T>(t); }; 24 return std::unique_ptr<T, decltype(deleter)>{t, deleter}; 25 } 26 getXmlAttribute(const xmlNode * cur,const char * attribute)27 static std::string getXmlAttribute(const xmlNode *cur, const char *attribute) { 28 auto xmlValue = make_xmlUnique(xmlGetProp(cur, reinterpret_cast<const xmlChar*>(attribute))); 29 if (xmlValue == nullptr) { 30 return ""; 31 } 32 std::string value(reinterpret_cast<const char*>(xmlValue.get())); 33 return value; 34 } 35 read(const char * configFile)36 std::optional<CarAudioConfigurationType> read(const char* configFile) { 37 auto doc = make_xmlUnique(xmlParseFile(configFile)); 38 if (doc == nullptr) { 39 return std::nullopt; 40 } 41 xmlNodePtr _child = xmlDocGetRootElement(doc.get()); 42 if (_child == nullptr) { 43 return std::nullopt; 44 } 45 if (xmlXIncludeProcess(doc.get()) < 0) { 46 return std::nullopt; 47 } 48 49 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("carAudioConfiguration"))) { 50 CarAudioConfigurationType _value = CarAudioConfigurationType::read(_child); 51 return _value; 52 } 53 return std::nullopt; 54 } 55 parse(const char * xml)56 std::optional<CarAudioConfigurationType> parse(const char* xml) { 57 auto doc = make_xmlUnique(xmlParseDoc(reinterpret_cast<const xmlChar*>(xml))); 58 if (doc == nullptr) { 59 return std::nullopt; 60 } 61 xmlNodePtr _child = xmlDocGetRootElement(doc.get()); 62 if (_child == nullptr) { 63 return std::nullopt; 64 } 65 if (xmlXIncludeProcess(doc.get()) < 0) { 66 return std::nullopt; 67 } 68 69 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("carAudioConfiguration"))) { 70 CarAudioConfigurationType _value = CarAudioConfigurationType::read(_child); 71 return _value; 72 } 73 return std::nullopt; 74 } 75 76 CarAudioConfigurationType(std::vector<MirroringDevicesType> mirroringDevices,std::vector<DeviceConfigurationsType> deviceConfigurations,std::vector<OemContextsType> oemContexts,std::vector<ActivationVolumeConfigsType> activationVolumeConfigs,std::vector<ZonesType> zones,std::string version)77 CarAudioConfigurationType::CarAudioConfigurationType(std::vector<MirroringDevicesType> mirroringDevices, std::vector<DeviceConfigurationsType> deviceConfigurations, std::vector<OemContextsType> oemContexts, std::vector<ActivationVolumeConfigsType> activationVolumeConfigs, std::vector<ZonesType> zones, std::string version) : mirroringDevices_(std::move(mirroringDevices)), deviceConfigurations_(std::move(deviceConfigurations)), oemContexts_(std::move(oemContexts)), activationVolumeConfigs_(std::move(activationVolumeConfigs)), zones_(std::move(zones)), version_(std::move(version)) { 78 } 79 getMirroringDevices() const80 const std::vector<MirroringDevicesType>& CarAudioConfigurationType::getMirroringDevices() const { 81 return mirroringDevices_; 82 } 83 hasMirroringDevices() const84 bool CarAudioConfigurationType::hasMirroringDevices() const { 85 return !(mirroringDevices_.empty()); 86 } 87 getFirstMirroringDevices() const88 const MirroringDevicesType* CarAudioConfigurationType::getFirstMirroringDevices() const { 89 if (mirroringDevices_.empty()) { 90 return nullptr; 91 } 92 return &mirroringDevices_[0]; 93 } 94 getDeviceConfigurations() const95 const std::vector<DeviceConfigurationsType>& CarAudioConfigurationType::getDeviceConfigurations() const { 96 return deviceConfigurations_; 97 } 98 hasDeviceConfigurations() const99 bool CarAudioConfigurationType::hasDeviceConfigurations() const { 100 return !(deviceConfigurations_.empty()); 101 } 102 getFirstDeviceConfigurations() const103 const DeviceConfigurationsType* CarAudioConfigurationType::getFirstDeviceConfigurations() const { 104 if (deviceConfigurations_.empty()) { 105 return nullptr; 106 } 107 return &deviceConfigurations_[0]; 108 } 109 getOemContexts() const110 const std::vector<OemContextsType>& CarAudioConfigurationType::getOemContexts() const { 111 return oemContexts_; 112 } 113 hasOemContexts() const114 bool CarAudioConfigurationType::hasOemContexts() const { 115 return !(oemContexts_.empty()); 116 } 117 getFirstOemContexts() const118 const OemContextsType* CarAudioConfigurationType::getFirstOemContexts() const { 119 if (oemContexts_.empty()) { 120 return nullptr; 121 } 122 return &oemContexts_[0]; 123 } 124 getActivationVolumeConfigs() const125 const std::vector<ActivationVolumeConfigsType>& CarAudioConfigurationType::getActivationVolumeConfigs() const { 126 return activationVolumeConfigs_; 127 } 128 hasActivationVolumeConfigs() const129 bool CarAudioConfigurationType::hasActivationVolumeConfigs() const { 130 return !(activationVolumeConfigs_.empty()); 131 } 132 getFirstActivationVolumeConfigs() const133 const ActivationVolumeConfigsType* CarAudioConfigurationType::getFirstActivationVolumeConfigs() const { 134 if (activationVolumeConfigs_.empty()) { 135 return nullptr; 136 } 137 return &activationVolumeConfigs_[0]; 138 } 139 getZones() const140 const std::vector<ZonesType>& CarAudioConfigurationType::getZones() const { 141 return zones_; 142 } 143 hasZones() const144 bool CarAudioConfigurationType::hasZones() const { 145 return !(zones_.empty()); 146 } 147 getFirstZones() const148 const ZonesType* CarAudioConfigurationType::getFirstZones() const { 149 if (zones_.empty()) { 150 return nullptr; 151 } 152 return &zones_[0]; 153 } 154 getVersion() const155 const std::string& CarAudioConfigurationType::getVersion() const { 156 return version_; 157 } 158 hasVersion() const159 bool CarAudioConfigurationType::hasVersion() const { 160 return true; 161 } 162 read(xmlNode * root)163 CarAudioConfigurationType CarAudioConfigurationType::read(xmlNode *root) { 164 std::string _raw; 165 _raw = getXmlAttribute(root, "version"); 166 std::string version{}; 167 if (_raw != "") { 168 std::string &_value = _raw; 169 version = _value; 170 } 171 std::vector<MirroringDevicesType> mirroringDevices; 172 std::vector<DeviceConfigurationsType> deviceConfigurations; 173 std::vector<OemContextsType> oemContexts; 174 std::vector<ActivationVolumeConfigsType> activationVolumeConfigs; 175 std::vector<ZonesType> zones; 176 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 177 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("mirroringDevices"))) { 178 MirroringDevicesType _value = MirroringDevicesType::read(_child); 179 mirroringDevices.push_back(std::move(_value)); 180 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("deviceConfigurations"))) { 181 DeviceConfigurationsType _value = DeviceConfigurationsType::read(_child); 182 deviceConfigurations.push_back(std::move(_value)); 183 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("oemContexts"))) { 184 OemContextsType _value = OemContextsType::read(_child); 185 oemContexts.push_back(std::move(_value)); 186 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("activationVolumeConfigs"))) { 187 ActivationVolumeConfigsType _value = ActivationVolumeConfigsType::read(_child); 188 activationVolumeConfigs.push_back(std::move(_value)); 189 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("zones"))) { 190 ZonesType _value = ZonesType::read(_child); 191 zones.push_back(std::move(_value)); 192 } 193 } 194 CarAudioConfigurationType instance(mirroringDevices, deviceConfigurations, oemContexts, activationVolumeConfigs, zones, version); 195 return instance; 196 } 197 ZonesType(std::vector<ZoneType> zone)198 ZonesType::ZonesType(std::vector<ZoneType> zone) : zone_(std::move(zone)) { 199 } 200 getZone() const201 const std::vector<ZoneType>& ZonesType::getZone() const { 202 return zone_; 203 } 204 hasZone() const205 bool ZonesType::hasZone() const { 206 return !(zone_.empty()); 207 } 208 getFirstZone() const209 const ZoneType* ZonesType::getFirstZone() const { 210 if (zone_.empty()) { 211 return nullptr; 212 } 213 return &zone_[0]; 214 } 215 read(xmlNode * root)216 ZonesType ZonesType::read(xmlNode *root) { 217 std::string _raw; 218 std::vector<ZoneType> zone; 219 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 220 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("zone"))) { 221 ZoneType _value = ZoneType::read(_child); 222 zone.push_back(std::move(_value)); 223 } 224 } 225 ZonesType instance(zone); 226 return instance; 227 } 228 ActivationVolumeConfigsType(std::vector<ActivationVolumeConfigType> activationVolumeConfig)229 ActivationVolumeConfigsType::ActivationVolumeConfigsType(std::vector<ActivationVolumeConfigType> activationVolumeConfig) : activationVolumeConfig_(std::move(activationVolumeConfig)) { 230 } 231 getActivationVolumeConfig() const232 const std::vector<ActivationVolumeConfigType>& ActivationVolumeConfigsType::getActivationVolumeConfig() const { 233 return activationVolumeConfig_; 234 } 235 hasActivationVolumeConfig() const236 bool ActivationVolumeConfigsType::hasActivationVolumeConfig() const { 237 return !(activationVolumeConfig_.empty()); 238 } 239 getFirstActivationVolumeConfig() const240 const ActivationVolumeConfigType* ActivationVolumeConfigsType::getFirstActivationVolumeConfig() const { 241 if (activationVolumeConfig_.empty()) { 242 return nullptr; 243 } 244 return &activationVolumeConfig_[0]; 245 } 246 read(xmlNode * root)247 ActivationVolumeConfigsType ActivationVolumeConfigsType::read(xmlNode *root) { 248 std::string _raw; 249 std::vector<ActivationVolumeConfigType> activationVolumeConfig; 250 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 251 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("activationVolumeConfig"))) { 252 ActivationVolumeConfigType _value = ActivationVolumeConfigType::read(_child); 253 activationVolumeConfig.push_back(std::move(_value)); 254 } 255 } 256 ActivationVolumeConfigsType instance(activationVolumeConfig); 257 return instance; 258 } 259 OemContextsType(std::vector<OemContextType> oemContext)260 OemContextsType::OemContextsType(std::vector<OemContextType> oemContext) : oemContext_(std::move(oemContext)) { 261 } 262 getOemContext() const263 const std::vector<OemContextType>& OemContextsType::getOemContext() const { 264 return oemContext_; 265 } 266 hasOemContext() const267 bool OemContextsType::hasOemContext() const { 268 return !(oemContext_.empty()); 269 } 270 getFirstOemContext() const271 const OemContextType* OemContextsType::getFirstOemContext() const { 272 if (oemContext_.empty()) { 273 return nullptr; 274 } 275 return &oemContext_[0]; 276 } 277 read(xmlNode * root)278 OemContextsType OemContextsType::read(xmlNode *root) { 279 std::string _raw; 280 std::vector<OemContextType> oemContext; 281 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 282 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("oemContext"))) { 283 OemContextType _value = OemContextType::read(_child); 284 oemContext.push_back(std::move(_value)); 285 } 286 } 287 OemContextsType instance(oemContext); 288 return instance; 289 } 290 DeviceConfigurationsType(std::vector<DeviceConfigurationType> deviceConfiguration)291 DeviceConfigurationsType::DeviceConfigurationsType(std::vector<DeviceConfigurationType> deviceConfiguration) : deviceConfiguration_(std::move(deviceConfiguration)) { 292 } 293 getDeviceConfiguration() const294 const std::vector<DeviceConfigurationType>& DeviceConfigurationsType::getDeviceConfiguration() const { 295 return deviceConfiguration_; 296 } 297 hasDeviceConfiguration() const298 bool DeviceConfigurationsType::hasDeviceConfiguration() const { 299 return !(deviceConfiguration_.empty()); 300 } 301 getFirstDeviceConfiguration() const302 const DeviceConfigurationType* DeviceConfigurationsType::getFirstDeviceConfiguration() const { 303 if (deviceConfiguration_.empty()) { 304 return nullptr; 305 } 306 return &deviceConfiguration_[0]; 307 } 308 read(xmlNode * root)309 DeviceConfigurationsType DeviceConfigurationsType::read(xmlNode *root) { 310 std::string _raw; 311 std::vector<DeviceConfigurationType> deviceConfiguration; 312 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 313 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("deviceConfiguration"))) { 314 DeviceConfigurationType _value = DeviceConfigurationType::read(_child); 315 deviceConfiguration.push_back(std::move(_value)); 316 } 317 } 318 DeviceConfigurationsType instance(deviceConfiguration); 319 return instance; 320 } 321 ZoneType(std::vector<InputDevicesType> inputDevices,std::vector<ZoneConfigsType> zoneConfigs,std::optional<std::string> name,std::string audioZoneId,std::optional<bool> isPrimary,std::optional<std::string> occupantZoneId)322 ZoneType::ZoneType(std::vector<InputDevicesType> inputDevices, std::vector<ZoneConfigsType> zoneConfigs, std::optional<std::string> name, std::string audioZoneId, std::optional<bool> isPrimary, std::optional<std::string> occupantZoneId) : inputDevices_(std::move(inputDevices)), zoneConfigs_(std::move(zoneConfigs)), name_(std::move(name)), audioZoneId_(std::move(audioZoneId)), isPrimary_(isPrimary), occupantZoneId_(std::move(occupantZoneId)) { 323 } 324 getInputDevices() const325 const std::vector<InputDevicesType>& ZoneType::getInputDevices() const { 326 return inputDevices_; 327 } 328 hasInputDevices() const329 bool ZoneType::hasInputDevices() const { 330 return !(inputDevices_.empty()); 331 } 332 getFirstInputDevices() const333 const InputDevicesType* ZoneType::getFirstInputDevices() const { 334 if (inputDevices_.empty()) { 335 return nullptr; 336 } 337 return &inputDevices_[0]; 338 } 339 getZoneConfigs() const340 const std::vector<ZoneConfigsType>& ZoneType::getZoneConfigs() const { 341 return zoneConfigs_; 342 } 343 hasZoneConfigs() const344 bool ZoneType::hasZoneConfigs() const { 345 return !(zoneConfigs_.empty()); 346 } 347 getFirstZoneConfigs() const348 const ZoneConfigsType* ZoneType::getFirstZoneConfigs() const { 349 if (zoneConfigs_.empty()) { 350 return nullptr; 351 } 352 return &zoneConfigs_[0]; 353 } 354 getName() const355 const std::string& ZoneType::getName() const { 356 _xsdc_assert(hasName()); 357 return name_.value(); 358 } 359 hasName() const360 bool ZoneType::hasName() const { 361 return name_.has_value(); 362 } 363 getAudioZoneId() const364 const std::string& ZoneType::getAudioZoneId() const { 365 return audioZoneId_; 366 } 367 hasAudioZoneId() const368 bool ZoneType::hasAudioZoneId() const { 369 return true; 370 } 371 getIsPrimary() const372 const bool& ZoneType::getIsPrimary() const { 373 _xsdc_assert(hasIsPrimary()); 374 return isPrimary_.value(); 375 } 376 hasIsPrimary() const377 bool ZoneType::hasIsPrimary() const { 378 return isPrimary_.has_value(); 379 } 380 getOccupantZoneId() const381 const std::string& ZoneType::getOccupantZoneId() const { 382 _xsdc_assert(hasOccupantZoneId()); 383 return occupantZoneId_.value(); 384 } 385 hasOccupantZoneId() const386 bool ZoneType::hasOccupantZoneId() const { 387 return occupantZoneId_.has_value(); 388 } 389 read(xmlNode * root)390 ZoneType ZoneType::read(xmlNode *root) { 391 std::string _raw; 392 _raw = getXmlAttribute(root, "name"); 393 std::optional<std::string> name = std::nullopt; 394 if (_raw != "") { 395 std::string &_value = _raw; 396 name = _value; 397 } 398 _raw = getXmlAttribute(root, "audioZoneId"); 399 std::string audioZoneId{}; 400 if (_raw != "") { 401 std::string &_value = _raw; 402 audioZoneId = _value; 403 } 404 _raw = getXmlAttribute(root, "isPrimary"); 405 std::optional<bool> isPrimary = std::nullopt; 406 if (_raw != "") { 407 bool _value = _raw == "true"; 408 isPrimary = _value; 409 } 410 _raw = getXmlAttribute(root, "occupantZoneId"); 411 std::optional<std::string> occupantZoneId = std::nullopt; 412 if (_raw != "") { 413 std::string &_value = _raw; 414 occupantZoneId = _value; 415 } 416 std::vector<InputDevicesType> inputDevices; 417 std::vector<ZoneConfigsType> zoneConfigs; 418 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 419 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("inputDevices"))) { 420 InputDevicesType _value = InputDevicesType::read(_child); 421 inputDevices.push_back(std::move(_value)); 422 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("zoneConfigs"))) { 423 ZoneConfigsType _value = ZoneConfigsType::read(_child); 424 zoneConfigs.push_back(std::move(_value)); 425 } 426 } 427 ZoneType instance(inputDevices, zoneConfigs, name, audioZoneId, isPrimary, occupantZoneId); 428 return instance; 429 } 430 ZoneConfigsType(std::vector<ZoneConfigType> zoneConfig)431 ZoneConfigsType::ZoneConfigsType(std::vector<ZoneConfigType> zoneConfig) : zoneConfig_(std::move(zoneConfig)) { 432 } 433 getZoneConfig() const434 const std::vector<ZoneConfigType>& ZoneConfigsType::getZoneConfig() const { 435 return zoneConfig_; 436 } 437 hasZoneConfig() const438 bool ZoneConfigsType::hasZoneConfig() const { 439 return !(zoneConfig_.empty()); 440 } 441 getFirstZoneConfig() const442 const ZoneConfigType* ZoneConfigsType::getFirstZoneConfig() const { 443 if (zoneConfig_.empty()) { 444 return nullptr; 445 } 446 return &zoneConfig_[0]; 447 } 448 read(xmlNode * root)449 ZoneConfigsType ZoneConfigsType::read(xmlNode *root) { 450 std::string _raw; 451 std::vector<ZoneConfigType> zoneConfig; 452 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 453 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("zoneConfig"))) { 454 ZoneConfigType _value = ZoneConfigType::read(_child); 455 zoneConfig.push_back(std::move(_value)); 456 } 457 } 458 ZoneConfigsType instance(zoneConfig); 459 return instance; 460 } 461 ZoneConfigType(std::vector<VolumeGroupsType> volumeGroups,std::vector<ApplyFadeConfigsType> applyFadeConfigs,std::optional<std::string> name,std::optional<bool> isDefault)462 ZoneConfigType::ZoneConfigType(std::vector<VolumeGroupsType> volumeGroups, std::vector<ApplyFadeConfigsType> applyFadeConfigs, std::optional<std::string> name, std::optional<bool> isDefault) : volumeGroups_(std::move(volumeGroups)), applyFadeConfigs_(std::move(applyFadeConfigs)), name_(std::move(name)), isDefault_(isDefault) { 463 } 464 getVolumeGroups() const465 const std::vector<VolumeGroupsType>& ZoneConfigType::getVolumeGroups() const { 466 return volumeGroups_; 467 } 468 hasVolumeGroups() const469 bool ZoneConfigType::hasVolumeGroups() const { 470 return !(volumeGroups_.empty()); 471 } 472 getFirstVolumeGroups() const473 const VolumeGroupsType* ZoneConfigType::getFirstVolumeGroups() const { 474 if (volumeGroups_.empty()) { 475 return nullptr; 476 } 477 return &volumeGroups_[0]; 478 } 479 getApplyFadeConfigs() const480 const std::vector<ApplyFadeConfigsType>& ZoneConfigType::getApplyFadeConfigs() const { 481 return applyFadeConfigs_; 482 } 483 hasApplyFadeConfigs() const484 bool ZoneConfigType::hasApplyFadeConfigs() const { 485 return !(applyFadeConfigs_.empty()); 486 } 487 getFirstApplyFadeConfigs() const488 const ApplyFadeConfigsType* ZoneConfigType::getFirstApplyFadeConfigs() const { 489 if (applyFadeConfigs_.empty()) { 490 return nullptr; 491 } 492 return &applyFadeConfigs_[0]; 493 } 494 getName() const495 const std::string& ZoneConfigType::getName() const { 496 _xsdc_assert(hasName()); 497 return name_.value(); 498 } 499 hasName() const500 bool ZoneConfigType::hasName() const { 501 return name_.has_value(); 502 } 503 getIsDefault() const504 const bool& ZoneConfigType::getIsDefault() const { 505 _xsdc_assert(hasIsDefault()); 506 return isDefault_.value(); 507 } 508 hasIsDefault() const509 bool ZoneConfigType::hasIsDefault() const { 510 return isDefault_.has_value(); 511 } 512 read(xmlNode * root)513 ZoneConfigType ZoneConfigType::read(xmlNode *root) { 514 std::string _raw; 515 _raw = getXmlAttribute(root, "name"); 516 std::optional<std::string> name = std::nullopt; 517 if (_raw != "") { 518 std::string &_value = _raw; 519 name = _value; 520 } 521 _raw = getXmlAttribute(root, "isDefault"); 522 std::optional<bool> isDefault = std::nullopt; 523 if (_raw != "") { 524 bool _value = _raw == "true"; 525 isDefault = _value; 526 } 527 std::vector<VolumeGroupsType> volumeGroups; 528 std::vector<ApplyFadeConfigsType> applyFadeConfigs; 529 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 530 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("volumeGroups"))) { 531 VolumeGroupsType _value = VolumeGroupsType::read(_child); 532 volumeGroups.push_back(std::move(_value)); 533 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("applyFadeConfigs"))) { 534 ApplyFadeConfigsType _value = ApplyFadeConfigsType::read(_child); 535 applyFadeConfigs.push_back(std::move(_value)); 536 } 537 } 538 ZoneConfigType instance(volumeGroups, applyFadeConfigs, name, isDefault); 539 return instance; 540 } 541 ApplyFadeConfigsType(std::vector<ApplyFadeConfigType> fadeConfig)542 ApplyFadeConfigsType::ApplyFadeConfigsType(std::vector<ApplyFadeConfigType> fadeConfig) : fadeConfig_(std::move(fadeConfig)) { 543 } 544 getFadeConfig() const545 const std::vector<ApplyFadeConfigType>& ApplyFadeConfigsType::getFadeConfig() const { 546 return fadeConfig_; 547 } 548 hasFadeConfig() const549 bool ApplyFadeConfigsType::hasFadeConfig() const { 550 return !(fadeConfig_.empty()); 551 } 552 getFirstFadeConfig() const553 const ApplyFadeConfigType* ApplyFadeConfigsType::getFirstFadeConfig() const { 554 if (fadeConfig_.empty()) { 555 return nullptr; 556 } 557 return &fadeConfig_[0]; 558 } 559 read(xmlNode * root)560 ApplyFadeConfigsType ApplyFadeConfigsType::read(xmlNode *root) { 561 std::string _raw; 562 std::vector<ApplyFadeConfigType> fadeConfig; 563 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 564 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeConfig"))) { 565 ApplyFadeConfigType _value = ApplyFadeConfigType::read(_child); 566 fadeConfig.push_back(std::move(_value)); 567 } 568 } 569 ApplyFadeConfigsType instance(fadeConfig); 570 return instance; 571 } 572 ApplyFadeConfigType(std::vector<AudioAttributeUsagesType> audioAttributes,std::optional<std::string> name,std::optional<bool> isDefault)573 ApplyFadeConfigType::ApplyFadeConfigType(std::vector<AudioAttributeUsagesType> audioAttributes, std::optional<std::string> name, std::optional<bool> isDefault) : audioAttributes_(std::move(audioAttributes)), name_(std::move(name)), isDefault_(isDefault) { 574 } 575 getAudioAttributes() const576 const std::vector<AudioAttributeUsagesType>& ApplyFadeConfigType::getAudioAttributes() const { 577 return audioAttributes_; 578 } 579 hasAudioAttributes() const580 bool ApplyFadeConfigType::hasAudioAttributes() const { 581 return !(audioAttributes_.empty()); 582 } 583 getFirstAudioAttributes() const584 const AudioAttributeUsagesType* ApplyFadeConfigType::getFirstAudioAttributes() const { 585 if (audioAttributes_.empty()) { 586 return nullptr; 587 } 588 return &audioAttributes_[0]; 589 } 590 getName() const591 const std::string& ApplyFadeConfigType::getName() const { 592 _xsdc_assert(hasName()); 593 return name_.value(); 594 } 595 hasName() const596 bool ApplyFadeConfigType::hasName() const { 597 return name_.has_value(); 598 } 599 getIsDefault() const600 const bool& ApplyFadeConfigType::getIsDefault() const { 601 _xsdc_assert(hasIsDefault()); 602 return isDefault_.value(); 603 } 604 hasIsDefault() const605 bool ApplyFadeConfigType::hasIsDefault() const { 606 return isDefault_.has_value(); 607 } 608 read(xmlNode * root)609 ApplyFadeConfigType ApplyFadeConfigType::read(xmlNode *root) { 610 std::string _raw; 611 _raw = getXmlAttribute(root, "name"); 612 std::optional<std::string> name = std::nullopt; 613 if (_raw != "") { 614 std::string &_value = _raw; 615 name = _value; 616 } 617 _raw = getXmlAttribute(root, "isDefault"); 618 std::optional<bool> isDefault = std::nullopt; 619 if (_raw != "") { 620 bool _value = _raw == "true"; 621 isDefault = _value; 622 } 623 std::vector<AudioAttributeUsagesType> audioAttributes; 624 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 625 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("audioAttributes"))) { 626 AudioAttributeUsagesType _value = AudioAttributeUsagesType::read(_child); 627 audioAttributes.push_back(std::move(_value)); 628 } 629 } 630 ApplyFadeConfigType instance(audioAttributes, name, isDefault); 631 return instance; 632 } 633 AudioAttributeUsagesType(std::vector<UsageType> usage)634 AudioAttributeUsagesType::AudioAttributeUsagesType(std::vector<UsageType> usage) : usage_(std::move(usage)) { 635 } 636 getUsage() const637 const std::vector<UsageType>& AudioAttributeUsagesType::getUsage() const { 638 return usage_; 639 } 640 hasUsage() const641 bool AudioAttributeUsagesType::hasUsage() const { 642 return !(usage_.empty()); 643 } 644 getFirstUsage() const645 const UsageType* AudioAttributeUsagesType::getFirstUsage() const { 646 if (usage_.empty()) { 647 return nullptr; 648 } 649 return &usage_[0]; 650 } 651 read(xmlNode * root)652 AudioAttributeUsagesType AudioAttributeUsagesType::read(xmlNode *root) { 653 std::string _raw; 654 std::vector<UsageType> usage; 655 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 656 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("usage"))) { 657 UsageType _value = UsageType::read(_child); 658 usage.push_back(std::move(_value)); 659 } 660 } 661 AudioAttributeUsagesType instance(usage); 662 return instance; 663 } 664 VolumeGroupsType(std::vector<VolumeGroupType> group)665 VolumeGroupsType::VolumeGroupsType(std::vector<VolumeGroupType> group) : group_(std::move(group)) { 666 } 667 getGroup() const668 const std::vector<VolumeGroupType>& VolumeGroupsType::getGroup() const { 669 return group_; 670 } 671 hasGroup() const672 bool VolumeGroupsType::hasGroup() const { 673 return !(group_.empty()); 674 } 675 getFirstGroup() const676 const VolumeGroupType* VolumeGroupsType::getFirstGroup() const { 677 if (group_.empty()) { 678 return nullptr; 679 } 680 return &group_[0]; 681 } 682 read(xmlNode * root)683 VolumeGroupsType VolumeGroupsType::read(xmlNode *root) { 684 std::string _raw; 685 std::vector<VolumeGroupType> group; 686 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 687 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("group"))) { 688 VolumeGroupType _value = VolumeGroupType::read(_child); 689 group.push_back(std::move(_value)); 690 } 691 } 692 VolumeGroupsType instance(group); 693 return instance; 694 } 695 VolumeGroupType(std::vector<DeviceRoutesType> device,std::optional<std::string> name,std::optional<std::string> activationConfig)696 VolumeGroupType::VolumeGroupType(std::vector<DeviceRoutesType> device, std::optional<std::string> name, std::optional<std::string> activationConfig) : device_(std::move(device)), name_(std::move(name)), activationConfig_(std::move(activationConfig)) { 697 } 698 getDevice() const699 const std::vector<DeviceRoutesType>& VolumeGroupType::getDevice() const { 700 return device_; 701 } 702 hasDevice() const703 bool VolumeGroupType::hasDevice() const { 704 return !(device_.empty()); 705 } 706 getFirstDevice() const707 const DeviceRoutesType* VolumeGroupType::getFirstDevice() const { 708 if (device_.empty()) { 709 return nullptr; 710 } 711 return &device_[0]; 712 } 713 getName() const714 const std::string& VolumeGroupType::getName() const { 715 _xsdc_assert(hasName()); 716 return name_.value(); 717 } 718 hasName() const719 bool VolumeGroupType::hasName() const { 720 return name_.has_value(); 721 } 722 getActivationConfig() const723 const std::string& VolumeGroupType::getActivationConfig() const { 724 _xsdc_assert(hasActivationConfig()); 725 return activationConfig_.value(); 726 } 727 hasActivationConfig() const728 bool VolumeGroupType::hasActivationConfig() const { 729 return activationConfig_.has_value(); 730 } 731 read(xmlNode * root)732 VolumeGroupType VolumeGroupType::read(xmlNode *root) { 733 std::string _raw; 734 _raw = getXmlAttribute(root, "name"); 735 std::optional<std::string> name = std::nullopt; 736 if (_raw != "") { 737 std::string &_value = _raw; 738 name = _value; 739 } 740 _raw = getXmlAttribute(root, "activationConfig"); 741 std::optional<std::string> activationConfig = std::nullopt; 742 if (_raw != "") { 743 std::string &_value = _raw; 744 activationConfig = _value; 745 } 746 std::vector<DeviceRoutesType> device; 747 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 748 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("device"))) { 749 DeviceRoutesType _value = DeviceRoutesType::read(_child); 750 device.push_back(std::move(_value)); 751 } 752 } 753 VolumeGroupType instance(device, name, activationConfig); 754 return instance; 755 } 756 DeviceRoutesType(std::vector<ContextNameType> context,std::optional<std::string> address,std::optional<OutDeviceType> type)757 DeviceRoutesType::DeviceRoutesType(std::vector<ContextNameType> context, std::optional<std::string> address, std::optional<OutDeviceType> type) : context_(std::move(context)), address_(std::move(address)), type_(type) { 758 } 759 getContext() const760 const std::vector<ContextNameType>& DeviceRoutesType::getContext() const { 761 return context_; 762 } 763 hasContext() const764 bool DeviceRoutesType::hasContext() const { 765 return !(context_.empty()); 766 } 767 getFirstContext() const768 const ContextNameType* DeviceRoutesType::getFirstContext() const { 769 if (context_.empty()) { 770 return nullptr; 771 } 772 return &context_[0]; 773 } 774 getAddress() const775 const std::string& DeviceRoutesType::getAddress() const { 776 _xsdc_assert(hasAddress()); 777 return address_.value(); 778 } 779 hasAddress() const780 bool DeviceRoutesType::hasAddress() const { 781 return address_.has_value(); 782 } 783 getType() const784 const OutDeviceType& DeviceRoutesType::getType() const { 785 _xsdc_assert(hasType()); 786 return type_.value(); 787 } 788 hasType() const789 bool DeviceRoutesType::hasType() const { 790 return type_.has_value(); 791 } 792 read(xmlNode * root)793 DeviceRoutesType DeviceRoutesType::read(xmlNode *root) { 794 std::string _raw; 795 _raw = getXmlAttribute(root, "address"); 796 std::optional<std::string> address = std::nullopt; 797 if (_raw != "") { 798 std::string &_value = _raw; 799 address = _value; 800 } 801 _raw = getXmlAttribute(root, "type"); 802 std::optional<OutDeviceType> type = std::nullopt; 803 if (_raw != "") { 804 OutDeviceType _value = stringToOutDeviceType(_raw); 805 type = _value; 806 } 807 std::vector<ContextNameType> context; 808 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 809 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("context"))) { 810 ContextNameType _value = ContextNameType::read(_child); 811 context.push_back(std::move(_value)); 812 } 813 } 814 DeviceRoutesType instance(context, address, type); 815 return instance; 816 } 817 ContextNameType(std::optional<std::string> context)818 ContextNameType::ContextNameType(std::optional<std::string> context) : context_(std::move(context)) { 819 } 820 getContext() const821 const std::string& ContextNameType::getContext() const { 822 _xsdc_assert(hasContext()); 823 return context_.value(); 824 } 825 hasContext() const826 bool ContextNameType::hasContext() const { 827 return context_.has_value(); 828 } 829 read(xmlNode * root)830 ContextNameType ContextNameType::read(xmlNode *root) { 831 std::string _raw; 832 _raw = getXmlAttribute(root, "context"); 833 std::optional<std::string> context = std::nullopt; 834 if (_raw != "") { 835 std::string &_value = _raw; 836 context = _value; 837 } 838 ContextNameType instance(context); 839 return instance; 840 } 841 OemContextType(std::vector<AudioAttributesUsagesType> audioAttributes,std::optional<std::string> name,std::optional<std::string> id)842 OemContextType::OemContextType(std::vector<AudioAttributesUsagesType> audioAttributes, std::optional<std::string> name, std::optional<std::string> id) : audioAttributes_(std::move(audioAttributes)), name_(std::move(name)), id_(std::move(id)) { 843 } 844 getAudioAttributes() const845 const std::vector<AudioAttributesUsagesType>& OemContextType::getAudioAttributes() const { 846 return audioAttributes_; 847 } 848 hasAudioAttributes() const849 bool OemContextType::hasAudioAttributes() const { 850 return !(audioAttributes_.empty()); 851 } 852 getFirstAudioAttributes() const853 const AudioAttributesUsagesType* OemContextType::getFirstAudioAttributes() const { 854 if (audioAttributes_.empty()) { 855 return nullptr; 856 } 857 return &audioAttributes_[0]; 858 } 859 getName() const860 const std::string& OemContextType::getName() const { 861 _xsdc_assert(hasName()); 862 return name_.value(); 863 } 864 hasName() const865 bool OemContextType::hasName() const { 866 return name_.has_value(); 867 } 868 getId() const869 const std::string& OemContextType::getId() const { 870 _xsdc_assert(hasId()); 871 return id_.value(); 872 } 873 hasId() const874 bool OemContextType::hasId() const { 875 return id_.has_value(); 876 } 877 read(xmlNode * root)878 OemContextType OemContextType::read(xmlNode *root) { 879 std::string _raw; 880 _raw = getXmlAttribute(root, "name"); 881 std::optional<std::string> name = std::nullopt; 882 if (_raw != "") { 883 std::string &_value = _raw; 884 name = _value; 885 } 886 _raw = getXmlAttribute(root, "id"); 887 std::optional<std::string> id = std::nullopt; 888 if (_raw != "") { 889 std::string &_value = _raw; 890 id = _value; 891 } 892 std::vector<AudioAttributesUsagesType> audioAttributes; 893 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 894 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("audioAttributes"))) { 895 AudioAttributesUsagesType _value = AudioAttributesUsagesType::read(_child); 896 audioAttributes.push_back(std::move(_value)); 897 } 898 } 899 OemContextType instance(audioAttributes, name, id); 900 return instance; 901 } 902 AudioAttributesUsagesType(std::vector<AttributesType> audioAttribute_optional,std::vector<UsageType> usage_optional)903 AudioAttributesUsagesType::AudioAttributesUsagesType(std::vector<AttributesType> audioAttribute_optional, std::vector<UsageType> usage_optional) : audioAttribute_optional_(std::move(audioAttribute_optional)), usage_optional_(std::move(usage_optional)) { 904 } 905 getAudioAttribute_optional() const906 const std::vector<AttributesType>& AudioAttributesUsagesType::getAudioAttribute_optional() const { 907 return audioAttribute_optional_; 908 } 909 hasAudioAttribute_optional() const910 bool AudioAttributesUsagesType::hasAudioAttribute_optional() const { 911 return !(audioAttribute_optional_.empty()); 912 } 913 getFirstAudioAttribute_optional() const914 const AttributesType* AudioAttributesUsagesType::getFirstAudioAttribute_optional() const { 915 if (audioAttribute_optional_.empty()) { 916 return nullptr; 917 } 918 return &audioAttribute_optional_[0]; 919 } 920 getUsage_optional() const921 const std::vector<UsageType>& AudioAttributesUsagesType::getUsage_optional() const { 922 return usage_optional_; 923 } 924 hasUsage_optional() const925 bool AudioAttributesUsagesType::hasUsage_optional() const { 926 return !(usage_optional_.empty()); 927 } 928 getFirstUsage_optional() const929 const UsageType* AudioAttributesUsagesType::getFirstUsage_optional() const { 930 if (usage_optional_.empty()) { 931 return nullptr; 932 } 933 return &usage_optional_[0]; 934 } 935 read(xmlNode * root)936 AudioAttributesUsagesType AudioAttributesUsagesType::read(xmlNode *root) { 937 std::string _raw; 938 std::vector<AttributesType> audioAttribute_optional; 939 std::vector<UsageType> usage_optional; 940 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 941 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("audioAttribute"))) { 942 AttributesType _value = AttributesType::read(_child); 943 audioAttribute_optional.push_back(std::move(_value)); 944 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("usage"))) { 945 UsageType _value = UsageType::read(_child); 946 usage_optional.push_back(std::move(_value)); 947 } 948 } 949 AudioAttributesUsagesType instance(audioAttribute_optional, usage_optional); 950 return instance; 951 } 952 AttributesType(std::optional<ContentTypeEnum> contentType,std::optional<UsageEnumType> usage,std::optional<std::string> tags)953 AttributesType::AttributesType(std::optional<ContentTypeEnum> contentType, std::optional<UsageEnumType> usage, std::optional<std::string> tags) : contentType_(contentType), usage_(usage), tags_(std::move(tags)) { 954 } 955 getContentType() const956 const ContentTypeEnum& AttributesType::getContentType() const { 957 _xsdc_assert(hasContentType()); 958 return contentType_.value(); 959 } 960 hasContentType() const961 bool AttributesType::hasContentType() const { 962 return contentType_.has_value(); 963 } 964 getUsage() const965 const UsageEnumType& AttributesType::getUsage() const { 966 _xsdc_assert(hasUsage()); 967 return usage_.value(); 968 } 969 hasUsage() const970 bool AttributesType::hasUsage() const { 971 return usage_.has_value(); 972 } 973 getTags() const974 const std::string& AttributesType::getTags() const { 975 _xsdc_assert(hasTags()); 976 return tags_.value(); 977 } 978 hasTags() const979 bool AttributesType::hasTags() const { 980 return tags_.has_value(); 981 } 982 read(xmlNode * root)983 AttributesType AttributesType::read(xmlNode *root) { 984 std::string _raw; 985 _raw = getXmlAttribute(root, "contentType"); 986 std::optional<ContentTypeEnum> contentType = std::nullopt; 987 if (_raw != "") { 988 ContentTypeEnum _value = stringToContentTypeEnum(_raw); 989 contentType = _value; 990 } 991 _raw = getXmlAttribute(root, "usage"); 992 std::optional<UsageEnumType> usage = std::nullopt; 993 if (_raw != "") { 994 UsageEnumType _value = stringToUsageEnumType(_raw); 995 usage = _value; 996 } 997 _raw = getXmlAttribute(root, "tags"); 998 std::optional<std::string> tags = std::nullopt; 999 if (_raw != "") { 1000 std::string &_value = _raw; 1001 tags = _value; 1002 } 1003 AttributesType instance(contentType, usage, tags); 1004 return instance; 1005 } 1006 DeviceConfigurationType(std::optional<std::string> name,std::optional<std::string> value)1007 DeviceConfigurationType::DeviceConfigurationType(std::optional<std::string> name, std::optional<std::string> value) : name_(std::move(name)), value_(std::move(value)) { 1008 } 1009 getName() const1010 const std::string& DeviceConfigurationType::getName() const { 1011 _xsdc_assert(hasName()); 1012 return name_.value(); 1013 } 1014 hasName() const1015 bool DeviceConfigurationType::hasName() const { 1016 return name_.has_value(); 1017 } 1018 getValue() const1019 const std::string& DeviceConfigurationType::getValue() const { 1020 _xsdc_assert(hasValue()); 1021 return value_.value(); 1022 } 1023 hasValue() const1024 bool DeviceConfigurationType::hasValue() const { 1025 return value_.has_value(); 1026 } 1027 read(xmlNode * root)1028 DeviceConfigurationType DeviceConfigurationType::read(xmlNode *root) { 1029 std::string _raw; 1030 _raw = getXmlAttribute(root, "name"); 1031 std::optional<std::string> name = std::nullopt; 1032 if (_raw != "") { 1033 std::string &_value = _raw; 1034 name = _value; 1035 } 1036 _raw = getXmlAttribute(root, "value"); 1037 std::optional<std::string> value = std::nullopt; 1038 if (_raw != "") { 1039 std::string &_value = _raw; 1040 value = _value; 1041 } 1042 DeviceConfigurationType instance(name, value); 1043 return instance; 1044 } 1045 ContentType(ContentTypeEnum value)1046 ContentType::ContentType(ContentTypeEnum value) : value_(value) { 1047 } 1048 getValue() const1049 const ContentTypeEnum& ContentType::getValue() const { 1050 return value_; 1051 } 1052 hasValue() const1053 bool ContentType::hasValue() const { 1054 return true; 1055 } 1056 read(xmlNode * root)1057 ContentType ContentType::read(xmlNode *root) { 1058 std::string _raw; 1059 _raw = getXmlAttribute(root, "value"); 1060 ContentTypeEnum value = ContentTypeEnum::UNKNOWN; 1061 if (_raw != "") { 1062 ContentTypeEnum _value = stringToContentTypeEnum(_raw); 1063 value = _value; 1064 } 1065 ContentType instance(value); 1066 return instance; 1067 } 1068 UsageType(UsageEnumType value)1069 UsageType::UsageType(UsageEnumType value) : value_(value) { 1070 } 1071 getValue() const1072 const UsageEnumType& UsageType::getValue() const { 1073 return value_; 1074 } 1075 hasValue() const1076 bool UsageType::hasValue() const { 1077 return true; 1078 } 1079 read(xmlNode * root)1080 UsageType UsageType::read(xmlNode *root) { 1081 std::string _raw; 1082 _raw = getXmlAttribute(root, "value"); 1083 UsageEnumType value = UsageEnumType::UNKNOWN; 1084 if (_raw != "") { 1085 UsageEnumType _value = stringToUsageEnumType(_raw); 1086 value = _value; 1087 } 1088 UsageType instance(value); 1089 return instance; 1090 } 1091 ActivationVolumeConfigType(std::vector<ActivationVolumeConfigEntryType> activationVolumeConfigEntry,std::optional<std::string> name)1092 ActivationVolumeConfigType::ActivationVolumeConfigType(std::vector<ActivationVolumeConfigEntryType> activationVolumeConfigEntry, std::optional<std::string> name) : activationVolumeConfigEntry_(std::move(activationVolumeConfigEntry)), name_(std::move(name)) { 1093 } 1094 getActivationVolumeConfigEntry() const1095 const std::vector<ActivationVolumeConfigEntryType>& ActivationVolumeConfigType::getActivationVolumeConfigEntry() const { 1096 return activationVolumeConfigEntry_; 1097 } 1098 hasActivationVolumeConfigEntry() const1099 bool ActivationVolumeConfigType::hasActivationVolumeConfigEntry() const { 1100 return !(activationVolumeConfigEntry_.empty()); 1101 } 1102 getFirstActivationVolumeConfigEntry() const1103 const ActivationVolumeConfigEntryType* ActivationVolumeConfigType::getFirstActivationVolumeConfigEntry() const { 1104 if (activationVolumeConfigEntry_.empty()) { 1105 return nullptr; 1106 } 1107 return &activationVolumeConfigEntry_[0]; 1108 } 1109 getName() const1110 const std::string& ActivationVolumeConfigType::getName() const { 1111 _xsdc_assert(hasName()); 1112 return name_.value(); 1113 } 1114 hasName() const1115 bool ActivationVolumeConfigType::hasName() const { 1116 return name_.has_value(); 1117 } 1118 read(xmlNode * root)1119 ActivationVolumeConfigType ActivationVolumeConfigType::read(xmlNode *root) { 1120 std::string _raw; 1121 _raw = getXmlAttribute(root, "name"); 1122 std::optional<std::string> name = std::nullopt; 1123 if (_raw != "") { 1124 std::string &_value = _raw; 1125 name = _value; 1126 } 1127 std::vector<ActivationVolumeConfigEntryType> activationVolumeConfigEntry; 1128 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1129 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("activationVolumeConfigEntry"))) { 1130 ActivationVolumeConfigEntryType _value = ActivationVolumeConfigEntryType::read(_child); 1131 activationVolumeConfigEntry.push_back(std::move(_value)); 1132 } 1133 } 1134 ActivationVolumeConfigType instance(activationVolumeConfigEntry, name); 1135 return instance; 1136 } 1137 ActivationVolumeConfigEntryType(std::optional<std::string> maxActivationVolumePercentage,std::optional<std::string> minActivationVolumePercentage,std::optional<ActivationType> invocationType)1138 ActivationVolumeConfigEntryType::ActivationVolumeConfigEntryType(std::optional<std::string> maxActivationVolumePercentage, std::optional<std::string> minActivationVolumePercentage, std::optional<ActivationType> invocationType) : maxActivationVolumePercentage_(std::move(maxActivationVolumePercentage)), minActivationVolumePercentage_(std::move(minActivationVolumePercentage)), invocationType_(invocationType) { 1139 } 1140 getMaxActivationVolumePercentage() const1141 const std::string& ActivationVolumeConfigEntryType::getMaxActivationVolumePercentage() const { 1142 _xsdc_assert(hasMaxActivationVolumePercentage()); 1143 return maxActivationVolumePercentage_.value(); 1144 } 1145 hasMaxActivationVolumePercentage() const1146 bool ActivationVolumeConfigEntryType::hasMaxActivationVolumePercentage() const { 1147 return maxActivationVolumePercentage_.has_value(); 1148 } 1149 getMinActivationVolumePercentage() const1150 const std::string& ActivationVolumeConfigEntryType::getMinActivationVolumePercentage() const { 1151 _xsdc_assert(hasMinActivationVolumePercentage()); 1152 return minActivationVolumePercentage_.value(); 1153 } 1154 hasMinActivationVolumePercentage() const1155 bool ActivationVolumeConfigEntryType::hasMinActivationVolumePercentage() const { 1156 return minActivationVolumePercentage_.has_value(); 1157 } 1158 getInvocationType() const1159 const ActivationType& ActivationVolumeConfigEntryType::getInvocationType() const { 1160 _xsdc_assert(hasInvocationType()); 1161 return invocationType_.value(); 1162 } 1163 hasInvocationType() const1164 bool ActivationVolumeConfigEntryType::hasInvocationType() const { 1165 return invocationType_.has_value(); 1166 } 1167 read(xmlNode * root)1168 ActivationVolumeConfigEntryType ActivationVolumeConfigEntryType::read(xmlNode *root) { 1169 std::string _raw; 1170 _raw = getXmlAttribute(root, "maxActivationVolumePercentage"); 1171 std::optional<std::string> maxActivationVolumePercentage = std::nullopt; 1172 if (_raw != "") { 1173 std::string &_value = _raw; 1174 maxActivationVolumePercentage = _value; 1175 } 1176 _raw = getXmlAttribute(root, "minActivationVolumePercentage"); 1177 std::optional<std::string> minActivationVolumePercentage = std::nullopt; 1178 if (_raw != "") { 1179 std::string &_value = _raw; 1180 minActivationVolumePercentage = _value; 1181 } 1182 _raw = getXmlAttribute(root, "invocationType"); 1183 std::optional<ActivationType> invocationType = std::nullopt; 1184 if (_raw != "") { 1185 ActivationType _value = stringToActivationType(_raw); 1186 invocationType = _value; 1187 } 1188 ActivationVolumeConfigEntryType instance(maxActivationVolumePercentage, minActivationVolumePercentage, invocationType); 1189 return instance; 1190 } 1191 MirroringDevicesType(std::vector<MirroringDevice> mirroringDevice)1192 MirroringDevicesType::MirroringDevicesType(std::vector<MirroringDevice> mirroringDevice) : mirroringDevice_(std::move(mirroringDevice)) { 1193 } 1194 getMirroringDevice() const1195 const std::vector<MirroringDevice>& MirroringDevicesType::getMirroringDevice() const { 1196 return mirroringDevice_; 1197 } 1198 hasMirroringDevice() const1199 bool MirroringDevicesType::hasMirroringDevice() const { 1200 return !(mirroringDevice_.empty()); 1201 } 1202 getFirstMirroringDevice() const1203 const MirroringDevice* MirroringDevicesType::getFirstMirroringDevice() const { 1204 if (mirroringDevice_.empty()) { 1205 return nullptr; 1206 } 1207 return &mirroringDevice_[0]; 1208 } 1209 read(xmlNode * root)1210 MirroringDevicesType MirroringDevicesType::read(xmlNode *root) { 1211 std::string _raw; 1212 std::vector<MirroringDevice> mirroringDevice; 1213 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1214 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("mirroringDevice"))) { 1215 MirroringDevice _value = MirroringDevice::read(_child); 1216 mirroringDevice.push_back(std::move(_value)); 1217 } 1218 } 1219 MirroringDevicesType instance(mirroringDevice); 1220 return instance; 1221 } 1222 MirroringDevice(std::optional<std::string> address)1223 MirroringDevice::MirroringDevice(std::optional<std::string> address) : address_(std::move(address)) { 1224 } 1225 getAddress() const1226 const std::string& MirroringDevice::getAddress() const { 1227 _xsdc_assert(hasAddress()); 1228 return address_.value(); 1229 } 1230 hasAddress() const1231 bool MirroringDevice::hasAddress() const { 1232 return address_.has_value(); 1233 } 1234 read(xmlNode * root)1235 MirroringDevice MirroringDevice::read(xmlNode *root) { 1236 std::string _raw; 1237 _raw = getXmlAttribute(root, "address"); 1238 std::optional<std::string> address = std::nullopt; 1239 if (_raw != "") { 1240 std::string &_value = _raw; 1241 address = _value; 1242 } 1243 MirroringDevice instance(address); 1244 return instance; 1245 } 1246 InputDevicesType(std::vector<InputDeviceType> inputDevice)1247 InputDevicesType::InputDevicesType(std::vector<InputDeviceType> inputDevice) : inputDevice_(std::move(inputDevice)) { 1248 } 1249 getInputDevice() const1250 const std::vector<InputDeviceType>& InputDevicesType::getInputDevice() const { 1251 return inputDevice_; 1252 } 1253 hasInputDevice() const1254 bool InputDevicesType::hasInputDevice() const { 1255 return !(inputDevice_.empty()); 1256 } 1257 getFirstInputDevice() const1258 const InputDeviceType* InputDevicesType::getFirstInputDevice() const { 1259 if (inputDevice_.empty()) { 1260 return nullptr; 1261 } 1262 return &inputDevice_[0]; 1263 } 1264 read(xmlNode * root)1265 InputDevicesType InputDevicesType::read(xmlNode *root) { 1266 std::string _raw; 1267 std::vector<InputDeviceType> inputDevice; 1268 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1269 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("inputDevice"))) { 1270 InputDeviceType _value = InputDeviceType::read(_child); 1271 inputDevice.push_back(std::move(_value)); 1272 } 1273 } 1274 InputDevicesType instance(inputDevice); 1275 return instance; 1276 } 1277 InputDeviceType(std::optional<std::string> address,std::optional<InDeviceType> type)1278 InputDeviceType::InputDeviceType(std::optional<std::string> address, std::optional<InDeviceType> type) : address_(std::move(address)), type_(type) { 1279 } 1280 getAddress() const1281 const std::string& InputDeviceType::getAddress() const { 1282 _xsdc_assert(hasAddress()); 1283 return address_.value(); 1284 } 1285 hasAddress() const1286 bool InputDeviceType::hasAddress() const { 1287 return address_.has_value(); 1288 } 1289 getType() const1290 const InDeviceType& InputDeviceType::getType() const { 1291 _xsdc_assert(hasType()); 1292 return type_.value(); 1293 } 1294 hasType() const1295 bool InputDeviceType::hasType() const { 1296 return type_.has_value(); 1297 } 1298 read(xmlNode * root)1299 InputDeviceType InputDeviceType::read(xmlNode *root) { 1300 std::string _raw; 1301 _raw = getXmlAttribute(root, "address"); 1302 std::optional<std::string> address = std::nullopt; 1303 if (_raw != "") { 1304 std::string &_value = _raw; 1305 address = _value; 1306 } 1307 _raw = getXmlAttribute(root, "type"); 1308 std::optional<InDeviceType> type = std::nullopt; 1309 if (_raw != "") { 1310 InDeviceType _value = stringToInDeviceType(_raw); 1311 type = _value; 1312 } 1313 InputDeviceType instance(address, type); 1314 return instance; 1315 } 1316 } // audiocontrol 1317 } // automotive 1318 } // hardware 1319 } // android 1320