Datatypes

Integer identifiers for datatypes, and utility functions to access their properties.

EXESS_MAX_DATATYPE

26U

The unsigned value of the largest ExessDatatype enumerator.

enum ExessDatatype

A supported datatype, or zero.

enumerator EXESS_NOTHING

Sentinel for unknown datatypes or errors.

enumerator EXESS_BOOLEAN

boolean

enumerator EXESS_DOUBLE

double

enumerator EXESS_FLOAT

float

enumerator EXESS_LONG

long

enumerator EXESS_INT

int

enumerator EXESS_SHORT

short

enumerator EXESS_BYTE

byte

enumerator EXESS_ULONG

unsignedLong

enumerator EXESS_UINT

unsignedInt

enumerator EXESS_USHORT

unsignedShort

enumerator EXESS_UBYTE

unsignedByte

enumerator EXESS_DECIMAL

decimal

enumerator EXESS_INTEGER

integer

enumerator EXESS_NON_POSITIVE_INTEGER

integer <= 0

enumerator EXESS_NEGATIVE_INTEGER

integer < 0

enumerator EXESS_NON_NEGATIVE_INTEGER

integer >= 0

enumerator EXESS_POSITIVE_INTEGER

integer > 0

enumerator EXESS_DURATION

duration

enumerator EXESS_YEAR_MONTH_DURATION

duration

enumerator EXESS_DAY_TIME_DURATION

duration

enumerator EXESS_DATE_TIME

dateTime

enumerator EXESS_DATE_TIME_STAMP

dateTime

enumerator EXESS_TIME

time

enumerator EXESS_DATE

date

enumerator EXESS_HEX

hexBinary

enumerator EXESS_BASE64

base64Binary

ExessDatatype exess_datatype_from_name(const char *name)

Return the datatype tag for a datatype name.

Parameters:
  • name – The camel-case name of a supported datatype (its URI fragment), like “unsignedLong” or “dateTime”.

Returns:

A datatype tag, or ExessDatatype.EXESS_NOTHING if no such datatype is known.

ExessDatatype exess_datatype_from_uri(const char *uri)

Return the datatype tag for a datatype URI.

Parameters:
Returns:

A datatype tag, or ExessDatatype.EXESS_NOTHING if no such datatype is known.

const char *exess_datatype_name(ExessDatatype datatype)

Return the name of a datatype, or null.

This returns the suffix of the URI that would be returned by exess_datatype_uri().

Parameters:
  • datatype – Datatype tag.

Returns:

The name of the datatype, or null for ExessDatatype.EXESS_NOTHING.

const char *exess_datatype_uri(ExessDatatype datatype)

Return the URI for a datatype, or null.

This only returns URIs that start with “http://www.w3.org/2001/XMLSchema#”.

Parameters:
  • datatype – Datatype tag.

Returns:

The URI of the datatype, or null for ExessDatatype.EXESS_NOTHING.

uint8_t exess_max_lengths[EXESS_MAX_DATATYPE + 1U]

Array of maximum string lengths, indexed by datatype.

Each entry is the maximum length of a string with the indexed datatype, or zero if the datatype is unknown or unbounded. For example:

unsigned four_bytes = exess_max_lengths[EXESS_BYTE];

The unbounded types are ExessDatatype.EXESS_DECIMAL, ExessDatatype.EXESS_INTEGER and its half-bounded subtypes ExessDatatype.EXESS_NON_POSITIVE_INTEGER, ExessDatatype.EXESS_NEGATIVE_INTEGER, ExessDatatype.EXESS_NON_NEGATIVE_INTEGER, and ExessDatatype.EXESS_POSITIVE_INTEGER, and the binary types ExessDatatype.EXESS_HEX and ExessDatatype.EXESS_BASE64.

uint8_t exess_value_sizes[EXESS_MAX_DATATYPE + 1U]

Array of binary value sizes, indexed by datatype.

Each entry is the size of the binary representation of the indexed datatype (not a string length), or zero for values that can be arbitrarily large.