Document

Document is used for storage different data and provide possibility to read and analyze data

Constructors

this
this(immutable(ubyte[]) data)

Creates a HiBON Document from a buffer @param data - buffer

this
this(Document doc)

Creates a replicate of a Document from another Document The buffer reused not copied @param doc - Document which is replicated

this
this(HiBONT hibon)

Creates a document which is based on HiBON @param hibon - reference to the HiBON object

this
this(HiBONT hibon)
Undocumented in source.

Members

Aliases

ErrorCallback
alias ErrorCallback = void delegate(scope const(Element) current, scope const(Element) previous)

The deligate used by the valid function to report errors

Value
alias Value = ValueT!(false, void, Document)

HiBON Document value type

serialize
alias serialize = data

Same as data

Functions

copy
void copy(Document doc)

Makes a cope od document @rapam doc - Document that will be copied

data
immutable(ubyte[]) data()

Gets the internal buffer @return the buffer of the HiBON document

hasMember
bool hasMember(string key)

@return true if the key exist in the Document

hasMember
bool hasMember(Index index)

@return true if the index exist in the Document

indices
IndexRange indices()

* The Document must only contain member names which represents an uint number * Throws an std.conv.ConvException if the keys can not be convert to an uint * @return range of indices of the type of uint in the Document

isArray
bool isArray()

Check if the Document can be clasified as an Array @return true if all the keys in ordred numbers

isInorder
bool isInorder()

Check if a Document format is the correct HiBON format. Uses the valid function @return true if the Document is inorder

keys
KeyRange keys()

@return range of the member keys in the document

opBinaryRight
const(Element) opBinaryRight(string key)

Find the element with key @return the element with the key, if on element with this key has been found an empty element is returned

opBinaryRight
const(Element) opBinaryRight(Index key)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
const(Element) opIndex(string key)

@return the element with the key @throw if the element with the key is not found then and HiBONException is thrown

opIndex
const(Element) opIndex(Index index)

@return the element with the index @throw if the element with the key is not found then and HiBONException is thrown Or of the key is not an index a std.conv.ConvException is thrown

opSlice
Range opSlice()

@return range of Element's

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 @param Range (Array) of the type U

surrender
void surrender()
Undocumented in source. Be warned that the author may not have intended to support it.
valid
Element.ErrorCode valid(ErrorCallback error_callback)

Function check's if the Document is a valid HiBON format @param error_callback - if the delegate error_callback is the this function is call when a error occures @return error code of the validation

ver
uint ver()

Returns HiBON version @return HiBON version

Properties

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 @return number of members in in the 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(BinBuffer buffer, Type type, K key, const(T) x)

Append a full element to a buffer @param buffer = is the target buffer @param type = is the HiBON type @param key = is the member key @param x = is the value of the element @param index = is offset index in side the buffer and index with be progressed

buildKey
void buildKey(BinBuffer buffer, Type type, K key)

Append the key to the buffer @param buffer = is the target buffer @param type = is the HiBON type @param key = is the member key @param index = is offset index in side the buffer and index with be progressed

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

@param key, which size needs to be calculated @return the number of bytes taken up by the key in the HiBON serialized stream

sizeKey
size_t sizeKey(uint key)

@param key, which size needs to be calculated @return the number of bytes taken up by the key in the HiBON serialized stream

sizeT
size_t sizeT(Type type, K key, const(T) x)

Calculates the number of bytes taken up by an element in the HiBON serialized stream @param type = is the HIBON type @param key = is the key name @param x = is the value @return the number of bytes taken up by the element

Structs

Element
struct Element

HiBON Element representation

IndexRange
struct IndexRange
Undocumented in source.
KeyRange
struct KeyRange
Undocumented in source.
Range
struct Range

Range of the Document

RangeT
struct RangeT(T)
Undocumented in source.

Variables

_data
immutable(ubyte)[] _data;

Actual data

Meta