package iri

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type error
exception Error of error
val string_of_error : error -> string
module KV : Stdlib.Map.S with type key = string
type query_kv = string KV.t
type path =
  1. | Absolute of string list
  2. | Relative of string list
type t
val iri : ?scheme:string -> ?user:string -> ?host:string -> ?port:int -> ?path:path -> ?query_kv:query_kv -> ?query:string -> ?fragment:string -> unit -> t
  • parameter query

    is %-encoded

  • parameter query_kv

    is %-decoded

module Set : Stdlib.Set.S with type elt = t
module Map : Stdlib.Map.S with type key = t
val is_absolute : t -> bool

true if fragment is None and scheme is not empty.

val is_relative : t -> bool

true is scheme is empty.

val compare : ?normalize:bool -> t -> t -> int
  • parameter normalize

    default is false.

val equal : ?normalize:bool -> t -> t -> bool
  • parameter normalize

    default is false.

val of_string : ?pctdecode:bool -> ?pos:Stdlib.Lexing.position -> ?normalize:bool -> string -> t

Read an IRI from the given string.

  • parameter normalize

    tells whether to normalize to IRI or not. Default is false when IRI is relative (has no scheme) or true overwise.

  • parameter decode

    tells whether to %-decode strings or not; default is true.

val to_string : ?pctencode:bool -> t -> string

Return a string representation of the given IRI.

  • parameter pctencode

    is true by default.

val to_string_details : t -> string

Return a debug purpose string representation of the given IRI.

val pp : Stdlib.Format.formatter -> t -> unit

Print the given IRI to the given formatter, using to_string ?pctencode:None.

val pp_details : Stdlib.Format.formatter -> t -> unit

Print a debug purpose reprensetation of the given IRI to the given formatter, using to_string_details.

val scheme : t -> string
val with_scheme : t -> string -> t
val user : t -> string option
val with_user : t -> string option -> t
val host : t -> string option
val with_host : t -> string option -> t
val port : t -> int option
val with_port : t -> int option -> t
val path : t -> path
val with_path : t -> path -> t
val path_string : ?pctencode:bool -> t -> string
  • parameter encode

    indicate whether the path elements must be encoded. Default is false.

val append_path : t -> string list -> t

Append the given (not %-encoded) string list to the path of the given iri and return a new iri with this path.

val query : t -> string option

Query string is not %-decoded as it is not parsed to name/value pairs

val query_kv : t -> query_kv

Key/value pairs from the query string. strings are %-decoded.

val with_query : t -> string option -> t

Return a new iri with the given optional query string. This string must already be %-encoded.

val with_query_kv : t -> query_kv -> t

Return a new iri with the given list of key/value pairs. The givn string must be %-decoded.

val query_get : t -> string -> string
val query_opt : t -> string -> string option
val query_set : t -> string -> string -> t
val fragment : t -> string option
val with_fragment : t -> string option -> t
val normalize : ?nfkc:bool -> t -> t
val resolve : ?normalize:bool -> base:t -> t -> t
  • parameter normalize

    tells whether to apply normalization after resolution. Default is true.

val to_uri : t -> string

Return a correctly pct-encoded URI as a string, from the given IRI.

OCaml

Innovation. Community. Security.