DictionaryList

Behaves similar to VALUE[string] but the insertion order is not changed and multiple values per key are supported.

This kind of map is used for MIME headers (e.g. for HTTP, see vibe.inet.message.InetHeaderMap), or for form data (vibe.inet.webform.FormFields). Note that the map can contain fields with the same key multiple times if addField is used for insertion. Insertion order is preserved.

Note that despite case not being relevant for matching keyse, iterating over the map will yield the original case of the key that was put in.

Insertion and lookup has O(n) complexity.

Members

Aliases

ValueType
alias ValueType = VALUE
Undocumented in source.

Functions

addField
void addField(string key, ValueType value)

Adds a new field to the map.

get
inout(ValueType) get(string key, inout(ValueType) def_val)

Returns the first field that matches the given key.

getAll
const(ValueType)[] getAll(string key)
void getAll(string key, void delegate(const(ValueType)) del)

Returns all values matching the given key.

opApply
int opApply(int delegate(string key, ref ValueType val) del)
int opApply(int delegate(ref ValueType val) del)
int opApply(int delegate(string key, ref const(ValueType) val) del)
int opApply(int delegate(ref const(ValueType) val) del)

Iterates over all fields, including duplicates.

opBinaryRight
inout(ValueType)* opBinaryRight(string key)
bool opBinaryRight(string key)

Returns a pointer to the first field that matches the given key.

opIndex
inout(ValueType) opIndex(string key)

Returns the first value matching the given key.

opIndexAssign
ValueType opIndexAssign(ValueType val, string key)

Adds or replaces the given field with a new value.

remove
void remove(string key)

Removes the first field that matches the given key.

removeAll
void removeAll(string key)

Removes all fields that matches the given key.

toRepresentation
FieldTuple[] toRepresentation()

Supports serialization using vson.serialization.

Properties

dup
DictionaryList dup [@property getter]

Duplicates the header map.

length
size_t length [@property getter]

The number of fields present in the map.

Static functions

fromRepresentation
DictionaryList fromRepresentation(FieldTuple[] array)

Supports serialization using vson.serialization.

Structs

FieldTuple
struct FieldTuple
Undocumented in source.

Meta