|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
Stores XML attribute values. More...
#include "donner/base/xml/components/AttributesComponent.h"
Classes | |
| struct | AttributeSourceAnchors |
| Source anchors for one serialized attribute. More... | |
Public Member Functions | |
| AttributesComponent ()=default | |
| Constructor. | |
| AttributesComponent (const AttributesComponent &)=delete | |
| AttributesComponent & | operator= (const AttributesComponent &)=delete |
| AttributesComponent (AttributesComponent &&)=default | |
| Move constructor. | |
| AttributesComponent & | operator= (AttributesComponent &&)=default |
| Move assignment operator. | |
| ~AttributesComponent ()=default | |
| Destructor. | |
| bool | hasAttribute (const xml::XMLQualifiedNameRef &name) const |
| Returns true if the element has an attribute with the given name. | |
| std::optional< RcString > | getAttribute (const xml::XMLQualifiedNameRef &name) const |
| Get the value of an attribute, if it exists. | |
| std::optional< AttributeSourceAnchors > | getAttributeSourceAnchors (const xml::XMLQualifiedNameRef &name) const |
| Get source-anchor metadata for an attribute, if it exists. | |
| std::optional< AttributeSourceAnchors > * | attributeSourceAnchorsSlot (const xml::XMLQualifiedNameRef &name) |
| Return a pointer to an attribute's source-anchor slot. | |
| void | clearAttributeSourceAnchors (const xml::XMLQualifiedNameRef &name) |
| Remove source-anchor metadata for an attribute. | |
| SmallVector< xml::XMLQualifiedNameRef, 10 > | attributes () const |
| Get a list of all attributes. | |
| std::size_t | attributeCount () const |
| Number of attributes retained by this component, without allocating a name list. | |
| SmallVector< xml::XMLQualifiedNameRef, 1 > | findMatchingAttributes (const xml::XMLQualifiedNameRef &matcher) const |
| Find attributes matching the given name matcher. | |
| void | setAttribute (Registry ®istry, const xml::XMLQualifiedNameRef &name, const RcString &value) |
| Set the value of a generic XML attribute, which may be either a presentation attribute or custom user-provided attribute. | |
| void | removeAttribute (Registry ®istry, const xml::XMLQualifiedNameRef &name) |
| Remove an attribute from the element. | |
| bool | hasNamespaceOverrides () const |
| Returns true if the element has any namespace overrides. | |
Stores XML attribute values.
|
inline |
Get a list of all attributes.
|
inline |
Return a pointer to an attribute's source-anchor slot.
For callers that check, read, and then write the anchors of one attribute, which would otherwise look the same attribute up once per step. The returned pointer is invalidated by anything that adds or removes an attribute on this component.
| name | Name of the attribute to query. |
|
inline |
Remove source-anchor metadata for an attribute.
| name | Name of the attribute to clear. |
| SmallVector< xml::XMLQualifiedNameRef, 1 > donner::components::AttributesComponent::findMatchingAttributes | ( | const xml::XMLQualifiedNameRef & | matcher | ) | const |
Find attributes matching the given name matcher.
| matcher | Matcher to use to find attributes. If donner::xml::XMLQualifiedNameRef::namespacePrefix is *, the matcher will match any namespace with the given attribute name. |
|
inline |
Get the value of an attribute, if it exists.
| name | Name of the attribute to get. |
|
inline |
Get source-anchor metadata for an attribute, if it exists.
| name | Name of the attribute to query. |
std::nullopt if unavailable.
|
inline |
Returns true if the element has an attribute with the given name.
| name | Name of the attribute to check. |
| void donner::components::AttributesComponent::removeAttribute | ( | Registry & | registry, |
| const xml::XMLQualifiedNameRef & | name ) |
Remove an attribute from the element.
| registry | Registry to use for the operation. |
| name | Name of the attribute to remove. |
| void donner::components::AttributesComponent::setAttribute | ( | Registry & | registry, |
| const xml::XMLQualifiedNameRef & | name, | ||
| const RcString & | value ) |
Set the value of a generic XML attribute, which may be either a presentation attribute or custom user-provided attribute.
This API only stores the underlying strings for the attribute name and value, and does not parse them. To parse, use the upper-layer API: donner::svg::SVGElement::setAttribute.
| registry | Registry to use for the operation. |
| name | Name of the attribute to set. |
| value | New value to set. |