1
(* $Id: subText.mli,v 1.2 2004/09/04 16:08:40 yori Exp $ *)
2
(* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
4
(** Sub-texts, parts of original (ur-) texts.
5
The signature and semantics matches those of UStorage. *)
9
val get : t -> int -> UChar.t
11
val init : int -> (int -> UChar.t) -> t
15
val look : t -> index -> UChar.t
16
val nth : t -> int -> index
17
val first : t -> index
20
val next : t -> index -> index
21
val prev : t -> index -> index
22
val move : t -> index -> int -> index
23
val out_of_range : t -> index -> bool
24
val compare_index : t -> index -> index -> int
26
val iter : (UChar.t -> unit) -> t -> unit
27
val compare : t -> t -> int
31
val create : int -> buf
32
val contents : buf -> t
33
val clear : buf -> unit
34
val reset : buf -> unit
35
val add_char : buf -> UChar.t -> unit
36
val add_string : buf -> t -> unit
37
val add_buffer : buf -> buf -> unit
40
(** The type of original texts. *)
43
(** The type of indexes of original texts. *)
46
(** [refer t i j] returns the part of [t] from [i] until [j].
47
The character pointed by [j] is not included in the result.
48
If [j] is equal to [i] or located before [j], the result is
50
val refer : ur_text -> ur_index -> ur_index -> t
52
(** [excerpt t] copies the contents of [t] as a new ur_text. *)
53
val excerpt : t -> ur_text
55
(** [context t] returns the tuple [(s, i, j)] such that
57
val context : t -> ur_text * ur_index * ur_index
59
(** Conversion from indexes of sub-texts to ur_texts. *)
60
val ur_index_of : t -> index -> ur_index
63
module Make : functor (Text : UnicodeString.Type) ->
64
(Type with type ur_text = Text.t and type ur_index = Text.index)