IonInt

Ion signed integer number.

Members

Functions

get
IonErrorCode get(T value)
get
T get()
getErrorCode
IonErrorCode getErrorCode()
serialize
void serialize(S serializer)

Variables

data
const(ubyte)[] data;
sign
bool sign;

Examples

test with IonUInts

import mir.ion.exception;
import mir.test;

assert(IonValue([0x2F]).describe.get!IonNull == IonNull(IonTypeCode.uInt));
assert(IonValue([0x21, 0x07]).describe.get!IonInt.get!int == 7);
assert(IonValue([0x20]).describe.get!IonInt.get!int == 0);

int v;
assert(IonValue([0x22, 0x01, 0x04]).describe.get!IonInt.get(v) == IonErrorCode.none);
v.should == 260;

test with IonNInts

import mir.ion.exception;
import mir.test;

assert(IonValue([0x3F]).describe.get!IonNull == IonNull(IonTypeCode.nInt));
assert(IonValue([0x31, 0x07]).describe.get!IonInt.get!int == -7);

long v;
assert(IonValue([0x32, 0x01, 0x04]).describe.get!IonInt.get(v) == IonErrorCode.none);
v.should == -260;

Meta