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.

addField
void addField(string key, T value)
Undocumented in source. Be warned that the author may not have intended to support it.
byKey
auto byKey()

Iterates over all fields, including duplicates.

byKeyValue
auto byKeyValue()
byValue
auto byValue()

Iterates over all fields, including duplicates.

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

Returns the first field that matches the given key.

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

Returns all values matching the given key.

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)
ValueType opIndexAssign(T 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 vibe.data.serialization.

toString
void toString(void delegate(const(char)[] str) @(safe) sink)
void toString(void delegate(const(char)[] str) @(system) sink)
string toString()

Generates an associative-array equivalent string representation of the dictionary.

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 vibe.data.serialization.

Structs

FieldTuple
struct FieldTuple
Undocumented in source.

Meta