package gapi-ocaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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)

Supports all these read access method, too

method ro : bool

whether the header is read-only or not

method set_fields : (string * string) list -> unit
method update_field : string -> string -> unit
method update_multiple_field : string -> string list -> unit
method delete_field : string -> unit

These methods modify the fields of the header. If the header is * read-only, the exception Immutable will be raised. * * set_fields replaces the current fields with a new list of * (name,value) pairs. update_field name value replaces all fields * of the passed name with the single setting (name,value), or * adds this setting to the list. update_multiple_field name values * replaces all fields of the passed name with the list of values, * or adds this list. Finally, delete_field name deletes all * fields of the passed name. Nothing happens if there is no such * field. * * Both update_field and update_multiple_field first replace * existing values by the new ones without changing the order * of the fields in the header. Additional values are inserted * after the last existing value, or at the end of the header.

OCaml

Innovation. Community. Security.