isAttrRange

Whether the given type is a forward range of attributes.

Essentially, an attribute range must be a forward range where

  • each element has the members name, value, and pos
  • name and value are forward ranges of characters
  • name and value have the same type
  • pos is a TextPos

Normally, an attribute range would come from EntityRange.Entity.attributes or DOMEntity.attributes, but as long as a range has the correct API, it qualifies as an attribute range.

Members

Aliases

NameType
alias NameType = ReturnType!((R r) => r.front.name)
Undocumented in source.
ValueType
alias ValueType = ReturnType!((R r) => r.front.value)
Undocumented in source.

Manifest constants

isAttrRange
enum isAttrRange;
Undocumented in source.
isAttrRange
enum isAttrRange;
Undocumented in source.

Examples

import std.typecons : Tuple;
import dxml.dom : parseDOM;

alias R1 = typeof(parseXML("<root/>").front.attributes);
static assert(isAttrRange!R1);

alias R2 = typeof(parseDOM("<root/>").children[0].attributes);
static assert(isAttrRange!R2);

alias T = Tuple!(string, "name", string, "value", TextPos, "pos");
static assert(isAttrRange!(T[]));

static assert(!isAttrRange!string);

See Also

Meta