Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (52 sloc) 1.995 kb
b2c8070 Norman Scaife [feature] mongo: New files for mongo API.
nrs135 authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (**
20 * Simple library, intended to have some of the properties of both
21 * String and Buffer. No automatic resize but it can be done manually.
22 **)
23
24 (** This type is concrete **)
25 type buf = { mutable str : string; mutable i : int; }
26
bbb47cb Norman Scaife [enhance] libbase: Made Buf module optionally resizable according to gl...
nrs135 authored
27 (** Global flag for resize **)
28 type resize_mode = RM_stdout | RM_stderr | RM_custom of (string -> unit) | RM_failwith | RM_exit | RM_noresize
29 val auto_resize : resize_mode ref
30
b2c8070 Norman Scaife [feature] mongo: New files for mongo API.
nrs135 authored
31 (** Common to String and Buffer **)
32 type t = buf
33 val length : buf -> int
34 val create : int -> buf
35 val sub : buf -> int -> int -> string
36
37 (** Compatibility with String *)
38 val make : int -> char -> buf
39 val get : buf -> int -> char
40 val unsafe_get : buf -> int -> char
41 val set : buf -> int -> char -> unit
42 val unsafe_set : buf -> int -> char -> unit
79660b4 Norman Scaife [feature] libbase: Added copy to Buf.
nrs135 authored
43 val copy : buf -> buf
b2c8070 Norman Scaife [feature] mongo: New files for mongo API.
nrs135 authored
44
45 (** Compatibility with Buffer **)
46 val nth : buf -> int -> char
47 val clear : buf -> unit
48 val reset : buf -> unit
49 val add_char : buf -> char -> unit
50 val add_string : buf -> string -> unit
732d845 Norman Scaife [feature] libbase: Added add_substring to Buf.
nrs135 authored
51 val add_substring : buf -> string -> int -> int -> unit
b2c8070 Norman Scaife [feature] mongo: New files for mongo API.
nrs135 authored
52 val contents : buf -> string
53
54 (** Specifics **)
bbb47cb Norman Scaife [enhance] libbase: Made Buf module optionally resizable according to gl...
nrs135 authored
55 val empty : unit -> buf
b2c8070 Norman Scaife [feature] mongo: New files for mongo API.
nrs135 authored
56 val append : buf -> string -> int -> unit
57 val add_buf : buf -> buf -> unit
58 val of_string : string -> buf
59 val to_string : buf -> string
60 val resize : buf -> int -> unit
61 val extend : buf -> int -> unit
62 val real_length : buf -> int
63 val spare : buf -> int
Something went wrong with that request. Please try again.