1 #define LOG_TAG "android.hardware.automotive.audiocontrol.fade"
2 #include "android_hardware_automotive_audiocontrol_fade.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                 namespace fade {
15                     template <class T>
16                     constexpr void (*xmlDeleter)(T* t);
17                     template <>
18                     constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc;
19                     template <>
__anon520f72100102(xmlChar *s) 20                     auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); };
21 
22                     template <class T>
make_xmlUnique(T * t)23                     constexpr auto make_xmlUnique(T *t) {
24                         auto deleter = [](T *t) { xmlDeleter<T>(t); };
25                         return std::unique_ptr<T, decltype(deleter)>{t, deleter};
26                     }
27 
getXmlAttribute(const xmlNode * cur,const char * attribute)28                     static std::string getXmlAttribute(const xmlNode *cur, const char *attribute) {
29                         auto xmlValue = make_xmlUnique(xmlGetProp(cur, reinterpret_cast<const xmlChar*>(attribute)));
30                         if (xmlValue == nullptr) {
31                             return "";
32                         }
33                         std::string value(reinterpret_cast<const char*>(xmlValue.get()));
34                         return value;
35                     }
36 
read(const char * configFile)37                     std::optional<CarAudioFadeConfigurationType> read(const char* configFile) {
38                         auto doc = make_xmlUnique(xmlParseFile(configFile));
39                         if (doc == nullptr) {
40                             return std::nullopt;
41                         }
42                         xmlNodePtr _child = xmlDocGetRootElement(doc.get());
43                         if (_child == nullptr) {
44                             return std::nullopt;
45                         }
46                         if (xmlXIncludeProcess(doc.get()) < 0) {
47                             return std::nullopt;
48                         }
49 
50                         if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("carAudioFadeConfiguration"))) {
51                             CarAudioFadeConfigurationType _value = CarAudioFadeConfigurationType::read(_child);
52                             return _value;
53                         }
54                         return std::nullopt;
55                     }
56 
parse(const char * xml)57                     std::optional<CarAudioFadeConfigurationType> parse(const char* xml) {
58                         auto doc = make_xmlUnique(xmlParseDoc(reinterpret_cast<const xmlChar*>(xml)));
59                         if (doc == nullptr) {
60                             return std::nullopt;
61                         }
62                         xmlNodePtr _child = xmlDocGetRootElement(doc.get());
63                         if (_child == nullptr) {
64                             return std::nullopt;
65                         }
66                         if (xmlXIncludeProcess(doc.get()) < 0) {
67                             return std::nullopt;
68                         }
69 
70                         if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("carAudioFadeConfiguration"))) {
71                             CarAudioFadeConfigurationType _value = CarAudioFadeConfigurationType::read(_child);
72                             return _value;
73                         }
74                         return std::nullopt;
75                     }
76 
77 
CarAudioFadeConfigurationType(std::vector<FadeConfigurationConfigs> configs)78                     CarAudioFadeConfigurationType::CarAudioFadeConfigurationType(std::vector<FadeConfigurationConfigs> configs) : configs_(std::move(configs)) {
79                     }
80 
getConfigs() const81                     const std::vector<FadeConfigurationConfigs>& CarAudioFadeConfigurationType::getConfigs() const {
82                         return configs_;
83                     }
84 
hasConfigs() const85                     bool CarAudioFadeConfigurationType::hasConfigs() const {
86                         return !(configs_.empty());
87                     }
88 
getFirstConfigs() const89                     const FadeConfigurationConfigs* CarAudioFadeConfigurationType::getFirstConfigs() const {
90                         if (configs_.empty()) {
91                             return nullptr;
92                         }
93                         return &configs_[0];
94                     }
95 
read(xmlNode * root)96                     CarAudioFadeConfigurationType CarAudioFadeConfigurationType::read(xmlNode *root) {
97                         std::string _raw;
98                         std::vector<FadeConfigurationConfigs> configs;
99                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
100                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("configs"))) {
101                                 FadeConfigurationConfigs _value = FadeConfigurationConfigs::read(_child);
102                                 configs.push_back(std::move(_value));
103                             }
104                         }
105                         CarAudioFadeConfigurationType instance(configs);
106                         return instance;
107                     }
108 
FadeConfigurationConfigs(std::vector<FadeConfigurationConfig> config)109                     FadeConfigurationConfigs::FadeConfigurationConfigs(std::vector<FadeConfigurationConfig> config) : config_(std::move(config)) {
110                     }
111 
getConfig() const112                     const std::vector<FadeConfigurationConfig>& FadeConfigurationConfigs::getConfig() const {
113                         return config_;
114                     }
115 
hasConfig() const116                     bool FadeConfigurationConfigs::hasConfig() const {
117                         return !(config_.empty());
118                     }
119 
getFirstConfig() const120                     const FadeConfigurationConfig* FadeConfigurationConfigs::getFirstConfig() const {
121                         if (config_.empty()) {
122                             return nullptr;
123                         }
124                         return &config_[0];
125                     }
126 
read(xmlNode * root)127                     FadeConfigurationConfigs FadeConfigurationConfigs::read(xmlNode *root) {
128                         std::string _raw;
129                         std::vector<FadeConfigurationConfig> config;
130                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
131                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("config"))) {
132                                 FadeConfigurationConfig _value = FadeConfigurationConfig::read(_child);
133                                 config.push_back(std::move(_value));
134                             }
135                         }
136                         FadeConfigurationConfigs instance(config);
137                         return instance;
138                     }
139 
FadeConfigurationConfig(std::vector<FadeStateType> fadeState,std::vector<FadeableUsagesType> fadeableUsages,std::vector<UnfadeableContentTypesType> unfadeableContentTypes,std::vector<UnfadeableAudioAttributesType> unfadeableAudioAttributes,std::vector<FadeOutConfigurationsType> fadeOutConfigurations,std::vector<FadeInConfigurationsType> fadeInConfigurations,std::optional<std::string> name,std::optional<std::string> defaultFadeOutDurationInMillis,std::optional<std::string> defaultFadeInDurationInMillis,std::optional<std::string> defaultFadeInDelayForOffenders)140                     FadeConfigurationConfig::FadeConfigurationConfig(std::vector<FadeStateType> fadeState, std::vector<FadeableUsagesType> fadeableUsages, std::vector<UnfadeableContentTypesType> unfadeableContentTypes, std::vector<UnfadeableAudioAttributesType> unfadeableAudioAttributes, std::vector<FadeOutConfigurationsType> fadeOutConfigurations, std::vector<FadeInConfigurationsType> fadeInConfigurations, std::optional<std::string> name, std::optional<std::string> defaultFadeOutDurationInMillis, std::optional<std::string> defaultFadeInDurationInMillis, std::optional<std::string> defaultFadeInDelayForOffenders) : fadeState_(std::move(fadeState)), fadeableUsages_(std::move(fadeableUsages)), unfadeableContentTypes_(std::move(unfadeableContentTypes)), unfadeableAudioAttributes_(std::move(unfadeableAudioAttributes)), fadeOutConfigurations_(std::move(fadeOutConfigurations)), fadeInConfigurations_(std::move(fadeInConfigurations)), name_(std::move(name)), defaultFadeOutDurationInMillis_(std::move(defaultFadeOutDurationInMillis)), defaultFadeInDurationInMillis_(std::move(defaultFadeInDurationInMillis)), defaultFadeInDelayForOffenders_(std::move(defaultFadeInDelayForOffenders)) {
141                     }
142 
getFadeState() const143                     const std::vector<FadeStateType>& FadeConfigurationConfig::getFadeState() const {
144                         return fadeState_;
145                     }
146 
hasFadeState() const147                     bool FadeConfigurationConfig::hasFadeState() const {
148                         return !(fadeState_.empty());
149                     }
150 
getFirstFadeState() const151                     const FadeStateType* FadeConfigurationConfig::getFirstFadeState() const {
152                         if (fadeState_.empty()) {
153                             return nullptr;
154                         }
155                         return &fadeState_[0];
156                     }
157 
getFadeableUsages() const158                     const std::vector<FadeableUsagesType>& FadeConfigurationConfig::getFadeableUsages() const {
159                         return fadeableUsages_;
160                     }
161 
hasFadeableUsages() const162                     bool FadeConfigurationConfig::hasFadeableUsages() const {
163                         return !(fadeableUsages_.empty());
164                     }
165 
getFirstFadeableUsages() const166                     const FadeableUsagesType* FadeConfigurationConfig::getFirstFadeableUsages() const {
167                         if (fadeableUsages_.empty()) {
168                             return nullptr;
169                         }
170                         return &fadeableUsages_[0];
171                     }
172 
getUnfadeableContentTypes() const173                     const std::vector<UnfadeableContentTypesType>& FadeConfigurationConfig::getUnfadeableContentTypes() const {
174                         return unfadeableContentTypes_;
175                     }
176 
hasUnfadeableContentTypes() const177                     bool FadeConfigurationConfig::hasUnfadeableContentTypes() const {
178                         return !(unfadeableContentTypes_.empty());
179                     }
180 
getFirstUnfadeableContentTypes() const181                     const UnfadeableContentTypesType* FadeConfigurationConfig::getFirstUnfadeableContentTypes() const {
182                         if (unfadeableContentTypes_.empty()) {
183                             return nullptr;
184                         }
185                         return &unfadeableContentTypes_[0];
186                     }
187 
getUnfadeableAudioAttributes() const188                     const std::vector<UnfadeableAudioAttributesType>& FadeConfigurationConfig::getUnfadeableAudioAttributes() const {
189                         return unfadeableAudioAttributes_;
190                     }
191 
hasUnfadeableAudioAttributes() const192                     bool FadeConfigurationConfig::hasUnfadeableAudioAttributes() const {
193                         return !(unfadeableAudioAttributes_.empty());
194                     }
195 
getFirstUnfadeableAudioAttributes() const196                     const UnfadeableAudioAttributesType* FadeConfigurationConfig::getFirstUnfadeableAudioAttributes() const {
197                         if (unfadeableAudioAttributes_.empty()) {
198                             return nullptr;
199                         }
200                         return &unfadeableAudioAttributes_[0];
201                     }
202 
getFadeOutConfigurations() const203                     const std::vector<FadeOutConfigurationsType>& FadeConfigurationConfig::getFadeOutConfigurations() const {
204                         return fadeOutConfigurations_;
205                     }
206 
hasFadeOutConfigurations() const207                     bool FadeConfigurationConfig::hasFadeOutConfigurations() const {
208                         return !(fadeOutConfigurations_.empty());
209                     }
210 
getFirstFadeOutConfigurations() const211                     const FadeOutConfigurationsType* FadeConfigurationConfig::getFirstFadeOutConfigurations() const {
212                         if (fadeOutConfigurations_.empty()) {
213                             return nullptr;
214                         }
215                         return &fadeOutConfigurations_[0];
216                     }
217 
getFadeInConfigurations() const218                     const std::vector<FadeInConfigurationsType>& FadeConfigurationConfig::getFadeInConfigurations() const {
219                         return fadeInConfigurations_;
220                     }
221 
hasFadeInConfigurations() const222                     bool FadeConfigurationConfig::hasFadeInConfigurations() const {
223                         return !(fadeInConfigurations_.empty());
224                     }
225 
getFirstFadeInConfigurations() const226                     const FadeInConfigurationsType* FadeConfigurationConfig::getFirstFadeInConfigurations() const {
227                         if (fadeInConfigurations_.empty()) {
228                             return nullptr;
229                         }
230                         return &fadeInConfigurations_[0];
231                     }
232 
getName() const233                     const std::string& FadeConfigurationConfig::getName() const {
234                         _xsdc_assert(hasName());
235                         return name_.value();
236                     }
237 
hasName() const238                     bool FadeConfigurationConfig::hasName() const {
239                         return name_.has_value();
240                     }
241 
getDefaultFadeOutDurationInMillis() const242                     const std::string& FadeConfigurationConfig::getDefaultFadeOutDurationInMillis() const {
243                         _xsdc_assert(hasDefaultFadeOutDurationInMillis());
244                         return defaultFadeOutDurationInMillis_.value();
245                     }
246 
hasDefaultFadeOutDurationInMillis() const247                     bool FadeConfigurationConfig::hasDefaultFadeOutDurationInMillis() const {
248                         return defaultFadeOutDurationInMillis_.has_value();
249                     }
250 
getDefaultFadeInDurationInMillis() const251                     const std::string& FadeConfigurationConfig::getDefaultFadeInDurationInMillis() const {
252                         _xsdc_assert(hasDefaultFadeInDurationInMillis());
253                         return defaultFadeInDurationInMillis_.value();
254                     }
255 
hasDefaultFadeInDurationInMillis() const256                     bool FadeConfigurationConfig::hasDefaultFadeInDurationInMillis() const {
257                         return defaultFadeInDurationInMillis_.has_value();
258                     }
259 
getDefaultFadeInDelayForOffenders() const260                     const std::string& FadeConfigurationConfig::getDefaultFadeInDelayForOffenders() const {
261                         _xsdc_assert(hasDefaultFadeInDelayForOffenders());
262                         return defaultFadeInDelayForOffenders_.value();
263                     }
264 
hasDefaultFadeInDelayForOffenders() const265                     bool FadeConfigurationConfig::hasDefaultFadeInDelayForOffenders() const {
266                         return defaultFadeInDelayForOffenders_.has_value();
267                     }
268 
read(xmlNode * root)269                     FadeConfigurationConfig FadeConfigurationConfig::read(xmlNode *root) {
270                         std::string _raw;
271                         _raw = getXmlAttribute(root, "name");
272                         std::optional<std::string> name = std::nullopt;
273                         if (_raw != "") {
274                             std::string &_value = _raw;
275                             name = _value;
276                         }
277                         _raw = getXmlAttribute(root, "defaultFadeOutDurationInMillis");
278                         std::optional<std::string> defaultFadeOutDurationInMillis = std::nullopt;
279                         if (_raw != "") {
280                             std::string &_value = _raw;
281                             defaultFadeOutDurationInMillis = _value;
282                         }
283                         _raw = getXmlAttribute(root, "defaultFadeInDurationInMillis");
284                         std::optional<std::string> defaultFadeInDurationInMillis = std::nullopt;
285                         if (_raw != "") {
286                             std::string &_value = _raw;
287                             defaultFadeInDurationInMillis = _value;
288                         }
289                         _raw = getXmlAttribute(root, "defaultFadeInDelayForOffenders");
290                         std::optional<std::string> defaultFadeInDelayForOffenders = std::nullopt;
291                         if (_raw != "") {
292                             std::string &_value = _raw;
293                             defaultFadeInDelayForOffenders = _value;
294                         }
295                         std::vector<FadeStateType> fadeState;
296                         std::vector<FadeableUsagesType> fadeableUsages;
297                         std::vector<UnfadeableContentTypesType> unfadeableContentTypes;
298                         std::vector<UnfadeableAudioAttributesType> unfadeableAudioAttributes;
299                         std::vector<FadeOutConfigurationsType> fadeOutConfigurations;
300                         std::vector<FadeInConfigurationsType> fadeInConfigurations;
301                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
302                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeState"))) {
303                                 FadeStateType _value = FadeStateType::read(_child);
304                                 fadeState.push_back(std::move(_value));
305                             } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeableUsages"))) {
306                                 FadeableUsagesType _value = FadeableUsagesType::read(_child);
307                                 fadeableUsages.push_back(std::move(_value));
308                             } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("unfadeableContentTypes"))) {
309                                 UnfadeableContentTypesType _value = UnfadeableContentTypesType::read(_child);
310                                 unfadeableContentTypes.push_back(std::move(_value));
311                             } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("unfadeableAudioAttributes"))) {
312                                 UnfadeableAudioAttributesType _value = UnfadeableAudioAttributesType::read(_child);
313                                 unfadeableAudioAttributes.push_back(std::move(_value));
314                             } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeOutConfigurations"))) {
315                                 FadeOutConfigurationsType _value = FadeOutConfigurationsType::read(_child);
316                                 fadeOutConfigurations.push_back(std::move(_value));
317                             } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeInConfigurations"))) {
318                                 FadeInConfigurationsType _value = FadeInConfigurationsType::read(_child);
319                                 fadeInConfigurations.push_back(std::move(_value));
320                             }
321                         }
322                         FadeConfigurationConfig instance(fadeState, fadeableUsages, unfadeableContentTypes, unfadeableAudioAttributes, fadeOutConfigurations, fadeInConfigurations, name, defaultFadeOutDurationInMillis, defaultFadeInDurationInMillis, defaultFadeInDelayForOffenders);
323                         return instance;
324                     }
325 
FadeStateType(std::optional<FadeStateEnumType> value)326                     FadeStateType::FadeStateType(std::optional<FadeStateEnumType> value) : value_(value) {
327                     }
328 
getValue() const329                     const FadeStateEnumType& FadeStateType::getValue() const {
330                         _xsdc_assert(hasValue());
331                         return value_.value();
332                     }
333 
hasValue() const334                     bool FadeStateType::hasValue() const {
335                         return value_.has_value();
336                     }
337 
read(xmlNode * root)338                     FadeStateType FadeStateType::read(xmlNode *root) {
339                         std::string _raw;
340                         _raw = getXmlAttribute(root, "value");
341                         std::optional<FadeStateEnumType> value = std::nullopt;
342                         if (_raw != "") {
343                             FadeStateEnumType _value = stringToFadeStateEnumType(_raw);
344                             value = _value;
345                         }
346                         FadeStateType instance(value);
347                         return instance;
348                     }
349 
FadeableUsagesType(std::vector<UsageType> usage)350                     FadeableUsagesType::FadeableUsagesType(std::vector<UsageType> usage) : usage_(std::move(usage)) {
351                     }
352 
getUsage() const353                     const std::vector<UsageType>& FadeableUsagesType::getUsage() const {
354                         return usage_;
355                     }
356 
hasUsage() const357                     bool FadeableUsagesType::hasUsage() const {
358                         return !(usage_.empty());
359                     }
360 
getFirstUsage() const361                     const UsageType* FadeableUsagesType::getFirstUsage() const {
362                         if (usage_.empty()) {
363                             return nullptr;
364                         }
365                         return &usage_[0];
366                     }
367 
read(xmlNode * root)368                     FadeableUsagesType FadeableUsagesType::read(xmlNode *root) {
369                         std::string _raw;
370                         std::vector<UsageType> usage;
371                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
372                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("usage"))) {
373                                 UsageType _value = UsageType::read(_child);
374                                 usage.push_back(std::move(_value));
375                             }
376                         }
377                         FadeableUsagesType instance(usage);
378                         return instance;
379                     }
380 
UsageType(std::optional<UsageEnumType> value)381                     UsageType::UsageType(std::optional<UsageEnumType> value) : value_(value) {
382                     }
383 
getValue() const384                     const UsageEnumType& UsageType::getValue() const {
385                         _xsdc_assert(hasValue());
386                         return value_.value();
387                     }
388 
hasValue() const389                     bool UsageType::hasValue() const {
390                         return value_.has_value();
391                     }
392 
read(xmlNode * root)393                     UsageType UsageType::read(xmlNode *root) {
394                         std::string _raw;
395                         _raw = getXmlAttribute(root, "value");
396                         std::optional<UsageEnumType> value = std::nullopt;
397                         if (_raw != "") {
398                             UsageEnumType _value = stringToUsageEnumType(_raw);
399                             value = _value;
400                         }
401                         UsageType instance(value);
402                         return instance;
403                     }
404 
UnfadeableContentTypesType(std::vector<ContentType> contentType)405                     UnfadeableContentTypesType::UnfadeableContentTypesType(std::vector<ContentType> contentType) : contentType_(std::move(contentType)) {
406                     }
407 
getContentType() const408                     const std::vector<ContentType>& UnfadeableContentTypesType::getContentType() const {
409                         return contentType_;
410                     }
411 
hasContentType() const412                     bool UnfadeableContentTypesType::hasContentType() const {
413                         return !(contentType_.empty());
414                     }
415 
getFirstContentType() const416                     const ContentType* UnfadeableContentTypesType::getFirstContentType() const {
417                         if (contentType_.empty()) {
418                             return nullptr;
419                         }
420                         return &contentType_[0];
421                     }
422 
read(xmlNode * root)423                     UnfadeableContentTypesType UnfadeableContentTypesType::read(xmlNode *root) {
424                         std::string _raw;
425                         std::vector<ContentType> contentType;
426                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
427                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("contentType"))) {
428                                 ContentType _value = ContentType::read(_child);
429                                 contentType.push_back(std::move(_value));
430                             }
431                         }
432                         UnfadeableContentTypesType instance(contentType);
433                         return instance;
434                     }
435 
ContentType(std::optional<ContentTypeEnum> value)436                     ContentType::ContentType(std::optional<ContentTypeEnum> value) : value_(value) {
437                     }
438 
getValue() const439                     const ContentTypeEnum& ContentType::getValue() const {
440                         _xsdc_assert(hasValue());
441                         return value_.value();
442                     }
443 
hasValue() const444                     bool ContentType::hasValue() const {
445                         return value_.has_value();
446                     }
447 
read(xmlNode * root)448                     ContentType ContentType::read(xmlNode *root) {
449                         std::string _raw;
450                         _raw = getXmlAttribute(root, "value");
451                         std::optional<ContentTypeEnum> value = std::nullopt;
452                         if (_raw != "") {
453                             ContentTypeEnum _value = stringToContentTypeEnum(_raw);
454                             value = _value;
455                         }
456                         ContentType instance(value);
457                         return instance;
458                     }
459 
UnfadeableAudioAttributesType(std::vector<AudioAttributesUsagesType> audioAttributes)460                     UnfadeableAudioAttributesType::UnfadeableAudioAttributesType(std::vector<AudioAttributesUsagesType> audioAttributes) : audioAttributes_(std::move(audioAttributes)) {
461                     }
462 
getAudioAttributes() const463                     const std::vector<AudioAttributesUsagesType>& UnfadeableAudioAttributesType::getAudioAttributes() const {
464                         return audioAttributes_;
465                     }
466 
hasAudioAttributes() const467                     bool UnfadeableAudioAttributesType::hasAudioAttributes() const {
468                         return !(audioAttributes_.empty());
469                     }
470 
getFirstAudioAttributes() const471                     const AudioAttributesUsagesType* UnfadeableAudioAttributesType::getFirstAudioAttributes() const {
472                         if (audioAttributes_.empty()) {
473                             return nullptr;
474                         }
475                         return &audioAttributes_[0];
476                     }
477 
read(xmlNode * root)478                     UnfadeableAudioAttributesType UnfadeableAudioAttributesType::read(xmlNode *root) {
479                         std::string _raw;
480                         std::vector<AudioAttributesUsagesType> audioAttributes;
481                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
482                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("audioAttributes"))) {
483                                 AudioAttributesUsagesType _value = AudioAttributesUsagesType::read(_child);
484                                 audioAttributes.push_back(std::move(_value));
485                             }
486                         }
487                         UnfadeableAudioAttributesType instance(audioAttributes);
488                         return instance;
489                     }
490 
AudioAttributesUsagesType(std::vector<AttributesType> audioAttribute_optional,std::vector<UsageType> usage_optional)491                     AudioAttributesUsagesType::AudioAttributesUsagesType(std::vector<AttributesType> audioAttribute_optional, std::vector<UsageType> usage_optional) : audioAttribute_optional_(std::move(audioAttribute_optional)), usage_optional_(std::move(usage_optional)) {
492                     }
493 
getAudioAttribute_optional() const494                     const std::vector<AttributesType>& AudioAttributesUsagesType::getAudioAttribute_optional() const {
495                         return audioAttribute_optional_;
496                     }
497 
hasAudioAttribute_optional() const498                     bool AudioAttributesUsagesType::hasAudioAttribute_optional() const {
499                         return !(audioAttribute_optional_.empty());
500                     }
501 
getFirstAudioAttribute_optional() const502                     const AttributesType* AudioAttributesUsagesType::getFirstAudioAttribute_optional() const {
503                         if (audioAttribute_optional_.empty()) {
504                             return nullptr;
505                         }
506                         return &audioAttribute_optional_[0];
507                     }
508 
getUsage_optional() const509                     const std::vector<UsageType>& AudioAttributesUsagesType::getUsage_optional() const {
510                         return usage_optional_;
511                     }
512 
hasUsage_optional() const513                     bool AudioAttributesUsagesType::hasUsage_optional() const {
514                         return !(usage_optional_.empty());
515                     }
516 
getFirstUsage_optional() const517                     const UsageType* AudioAttributesUsagesType::getFirstUsage_optional() const {
518                         if (usage_optional_.empty()) {
519                             return nullptr;
520                         }
521                         return &usage_optional_[0];
522                     }
523 
read(xmlNode * root)524                     AudioAttributesUsagesType AudioAttributesUsagesType::read(xmlNode *root) {
525                         std::string _raw;
526                         std::vector<AttributesType> audioAttribute_optional;
527                         std::vector<UsageType> usage_optional;
528                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
529                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("audioAttribute"))) {
530                                 AttributesType _value = AttributesType::read(_child);
531                                 audioAttribute_optional.push_back(std::move(_value));
532                             } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("usage"))) {
533                                 UsageType _value = UsageType::read(_child);
534                                 usage_optional.push_back(std::move(_value));
535                             }
536                         }
537                         AudioAttributesUsagesType instance(audioAttribute_optional, usage_optional);
538                         return instance;
539                     }
540 
AttributesType(std::optional<ContentTypeEnum> contentType,std::optional<UsageEnumType> usage,std::optional<std::string> tags)541                     AttributesType::AttributesType(std::optional<ContentTypeEnum> contentType, std::optional<UsageEnumType> usage, std::optional<std::string> tags) : contentType_(contentType), usage_(usage), tags_(std::move(tags)) {
542                     }
543 
getContentType() const544                     const ContentTypeEnum& AttributesType::getContentType() const {
545                         _xsdc_assert(hasContentType());
546                         return contentType_.value();
547                     }
548 
hasContentType() const549                     bool AttributesType::hasContentType() const {
550                         return contentType_.has_value();
551                     }
552 
getUsage() const553                     const UsageEnumType& AttributesType::getUsage() const {
554                         _xsdc_assert(hasUsage());
555                         return usage_.value();
556                     }
557 
hasUsage() const558                     bool AttributesType::hasUsage() const {
559                         return usage_.has_value();
560                     }
561 
getTags() const562                     const std::string& AttributesType::getTags() const {
563                         _xsdc_assert(hasTags());
564                         return tags_.value();
565                     }
566 
hasTags() const567                     bool AttributesType::hasTags() const {
568                         return tags_.has_value();
569                     }
570 
read(xmlNode * root)571                     AttributesType AttributesType::read(xmlNode *root) {
572                         std::string _raw;
573                         _raw = getXmlAttribute(root, "contentType");
574                         std::optional<ContentTypeEnum> contentType = std::nullopt;
575                         if (_raw != "") {
576                             ContentTypeEnum _value = stringToContentTypeEnum(_raw);
577                             contentType = _value;
578                         }
579                         _raw = getXmlAttribute(root, "usage");
580                         std::optional<UsageEnumType> usage = std::nullopt;
581                         if (_raw != "") {
582                             UsageEnumType _value = stringToUsageEnumType(_raw);
583                             usage = _value;
584                         }
585                         _raw = getXmlAttribute(root, "tags");
586                         std::optional<std::string> tags = std::nullopt;
587                         if (_raw != "") {
588                             std::string &_value = _raw;
589                             tags = _value;
590                         }
591                         AttributesType instance(contentType, usage, tags);
592                         return instance;
593                     }
594 
FadeOutConfigurationsType(std::vector<FadeConfigurationType> fadeConfiguration)595                     FadeOutConfigurationsType::FadeOutConfigurationsType(std::vector<FadeConfigurationType> fadeConfiguration) : fadeConfiguration_(std::move(fadeConfiguration)) {
596                     }
597 
getFadeConfiguration() const598                     const std::vector<FadeConfigurationType>& FadeOutConfigurationsType::getFadeConfiguration() const {
599                         return fadeConfiguration_;
600                     }
601 
hasFadeConfiguration() const602                     bool FadeOutConfigurationsType::hasFadeConfiguration() const {
603                         return !(fadeConfiguration_.empty());
604                     }
605 
getFirstFadeConfiguration() const606                     const FadeConfigurationType* FadeOutConfigurationsType::getFirstFadeConfiguration() const {
607                         if (fadeConfiguration_.empty()) {
608                             return nullptr;
609                         }
610                         return &fadeConfiguration_[0];
611                     }
612 
read(xmlNode * root)613                     FadeOutConfigurationsType FadeOutConfigurationsType::read(xmlNode *root) {
614                         std::string _raw;
615                         std::vector<FadeConfigurationType> fadeConfiguration;
616                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
617                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeConfiguration"))) {
618                                 FadeConfigurationType _value = FadeConfigurationType::read(_child);
619                                 fadeConfiguration.push_back(std::move(_value));
620                             }
621                         }
622                         FadeOutConfigurationsType instance(fadeConfiguration);
623                         return instance;
624                     }
625 
FadeConfigurationType(std::vector<AudioAttributesUsagesType> audioAttributes,std::optional<std::string> fadeDurationMillis)626                     FadeConfigurationType::FadeConfigurationType(std::vector<AudioAttributesUsagesType> audioAttributes, std::optional<std::string> fadeDurationMillis) : audioAttributes_(std::move(audioAttributes)), fadeDurationMillis_(std::move(fadeDurationMillis)) {
627                     }
628 
getAudioAttributes() const629                     const std::vector<AudioAttributesUsagesType>& FadeConfigurationType::getAudioAttributes() const {
630                         return audioAttributes_;
631                     }
632 
hasAudioAttributes() const633                     bool FadeConfigurationType::hasAudioAttributes() const {
634                         return !(audioAttributes_.empty());
635                     }
636 
getFirstAudioAttributes() const637                     const AudioAttributesUsagesType* FadeConfigurationType::getFirstAudioAttributes() const {
638                         if (audioAttributes_.empty()) {
639                             return nullptr;
640                         }
641                         return &audioAttributes_[0];
642                     }
643 
getFadeDurationMillis() const644                     const std::string& FadeConfigurationType::getFadeDurationMillis() const {
645                         _xsdc_assert(hasFadeDurationMillis());
646                         return fadeDurationMillis_.value();
647                     }
648 
hasFadeDurationMillis() const649                     bool FadeConfigurationType::hasFadeDurationMillis() const {
650                         return fadeDurationMillis_.has_value();
651                     }
652 
read(xmlNode * root)653                     FadeConfigurationType FadeConfigurationType::read(xmlNode *root) {
654                         std::string _raw;
655                         _raw = getXmlAttribute(root, "fadeDurationMillis");
656                         std::optional<std::string> fadeDurationMillis = std::nullopt;
657                         if (_raw != "") {
658                             std::string &_value = _raw;
659                             fadeDurationMillis = _value;
660                         }
661                         std::vector<AudioAttributesUsagesType> audioAttributes;
662                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
663                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("audioAttributes"))) {
664                                 AudioAttributesUsagesType _value = AudioAttributesUsagesType::read(_child);
665                                 audioAttributes.push_back(std::move(_value));
666                             }
667                         }
668                         FadeConfigurationType instance(audioAttributes, fadeDurationMillis);
669                         return instance;
670                     }
671 
FadeInConfigurationsType(std::vector<FadeConfigurationType> fadeConfiguration)672                     FadeInConfigurationsType::FadeInConfigurationsType(std::vector<FadeConfigurationType> fadeConfiguration) : fadeConfiguration_(std::move(fadeConfiguration)) {
673                     }
674 
getFadeConfiguration() const675                     const std::vector<FadeConfigurationType>& FadeInConfigurationsType::getFadeConfiguration() const {
676                         return fadeConfiguration_;
677                     }
678 
hasFadeConfiguration() const679                     bool FadeInConfigurationsType::hasFadeConfiguration() const {
680                         return !(fadeConfiguration_.empty());
681                     }
682 
getFirstFadeConfiguration() const683                     const FadeConfigurationType* FadeInConfigurationsType::getFirstFadeConfiguration() const {
684                         if (fadeConfiguration_.empty()) {
685                             return nullptr;
686                         }
687                         return &fadeConfiguration_[0];
688                     }
689 
read(xmlNode * root)690                     FadeInConfigurationsType FadeInConfigurationsType::read(xmlNode *root) {
691                         std::string _raw;
692                         std::vector<FadeConfigurationType> fadeConfiguration;
693                         for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) {
694                             if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("fadeConfiguration"))) {
695                                 FadeConfigurationType _value = FadeConfigurationType::read(_child);
696                                 fadeConfiguration.push_back(std::move(_value));
697                             }
698                         }
699                         FadeInConfigurationsType instance(fadeConfiguration);
700                         return instance;
701                     }
702                 } // fade
703             } // audiocontrol
704         } // automotive
705     } // hardware
706 } // android
707