Document

Document is a lazy handler of HiBON serialized buffer

Constructors

this
this(immutable(ubyte[]) data)

Creates a HiBON Document from a buffer

this
this(Document doc)

Creates a replicate of a Document from another Document The buffer reused not copied

Members

Aliases

ErrorCallback
alias ErrorCallback = bool delegate(const Document main_doc, const Element.ErrorCode error_code, const(Element) current, const(Element) previous) nothrow @(safe)

The deligate used by the valid function to report errors

serialize
alias serialize = data

same as data

Functions

data
immutable(ubyte[]) data()

Gets the internal buffer

hasMember
bool hasMember(string key)
hasMember
bool hasMember(Index index)
indices
auto indices()

The Document must only contain member names which represents an uint number

isArray
bool isArray()

Check if the Document can be classified as an Array

isInorder
bool isInorder(Reserved reserved)

Check if a Document format is the correct HiBON format. Uses the valid function

keys
auto keys()
opBinaryRight
const(Element) opBinaryRight(string key)

Find the element with key

opIndex
const(Element) opIndex(string key)
opIndex
const(Element) opIndex(Index index)
opSlice
Range opSlice()
range
RangeT!U range()

This range is used to generate and range of same type U If the Document contains and Array of the elements this range can be used

valid
Element.ErrorCode valid(ErrorCallback error_callback, Reserved reserved, bool ignore_boundary_check)

This function check's if the Document is a valid HiBON format

ver
uint ver()

This function returns the HiBON version

Properties

length
uint length [@property getter]

Counts the number of members in a Document

Static functions

sizeKey
size_t sizeKey(const(char[]) key)
sizeT
size_t sizeT(Type type, Key key, const(T) x)

Calculates the number of bytes taken up by an element in the HiBON serialized stream

Structs

Element
struct Element

HiBON Element representation

Range
struct Range

Range of the Document