package ogre

  1. Overview
  2. Docs

An Ogre document.

A concrete representation of a database.

type t = doc
include Core_kernel.Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader

This function only needs implementation if t exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t afterwards.

val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val empty : doc

empty creates an empty document

val is_empty : doc -> bool

is_empty x is true iff x is empty.

  • since 2.2.0
val merge : doc -> doc -> doc Core_kernel.Or_error.t

merge d1 d2 merges two documents in one. Returns an error, if documents contain inconsistent declarations.

load chan loads a document from a channel, returns an error if a document is not well-formed, raises an exception if a system error has occurred.

val save : doc -> Core_kernel.Out_channel.t -> unit

save doc out stores the document in a channel. Raises an exception in case of a system error.

val from_file : string -> doc Core_kernel.Or_error.t

from_file name reads a document from a file with the given name, returns an error, if a document is not well-formed, raises an exception if a system error has occurred.

val from_string : string -> doc Core_kernel.Or_error.t

from_string data parses document from data. Returns an error if a document is not well-formed.

val to_string : doc -> string

to_string doc returns a textual representation of a document

val to_file : doc -> string -> unit

to_file doc name stores a document to a file with the given name.

val pp : Format.formatter -> doc -> unit

pp ppf doc prints a doc in the specified formatter ppf

val pp_yaml : Format.formatter -> doc -> unit

pp_yamp ppf doc prints doc to ppf in the YAML format.

  • since 2.3.0
val clear : doc -> doc

clear doc removes all facts from the document.

Useful for extracting scheme from a document.

val declarations : doc -> int

declarations doc returns the number of declarations in the document

val definitions : doc -> int

definitions doc returns the number of facts that defined in the document.

OCaml

Innovation. Community. Security.