Compound

Associative array of named tags (that can be of different types).

Constructors

this
this(Tag[] tags)
Undocumented in source.

Members

Functions

decode
void decode(Stream stream)
Undocumented in source. Be warned that the author may not have intended to support it.
encode
void encode(Stream stream)
Undocumented in source. Be warned that the author may not have intended to support it.
get
T get(string name, T defaultValue)
T get(string name, E defaultValue)

Gets the element at the given index, if exists and can be casted to T. Otherwise evaluates and returns defaultValue.

getValue
typeof(T.value) getValue(string name, typeof(T.value) defaultValue)

Gets the tag's value at the given index, if it exists and can be casted to T. Otherwise returns defaultValue.

has
bool has(string name)

Checks whether or not a value is in the associative array.

has
bool has(string name)

Checks if the key is associated to a value and that the value is of the same type of T.

opBinaryRight
Tag* opBinaryRight(string name)

Gets a pointer to the element at the given index.

opEquals
bool opEquals(Object object)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Tag[] tags)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
Tag[] opIndex()

Gets the array of named tags (without the keys). To get the associative array of named tags use the property value.

opIndex
Tag opIndex(string name)

Gets the element at the given index.

opIndexAssign
void opIndexAssign(T value, string name)

Sets the value at the given index. If the tag's name is different from the given index, the tag's name will be changed to the given index's one.

opIndexAssign
void opIndexAssign(Tag tag)

Sets the value using the named tag's name as the index.

remove
void remove(string name)

Removed the given index from the array, if set.

rename
Tag rename(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
search
ptrdiff_t search(string cmp)
Undocumented in source. Be warned that the author may not have intended to support it.
toJSON
JSONValue toJSON()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

dup
Compound dup [@property getter]

Creates an exact duplicate of the tag.

empty
bool empty [@property getter]

Checks whether or not the array is empty (its length is equal to 0).

length
size_t length [@property getter]

Gets the length of the array (or the number of NamedTags in it).

names
string[] names [@property getter]

Gets the keys (indexes of the array).

type
NBT_TYPE type [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From Tag

_named
bool _named;
Undocumented in source.
_name
string _name;
Undocumented in source.
type
NBT_TYPE type [@property getter]

Gets the tag's type.

named
bool named()

Indicates whether the tag has a name.

name
string name()

Gets the tag's name, if there's one.

rename
Tag rename(string )

Creates a NamedTag maintaing the tag's properties.

encode
void encode(Stream )

Encodes the tag's body.

decode
void decode(Stream )

Decodes the tag's body.

toJSON
JSONValue toJSON()

Encodes the tag's value as json.

toString
string toString()

Encodes the tag a human-readable string.

Examples

auto compound = new Compound();
compound["string"] = new String("test");
compound["byte"] = new Byte(18);

Meta