Base types

Integers

typedef uint32_t tme_uint_t

Unsigned integer type.

TME_UINT_MAX

Maximum value of a tme_uint_t variable.

TME_UINT_FMT

Format string for tme_uint_t variables.

Bitmasks

struct TmeFlags

Bitmask manipulation API.

Note

This is not a real data structure, though it is declared as such for better grouping in the generated documentation.

Related

TmeFlags(N)

Bitmask type.

Parameters
  • N: Number of bits. Allowed values: 8, 16, 32 and 64.

tme_flags_empty

Empty bitmask.

tme_flags_bit(N)

Returns a bitmask with the specified bit set.

Return

Bitmask with the specified bit set.

Parameters
  • N: Bit to set.

tme_flags_is_set(OPTIONS, OPTION)

Use this directive to check whether a bitmask has specific bits set.

Return

True if the bits are set, false otherwise.

Parameters
  • OPTIONS: Bitmask.

  • OPTION: Bits to check.

tme_flags_is_any_set(OPTIONS, OPTION)

Use this directive to check whether a bitmask has any of the specified bits set.

Return

True if at least one of the specified bits is set, false otherwise.

Parameters
  • OPTIONS: Bitmask.

  • OPTION: Bits to check.

tme_flags_set(OPTIONS, OPTION)

Use this directive to set bits in a bitmask.

Parameters
  • OPTIONS: Bitmask.

  • OPTION: Bits to set.

tme_flags_unset(OPTIONS, OPTION)

Use this directive to unset bits in a bitmask.

Parameters
  • OPTIONS: Bitmask.

  • OPTION: Bits to unset.

tme_flags_toggle(OPTIONS, OPTION)

Use this directive to toggle in a bitmask.

Parameters
  • OPTIONS: Bitmask.

  • OPTION: Bits to toggle.

Strings

struct TmeString

Models strings.

Public Functions

TmeString tme_string_init(char const *cstring)

Creates a new string initialized with the specified string buffer.

Return

String instance.

Note

The string buffer is not copied: it will be deallocated once tme_string_deinit() is called.

Parameters
  • cstring: String buffer.

void tme_string_deinit(TmeString string)

Destroys the specified string, releasing its memory.

Parameters
  • string: String to destroy.

bool tme_string_equals(TmeString a, TmeString b)

Checks whether two strings are equal.

Return

True if the strings are equal, false otherwise.

Parameters
  • a: LHS of the equality relation.

  • b: RHS of the equality relation.

bool tme_string_compare(TmeString a, TmeString b)

Checks whether ‘a’ comes before ‘b’ in lexicographical order.

Return

True if ‘a’ comes before ‘b’, false otherwise.

Parameters
  • a: LHS of the comparison.

  • b: RHS of the comparison.

int tme_string_cmp(TmeString a, TmeString b)

Compares ‘a’ and ‘b’ in lexicographical order.

Return

-1 if ‘a’ comes before ‘b’, 0 if ‘a’ is equal to ‘b’, 1 if ‘a’ comes after ‘b’.

Parameters
  • a: LHS of the comparison.

  • b: RHS of the comparison.

TmeString tme_string_copy(TmeString string)

Copies the specified string.

Return

Copied string.

Parameters
  • string: String to copy.

TmeString tme_string_dup(char const *cstring)

Creates a new string by copying the specified string buffer.

Return

String instance.

Parameters
  • cstring: String buffer.

TmeString tme_string_repeating(char const *cstring, tme_uint_t times)

Creates a new string by repeating the specified string buffer multiple times.

Return

String instance.

Parameters
  • cstring: String buffer.

  • times: Repetitions.

TmeString tme_string_with_format(char const *format, ...)

Creates a new string with the specified format.

Return

String instance.

Parameters
  • format: Format string.

  • ...: Format arguments.

Public Members

char const *cstring

String buffer.

size_t length

String length (excluding the null terminator).