Tag

Undocumented in source.
class Tag {}

Constructors

this
this(Tag parent)
Undocumented in source.
this
this(string namespace, string name, Value[] values, Attribute[] attributes, Tag[] children)
Undocumented in source.
this
this(Tag parent, string namespace, string name, Value[] values, Attribute[] attributes, Tag[] children)
Undocumented in source.

Members

Aliases

AttributeRange
alias AttributeRange = MemberRange!(Attribute, "allAttributes", "attributeIndicies", "_attributes")
Undocumented in source.
TagRange
alias TagRange = MemberRange!(Tag, "allTags", "tagIndicies", "_tags")
Undocumented in source.

Functions

add
Tag add(Value val)
Tag add(Value[] vals)
Tag add(Attribute attr)
Tag add(Attribute[] attrs)
Tag add(Tag tag)
Tag add(Tag[] tags)

Adds a Value, Attribute, Tag (or array of such) as a member/child of this Tag. Returns this for chaining. Throws ValidationException if trying to add an Attribute or Tag that already has a parent.

clone
Tag clone()

Deep-copy this Tag. The clone does not have a parent, even if the original does.

expectAttribute
T expectAttribute(string fullAttributeName)

Lookup an attribute of this tag by name, and retrieve a value of type T from it. Throws if not found.

expectTag
Tag expectTag(string fullTagName)

Lookup a child tag by name. Throws if not found.

expectTagAttribute
T expectTagAttribute(string fullTagName, string fullAttributeName)

Lookup a child tag and attribute by name, and retrieve a value of type T from it. Throws if not found.

expectTagValue
T expectTagValue(string fullTagName)

Lookup a child tag by name, and retrieve a value of type T from it. Throws if not found,

expectValue
T expectValue()

Retrieve a value of type T from this tag. Throws if not found.

getAttribute
T getAttribute(string fullAttributeName, T defaultValue)

Lookup an attribute of this tag by name, and retrieve a value of type T from it. Returns a default value if not found.

getFullName
FullName getFullName()

This tag's name, including namespace if one exists.

getTag
Tag getTag(string fullTagName, Tag defaultValue)

Lookup a child tag by name. Returns null if not found.

getTagAttribute
T getTagAttribute(string fullTagName, string fullAttributeName, T defaultValue)

Lookup a child tag and attribute by name, and retrieve a value of type T from it. Returns a default value if not found.

getTagAttributes
auto getTagAttributes(string fullTagName, string attributeNamespace)

Lookup a child tag by name, and retrieve all attributes in a chosen (or default) namespace from it.

getTagValue
T getTagValue(string fullTagName, T defaultValue)

Lookup a child tag by name, and retrieve a value of type T from it. Returns a default value if not found.

getTagValues
Value[] getTagValues(string fullTagName, Value[] defaultValues)

Lookup a child tag by name, and retrieve all values from it.

getValue
T getValue(T defaultValue)

Retrieve a value of type T from this tag. Returns a default value if not found.

opEquals
bool opEquals(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
Tag remove()

Removes this from its parent, if any. Returns this for chaining. Inefficient ATM, but it works.

toDebugString
string toDebugString()

Outputs full information on the tag.

toSDLDocument
string toSDLDocument(string indent, int indentLevel)
void toSDLDocument(Sink sink, string indent, int indentLevel)

Treats this as the root tag. Note that root tags cannot have values or attributes, and cannot be part of a namespace. If this isn't a valid root tag, sdlang.exception.ValidationException will be thrown.

toSDLString
string toSDLString(string indent, int indentLevel)
void toSDLString(Sink sink, string indent, int indentLevel)

Output this entire tag in SDL format. Does not treat this as a root tag. If you intend this to be the root of a standard SDL document, use toSDLDocument instead.

Properties

all
NamespaceAccess all [@property getter]

Access all attributes and tags regardless of namespace.

attributes
AttributeRange attributes [@property getter]

Access all attributes that don't have a namespace

fullName
deprecated string fullName [@property getter]

This tag's name, including namespace if one exists.

maybe
MaybeAccess maybe [@property getter]

Access attributes, tags, namespaces and all like normal, except that looking up a non-existant name/namespace with opIndex(string) results in an empty array instead of a thrown sdlang.exception.DOMRangeException.

name
string name [@property getter]
string name [@property setter]

This tag's name, not including namespace.

namespace
string namespace [@property getter]
string namespace [@property setter]

This tag's namespace. Empty string if no namespace.

namespaces
NamespaceRange namespaces [@property getter]

Access all namespaces in this tag, and the attributes/tags within them.

parent
Tag parent [@property getter]

Get parent tag. To set a parent, attach this Tag to its intended parent tag by calling Tag.add(...), or by passing it to the parent tag's constructor.

tags
TagRange tags [@property getter]

Access all direct-child tags that don't have a namespace.

Structs

MaybeAccess
struct MaybeAccess
Undocumented in source.
MemberRange
struct MemberRange(T, string allMembers, string memberIndicies, string membersGrouped)
Undocumented in source.
NamedMemberRange
struct NamedMemberRange(T, string membersGrouped)
Undocumented in source.
NamespaceAccess
struct NamespaceAccess
Undocumented in source.
NamespaceRange
struct NamespaceRange
Undocumented in source.

Variables

location
Location location;

File/Line/Column/Index information for where this tag was located in its original SDLang file.

values
Value[] values;

Access all this tag's values, as an array of type sdlang.token.Value.

Meta