~ubuntu-branches/ubuntu/oneiric/ocsigen/oneiric

« back to all changes in this revision

Viewing changes to http/ocsigen_charset_mime.mli

  • Committer: Bazaar Package Importer
  • Author(s): Stephane Glondu
  • Date: 2009-07-02 10:02:08 UTC
  • mfrom: (1.1.9 upstream) (4.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090702100208-n158b1sqwzn0asil
Tags: 1.2.0-2
Fix build on non-native architectures

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
type extension = string
 
2
type file = string
 
3
type filename = string
 
4
 
 
5
 
 
6
(** Charset *)
 
7
 
 
8
(** By convention, "no specified charset" is represented by the empty
 
9
    string *)
 
10
type charset = string
 
11
val no_charset: charset
 
12
 
 
13
(** Association between extensions and charset, with a default value. *)
 
14
type charset_assoc
 
15
 
 
16
(** All files are mapped to [no_charset] *)
 
17
val empty_charset_assoc : ?default:charset -> unit -> charset_assoc
 
18
 
 
19
val find_charset : string -> charset_assoc -> charset
 
20
 
 
21
(** Functions related to the default charset in the association *)
 
22
val default_charset : charset_assoc -> charset
 
23
val set_default_charset : charset_assoc -> charset -> charset_assoc
 
24
 
 
25
 
 
26
(** Updates the mapping between extensions from a file to its charset.
 
27
    The update can be specified using the extension of the file,
 
28
    the name of the file, or the entire file (with its path)
 
29
*)
 
30
val update_charset_ext : charset_assoc -> extension -> charset -> charset_assoc
 
31
val update_charset_file : charset_assoc -> filename -> charset -> charset_assoc
 
32
val update_charset_regexp :
 
33
  charset_assoc -> Netstring_pcre.regexp -> charset -> charset_assoc
 
34
 
 
35
 
 
36
 
 
37
(** MIME types; the default value is ["application/octet-stream"] *)
 
38
type mime_type = string
 
39
 
 
40
val default_mime_type : mime_type
 
41
 
 
42
(** association between extensions and mime types, with default value *)
 
43
type mime_assoc
 
44
 
 
45
(** Default values, obtained by reading the file specified by
 
46
    [Ocsigen_config.get_mimefile] *)
 
47
val default_mime_assoc : unit -> mime_assoc
 
48
 
 
49
 
 
50
(** Parsing of a file containing mime associations, such as /etc/mime-types *)
 
51
val parse_mime_types : filename:string -> mime_assoc
 
52
 
 
53
 
 
54
(* The other functions are as for charsets *)
 
55
 
 
56
val find_mime : file -> mime_assoc -> string
 
57
 
 
58
val default_mime : mime_assoc -> mime_type
 
59
val set_default_mime : mime_assoc -> mime_type -> mime_assoc
 
60
 
 
61
val update_mime_ext : mime_assoc -> extension -> mime_type -> mime_assoc
 
62
val update_mime_file : mime_assoc -> filename -> mime_type -> mime_assoc
 
63
val update_mime_regexp :
 
64
  mime_assoc -> Netstring_pcre.regexp -> mime_type -> mime_assoc
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70
 
 
71