Module keylist

Data Types

keyelem()

keyelem() = #keyelem{}

no description

Function Index

append/2 Add NewValueList to tail of element (#keyelem.item) in List (or create new entry if Key is unknown).
appendlist/2 do one append/2 for each entry in List.
copy/2 return Keylist only containing the fields in Keys Note : use of atom() as keys (for well known keys) should improve patternmatch speed.
delete/2 remove an entry from keylist record() (#keylist.list).
deletefirstvalue/2 remove the first entry from a element (#keyelem.item) in keylist record() (#keylist.list).
fetch/2 return the contents of the header that matches Key.
from_list/1 create an empty keylist and add the List elements with append/2.
map/2 apply Func to all elements in Keylist (#keylist.list).
normalize/1 Convert header key to a standard format - either an atom for well known headers, or a lowercased string.
prepend/2 Add NewValueList to head of element (#keyelem.item) in List (or create new entry if Key is unknown).
set/3 replace all items in E#keyelem.item where Key matches key in E.

Function Details

append/2

append(X1::Data, Keylist::List) -> #keylist{}

Add NewValueList to tail of element (#keyelem.item) in List (or create new entry if Key is unknown).

appendlist/2

appendlist(Keylist, List) -> #keylist{}

do one append/2 for each entry in List

copy/2

copy(Keylist, Names::Keys) -> #keylist{}

return Keylist only containing the fields in Keys Note : use of atom() as keys (for well known keys) should improve patternmatch speed. When matching a E#keyelem.key against Key in the alternative solution below, it may also be worth using one of the OTP set modules so that the member check becomes O(log N) instead of O(N).

delete/2

delete(Name, Keylist) -> #keylist{}

remove an entry from keylist record() (#keylist.list)

deletefirstvalue/2

deletefirstvalue(Name, Keylist::List) -> #keylist{}

remove the first entry from a element (#keyelem.item) in keylist record() (#keylist.list)

fetch/2

fetch(Key, List) -> [string()]

returns: the value of Key - Key may have several values associated with it (e.g. the Via header in sip requests)

return the contents of the header that matches Key

from_list/1

from_list(List) -> #keylist{}

create an empty keylist and add the List elements with append/2

map/2

map(Func, Keylist) -> [term()]

apply Func to all elements in Keylist (#keylist.list)

normalize/1

normalize(Name::Key) -> string() | atom()

Convert header key to a standard format - either an atom for well known headers, or a lowercased string. We don't do list_to_atom() because that way it would be possible to exhaust our atom() space by sending us SIP requests with made-up headers.

prepend/2

prepend(X1::{Name, NewValueList}, List) -> #keylist{}

Add NewValueList to head of element (#keyelem.item) in List (or create new entry if Key is unknown). Note : This function does not accept atom() form because if there is no header, one will be created and then we have to have a string() variant of it anyways.

set/3

set(Name, Valuelist, Keylist::List) -> #keylist{}

replace all items in E#keyelem.item where Key matches key in E


Generated by EDoc, Oct 17 2007, 16:48:25.