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

« back to all changes in this revision

Viewing changes to public/subText.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: subText.mli,v 1.2 2004/09/04 16:08:40 yori Exp $ *)
 
2
(* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
 
3
 
 
4
(** Sub-texts, parts of original (ur-) texts.  
 
5
   The signature and semantics matches those of UStorage. *)
 
6
module type Type = sig
 
7
  type t
 
8
 
 
9
  val get : t -> int -> UChar.t
 
10
 
 
11
  val init : int -> (int -> UChar.t) -> t
 
12
  val length : t -> int
 
13
 
 
14
  type index
 
15
  val look : t -> index -> UChar.t
 
16
  val nth : t -> int -> index
 
17
  val first : t -> index
 
18
  val last : t -> index
 
19
 
 
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
 
25
      
 
26
  val iter : (UChar.t -> unit) -> t -> unit
 
27
  val compare : t -> t -> int
 
28
 
 
29
  module Buf : sig
 
30
    type buf
 
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
 
38
  end      
 
39
 
 
40
(** The type of original texts. *)
 
41
  type ur_text
 
42
 
 
43
(** The type of indexes of original texts. *)
 
44
  type ur_index
 
45
 
 
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
 
49
   an empty string. *)
 
50
  val refer : ur_text -> ur_index -> ur_index -> t
 
51
 
 
52
(** [excerpt t] copies the contents of [t] as a new ur_text. *)
 
53
  val excerpt : t -> ur_text
 
54
 
 
55
(** [context t] returns the tuple [(s, i, j)] such that
 
56
   [t = refer s i j]. *)
 
57
  val context : t -> ur_text * ur_index * ur_index
 
58
 
 
59
(** Conversion from indexes of sub-texts to ur_texts. *)
 
60
  val ur_index_of : t -> index -> ur_index
 
61
end
 
62
 
 
63
module Make : functor (Text : UnicodeString.Type) -> 
 
64
  (Type with type ur_text = Text.t and type ur_index = Text.index)