module MakeBuffer:
Functor that creates resizable buffers (=string arrays) from reallocation strategies.
Parameters: |
|
include Nopres_intf.T
Includes all functions that exist in non-parameterized arrays.
val sof_string : strategy -> string -> t
sof_string s ar
converts a string to a resizable buffer using strategy
s
.
val of_string : string -> t
of_string ar
converts a string to a resizable buffer using the default
strategy.
Buffer
-moduleNote that the function create n
ignores the parameter n
and uses the
default strategy instead. You can supply a different strategy with
creates s n
as described above.
val contents : t -> string
contents b
b
.val reset : t -> unit
reset b
just clears the buffer, possibly resizing it.
val add_char : t -> char -> unit
add_char b c
appends the character c
at the end of the buffer b
.
val add_string : t -> string -> unit
add_string b s
appends the string s
at the end of the buffer b
.
val add_substring : t -> string -> int -> int -> unit
add_substring b s ofs len
takes len
characters from offset ofs
in
string s
and appends them at the end of the buffer b
.
val add_buffer : t -> t -> unit
add_buffer b1 b2
appends the current contents of buffer b2
at the end
of buffer b1
. b2
is not modified.
val add_channel : t -> Stdlib.in_channel -> int -> unit
add_channel b ic n
reads exactly n
character from the input channel
ic
and stores them at the end of buffer b
.
End_of_file
if the channel contains fewer than n
characters.val output_buffer : Stdlib.out_channel -> t -> unit
output_buffer oc b
writes the current contents of buffer b
on the
output channel oc
.
val add_full_channel : t -> Stdlib.in_channel -> unit
val add_full_channel_f : t -> Stdlib.in_channel -> int -> (int -> int) -> unit