~ubuntu-branches/ubuntu/lucid/camomile/lucid

« back to all changes in this revision

Viewing changes to public/uMap.mli

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Le Gall
  • Date: 2005-12-03 01:18:55 UTC
  • Revision ID: james.westby@ubuntu.com-20051203011855-qzvwlld1xyqnl62t
Tags: upstream-0.6.3
ImportĀ upstreamĀ versionĀ 0.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(* $Id: uMap.mli,v 1.1 2003/12/19 17:24:34 yori Exp $ *)
 
2
(* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
 
3
 
 
4
(** Maps over Unicode characters. *) 
 
5
type 'a t
 
6
val empty : 'a t
 
7
val is_empty : 'a t -> bool
 
8
 
 
9
(** [add ?eq u v m] returns the new map which is same to [m] 
 
10
   except it maps [u] to some value [v'] which satisfies [eq v v']. 
 
11
   If [eq] is not supplied, structural equality is used. *)
 
12
val add : ?eq:('a -> 'a -> bool) -> UChar.t -> 'a -> 'a t -> 'a t
 
13
 
 
14
(** [add ?eq u1 u2 v m] returns the new map which is same to [m] 
 
15
   except it maps characters in the range [u1]-[u2] 
 
16
   to some value [v'] which satisfies [eq v v']. 
 
17
   If [eq] is not supplied, structural equality is used. *)
 
18
val add_range : ?eq:('a -> 'a -> bool) -> 
 
19
  UChar.t -> UChar.t -> 'a -> 'a t -> 'a t
 
20
 
 
21
val find : UChar.t -> 'a t -> 'a
 
22
val remove : UChar.t -> 'a t -> 'a t
 
23
 
 
24
(** [remove_range u1 u2 m] removes [u1]-[u2] from the domain of [m] *)
 
25
val remove_range : UChar.t -> UChar.t -> 'a t -> 'a t
 
26
 
 
27
(** [from u m] restricts the domain of [m] to the characters whose
 
28
   code points are equal or greater than [u]. *)
 
29
val from : UChar.t -> 'a t -> 'a t
 
30
 
 
31
(** [after u m] restricts the domain of [m] to the characters whose
 
32
   code points are greater than [u]. *)
 
33
val after : UChar.t -> 'a t -> 'a t
 
34
 
 
35
(** [until u m] restricts the domain of [m] to the characters whose
 
36
   code points are equal or smaller than [u]. *)
 
37
val until : UChar.t -> 'a t -> 'a t
 
38
 
 
39
(** [before u m] restricts the domain of [m] to the characters whose
 
40
   code points are smaller than [u]. *)
 
41
val before : UChar.t -> 'a t -> 'a t
 
42
 
 
43
val mem : UChar.t -> 'a t -> bool
 
44
val iter : (UChar.t -> 'a -> unit) -> 'a t -> unit
 
45
 
 
46
(** [iter proc m] : For each contingent region [u1]-[u2] 
 
47
   that is mapped to a constant [v], [proc u1 u2 v] is called.
 
48
   The order of call is determined by increasing order on [u1]. *)
 
49
val iter_range : (UChar.t -> UChar.t -> 'a -> unit) -> 'a t -> unit
 
50
 
 
51
(** [map ?eq f m] and [mapi ?eq f m] :  Similar to [map] and [mapi] 
 
52
   in stdlib Map, but if the map [m'] is returned,  it is only guaranteed 
 
53
   that [eq (find u m') (f (find u m ))] is true for [map] and 
 
54
   [eq (find u m') (f u (find u m ))] is true for [mapi].  If [eq] is
 
55
   not specified, structural equality is used. *)
 
56
 
 
57
val map : ?eq:('b -> 'b -> bool) -> ('a -> 'b) -> 'a t -> 'b t
 
58
val mapi : ?eq:('b -> 'b -> bool) -> (UChar.t -> 'a -> 'b) -> 'a t -> 'b t
 
59
 
 
60
val fold : (UChar.t -> 'b -> 'a -> 'a) -> 'b t -> 'a -> 'a
 
61
 
 
62
(** [fold_range f m x] is equivalent to
 
63
   [f u_(2n) u_(2n+1) v_n (... (f u_1 u_2 v_1 x))] where all characters in
 
64
   the range [u_(2k)]-[u_(2k+1)] are mapped to [v_k] and 
 
65
   [u_1] < [u_3] < ... in code point order.  
 
66
   For each range [u_(2k)]-[u_(2k+1)] is separated by a character 
 
67
   which is not mapped to [v_k]. *)
 
68
val fold_range : (UChar.t -> UChar.t -> 'b -> 'a -> 'a) -> 'b t -> 'a -> 'a
 
69
 
 
70
(** Constant map.*)
 
71
val set_to_map : USet.t -> 'a -> 'a t
 
72
 
 
73
(** Domain. *)
 
74
val domain : 'a t -> USet.t
 
75
 
 
76
(** [map_to_set p m] returns the set of characters which are mapped
 
77
   to values satisfying the predicate [p] by [m]. *)
 
78
val map_to_set : ('a -> bool) -> 'a t -> USet.t
 
79
 
 
80
val umap_of_imap : 'a IMap.t -> 'a t
 
81
val imap_of_umap : 'a t -> 'a IMap.t