module Line: sig
.. end
Structured records for line-oriented data
type
present = private [< `Phantom ]
Phantom type used to indicate that a
Line.t
field is present.
type
absent = private [> `Phantom ]
Phantom type used to indicate that a
Line.t
field is absent.
This is a supertype of
Line.present
so that the presence of
fields may be cast away.
type +'a
t
The type of a structured line.
The parameter indicates which fields are present.
val raw : 'a t -> string
The raw string data from which a line was constructed. This
should typically not change after a line is created; to change the
principal string value of a line, see
Line.select
and
Line.show
. (accessor, required)
val set_raw : string -> 'a t -> 'a t
val show : 'a t -> string
The principal string representation of a line.
Unlike
Line.raw
above, the value of
Line.show
should reflect the
data of concern in a line. Use
Line.set_show
or
Line.select
to change
the value returned by
Line.show
. When a line is passed to an external
process,
Line.show
is used to get a string to send.
val set_show : string -> 'a t -> 'a t
Choose the principal string value to be returned by
Line.show
.
val select : ('a t -> string) -> 'a t -> 'a t
Choose the principal string value, using a function.
Line.select sel ln
is equivalent to Line.set_show (sel ln) ln
.
type
source = [ `Command of string
| `Directory of string
| `File of string
| `None
| `Other of string
| `Process of Proc.execspec ]
val source : < source : present; .. > t -> source
The source of a line. (accessor, nullable)
val set_source : source ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : 'h; source : 'i; stat : 'j >
t ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : 'h; source : present; stat : 'j >
t
val seq : < seq : present; .. > t -> int
The position of a line in its source. (accessor, nullable)
val set_seq : int ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : 'h; source : 'i; stat : 'j >
t ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : present; source : 'i; stat : 'j >
t
module Key_value: sig
.. end
Line structure to represent associations of keys with values.
module Delim: sig
.. end
Line structure to represent records with delimited fields.
module Passwd: sig
.. end
Line structure for /etc/passwd file records.
module Group: sig
.. end
Line structure for /etc/group file records.
module Stat: sig
.. end
Line structure for file status and mode information.
module Ps: sig
.. end
Line structure for process status information.
module Fstab: sig
.. end
Line structure for the file system table /etc/fstab
records.
module Mailcap: sig
.. end
Line structure for mailcap entries.
val after : 'a t -> string
Trailing delimiter data associated with a line (accessor, required, default = "\n"
)
val set_after : string -> 'a t -> 'a t
val before : 'a t -> string
Leading delimiter data associated with a line (accessor, required, default = ""
)
val set_before : string -> 'a t -> 'a t
type
empty = < delim : absent; fstab : absent; group : absent;
key_value : absent; mailcap : absent; passwd : absent;
ps : absent; seq : absent; source : absent;
stat : absent >
The
Line.t
parameter for a line with no metadata.
val line : ?after:string -> ?before:string -> string -> empty t
Construct an empty line from a string.