Class attribute

Inheritance Relationships

Base Type

Class Documentation

class attribute : public mxml::node

An attribute is a node, has an element as parent, but is not a child of this parent (!)

Public Functions

inline virtual constexpr node_type type() const override

node_type to be returned by each implementation of this node class

inline attribute(std::string_view qname, std::string_view value, bool id = false)

constructor

Parameters
  • qname – The qualified name

  • value – The value

  • id – Flag to indicate if this is an ID attribute

inline attribute(const attribute &attr)

copy constructor

inline attribute(attribute &&attr) noexcept

move constructor

inline attribute &operator=(attribute attr) noexcept

assignment operator

inline bool operator==(const attribute &rhs) const

Compare two attributes for equality.

inline virtual std::string get_qname() const override

Get the qualified name for this attribute.

inline virtual void set_qname(std::string qn) override

Set the qualified name to qn.

inline bool is_namespace() const

Is this attribute an xmlns attribute?

inline std::string value() const

Return the value of this attribute.

inline void set_value(std::string v)

Set the value of this attribute to v.

std::string uri() const

same as value, but checks to see if this really is a namespace attribute

inline virtual std::string str() const override

Returns the value of this attribute.

inline virtual bool equals(const node *n) const override

compare nodes for equality

inline bool is_id() const

returns whether this attribute is an ID attribute, as defined in an accompanying DTD

template<size_t N>
inline decltype(auto) get() const

support for structured binding

inline virtual void set_qname(std::string qn)

Set the qualified name to qn.

This is only meaningful in attributes and elements.

Parameters

qn

inline void set_qname(std::string prefix, std::string name)

set the qname with two parameters, if prefix is empty the qname will be simply name otherwise the name will be prefix:name

Parameters
  • prefix – The namespace prefix to use

  • name – The actual name to use

Friends

inline friend std::strong_ordering operator<=>(const attribute &a, const attribute &b)

Attributes can be sorted.