Document

Document is a lazy handler of HiBON serialized buffer

@safe
struct Document {}

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

this
this(HiBON hibon)
Undocumented in source.

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

Reserved
alias Reserved = Flag!"Reserved"
Undocumented in source.
Value
alias Value = ValueT!(false, void, Document)
Undocumented in source.
serialize
alias serialize = data

same as data

Enums

isDocTypedef
eponymoustemplate isDocTypedef(T)
Undocumented in source.

Functions

data
immutable(ubyte[]) data()

Gets the internal buffer

hasHashKey
bool hasHashKey()
Undocumented in source. Be warned that the author may not have intended to support it.
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 clasified 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

opBinaryRight
const(Element) opBinaryRight(Index key)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Document rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
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)

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

ver
uint ver()

This function returns the HiBON version

Properties

begin
size_t begin [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
empty
bool empty [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
full_size
size_t full_size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
length
uint length [@property getter]

Counts the number of members in a Document

size
uint size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

build
void build(ubyte[] buffer, Type type, Key key, const(T) x, size_t index)

Append a full element to a buffer

buildKey
void buildKey(ubyte[] buffer, Type type, Key key, size_t index)

Append the key to the buffer

sizeKey
size_t sizeKey(const(char[]) key)

Retruns: The number of bytes taken up by the key in the HiBON serialized stream

sizeKey
size_t sizeKey(uint key)
Undocumented in source. Be warned that the author may not have intended to support it.
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

RangeT
struct RangeT(T)
Undocumented in source.

Variables

_data
immutable(ubyte)[] _data;
Undocumented in source.

Meta