+void Accessible::UpdateAttributes(Attributes& attributes) const
+{
+ using MapType = std::map<ReadingInfoType, std::string_view>;
+
+ static const std::string readingInfoTypeKey = "reading_info_type";
+ static const char separator = '|';
+ static const MapType readingInfoTypeMap{
+ {ReadingInfoType::NAME, "name"},
+ {ReadingInfoType::ROLE, "role"},
+ {ReadingInfoType::DESCRIPTION, "description"},
+ {ReadingInfoType::STATE, "state"},
+ };
+
+ bool allEnabled = mReadingInfoTypes[ReadingInfoType::NAME]
+ && mReadingInfoTypes[ReadingInfoType::ROLE]
+ && mReadingInfoTypes[ReadingInfoType::DESCRIPTION]
+ && mReadingInfoTypes[ReadingInfoType::STATE];
+
+ if(DALI_LIKELY(allEnabled))
+ {
+ attributes.erase(readingInfoTypeKey);
+ return;
+ }
+
+ std::stringstream buf;
+ for(auto& item : readingInfoTypeMap)
+ {
+ if(mReadingInfoTypes[item.first])
+ {
+ if(buf.tellp()) // non-empty
+ {
+ buf << separator;
+ }
+
+ buf << item.second;
+ }
+ }
+
+ attributes.insert_or_assign(readingInfoTypeKey, buf.str());
+}
+
+const Attributes& Accessible::GetAttributes() const
+{
+ UpdateAttributes(mAttributes);
+
+ return mAttributes;
+}
+
+bool Accessible::SetAttribute(const std::string& key, const std::string& value)
+{
+ return mAttributes.insert_or_assign(key, value).second;
+}
+
+bool Accessible::UnsetAttribute(const std::string& key)
+{
+ return (mAttributes.erase(key) > 0);
+}
+
+void Accessible::ClearAttributes()
+{
+ mAttributes.clear();
+}
+
+ReadingInfoTypes Accessible::GetReadingInfoTypes() const
+{
+ return mReadingInfoTypes;
+}
+
+void Accessible::SetReadingInfoTypes(ReadingInfoTypes types)
+{
+ mReadingInfoTypes = types;
+}
+