JSRetainPtr<JSStringRef> AccessibilityUIElement::allAttributes() { if (!m_element || !ATK_IS_OBJECT(m_element.get())) return JSStringCreateWithCharacters(0, 0); GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element.get())))); return JSStringCreateWithUTF8CString(attributeData.get()); }
gchar* attributeSetToString(AtkAttributeSet* attributeSet) { GString* str = g_string_new(0); for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) { AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL)); g_string_append(str, attributeData.get()); if (attributes->next) g_string_append(str, ", "); } return g_string_free(str, FALSE); }
void EC_DynamicComponent::DeserializeFromBinary(kNet::DataDeserializer& source, AttributeChange::Type change) { u8 num_attributes = source.Read<u8>(); std::vector<DeserializeData> deserializedAttributes; for (uint i = 0; i < num_attributes; ++i) { std::string name = source.ReadString(); std::string type = source.ReadString(); std::string value = source.ReadString(); DeserializeData attributeData(name, type, value); deserializedAttributes.push_back(attributeData); } DeserializeCommon(deserializedAttributes, change); }
static String getAtkAttributeSetAsString(AtkObject* accessible) { StringBuilder builder; AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible); for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL)); builder.append(attributeData.get()); if (attributes->next) builder.append(", "); } atk_attribute_set_free(attributeSet); return builder.toString(); }
void EC_DynamicComponent::DeserializeFrom(QDomElement& element, AttributeChange::Type change) { if (!BeginDeserialization(element)) return; std::vector<DeserializeData> deserializedAttributes; QDomElement child = element.firstChildElement("attribute"); while(!child.isNull()) { QString name = child.attribute("name"); QString type = child.attribute("type"); QString value = child.attribute("value"); DeserializeData attributeData(name.toStdString(), type.toStdString(), value.toStdString()); deserializedAttributes.push_back(attributeData); child = child.nextSiblingElement("attribute"); } DeserializeCommon(deserializedAttributes, change); }
void EC_DynamicComponent::DeserializeFrom(QDomElement& element, AttributeChange::Type change) { if (!BeginDeserialization(element)) return; std::vector<DeserializeData> deserializedAttributes; QDomElement child = element.firstChildElement("attribute"); while(!child.isNull()) { QString id = child.attribute("id"); // Fallback if ID is not defined if (!id.length()) id = child.attribute("name"); QString type = child.attribute("type"); QString value = child.attribute("value"); DeserializeData attributeData(id, type, value); deserializedAttributes.push_back(attributeData); child = child.nextSiblingElement("attribute"); } DeserializeCommon(deserializedAttributes, change); }