DataNode

Generic container class that represents a metadata node for the Maxmind database format.

Constructors

this
this(Type type)

Constructs the node with the appropriate type tag

Members

Classes

Array
class Array

Holds an Array structure from the database.

Binary
class Binary

Generic binary data type

Boolean
class Boolean

Holds a boolean value from the database

Map
class Map

Holds a Map structure from the database.

Number
class Number(T)

Holds any kind of number from the database

String
class String

Holds strings coming from the database

Functions

asArray
Array asArray()

Attempts to convert the current node to an Array node

asMap
Map asMap()

Attemps to convert the current node to a Map node

get
T get()

Accesses the node values directly by automatically casting the node and getting its value

getArray
T[] getArray()

Provide a way to export the entire array as a specific type

getMap
T[string] getMap()

Provide a way to export an entire map as an associative array of the specified type

opDispatch
DataNode opDispatch()

Allow accessing Map values using dot notation Note: I put the method here to avoid having to cast objets all over the place

opIndex
DataNode opIndex(string key)

Allow accessing Map values using the [] operator using string keys Note: I put the method here to avoid having to cast objets all over the place

opIndex
DataNode opIndex(size_t key)

Allow accessing Array values using the [] operator using ulong keys Note: I put the method here to avoid having to cast objets all over the place

Properties

type
Type type [@property getter]

Readonly accessor for the node type

Static functions

create
DataNode create(ref Reader data)
DataNode create(Reader r)

Creates a new node of the appropriate type using an existing reader helper as the data source

create
DataNode create(ubyte[] data, size_t offset = 0)

Creates a new node using a raw data slice with an optional offset to the beginning of the data section. @see create(ref Reader data)

followPointer
DataNode followPointer(ubyte id, ref Reader data)

Decodes and follows a pointer type

Variables

_type
Type _type;

Holds the original type of the data

Meta