Plasma GitLab Archive
Projects Blog Knowledge

Class Netmime.basic_mime_header

class basic_mime_header : (string * string) list -> mime_header
An implementation of mime_header.

The argument is the list of (name,value) pairs of the header.

Example: Create a MIME header with only the field "Content-type":

 let h = new basic_mime_header ["content-type", "text/plain"] 

Example: Set the field "Subject":

 h # update_field "subject" "The value of this field" 

This mime_header implementation bases on a mixture of a Map data structure and a doubly linked list. The efficiency of the operations (n=number of fields; m=average number of values per field; n*m=total number of values):

  • new, set_fields: O(m * n * log n), but the construction of the dictionary is deferred until the first real access
  • field: O(log n)
  • multiple_field: O(log n + m)
  • fields: O(n * m)
  • update_field, update_multiple_field: O(log n + m)
  • delete_field: O(n + m)


This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml