Michael Heilmann's Arcadia Ring 2
This is the documentation for Michael Heilmann's Arcadia Ring 2. Arcadia Ring 2 facilitates the creation of C programs - in particular interpreters - that are portable, maintainable, as well as safe. Arcadia Ring 2 is available at michaelheilmann.com/Arcadia/Ring2.
Features:
- UTF-8 strings and string buffers, decoders and encoders
- 32 and 64 Bit IEEE 754 floating point <=> UTF-8 string conversions based on the works of Steele & White, Gay, Clinger, Lemire & Musthak.
- Other scalar types (Void, Boolean, Integer, Natural) <=> UTF-8 string conversions
- aggregates (array lists, array deques, hash maps)
- File System implementation for Windows and Linux supporting creation and deletation of files, reading and writing files, enumerating contents of folder
Files
You can find the sources of Arcadia Ring 2 in my GitHub repository https://github.com/michaelheilmann/arcadia. The subdirectory of Arcadia Ring 2 in the repository is here https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2.
- The (sources of the) library resides in the directory https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2/Library
- The (sources of) tests reside in the directory https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2/Tests
- The (sources of this very documentation you are reading) documentation reside in the directory https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2/Documentation
Arcadia Ring 2 supports various platforms (including but not restricted to Windows, Linux, and many more), however, we currently only officially support Windows. For instructions on how to build, test, and use Arcadia Ring 1, refer to README.md in the root folder of the repository.
Further References
Arcadia Ring 2 relies on Arcadia Ring 1 and Arcadia ARMS.
Documentation
Objects
Arcadia_Object
Arcadia_Object is the ancestor type from which so called object types derive from.
Arcadia_Object types are allocated on the heap and can are referenced by Arcadia_Object* pointers.
Arcadia_Object_getHash
Arcadia_SizeValue
Arcadia_Object_getHash
(
Arcadia_Thread* thread,
Arcadia_Object* self
)
Arcadia_Object or derived type value.
Parameters
Arcadia_Thread object.Return value
The hash of this code>Arcadia_Object or derived type value.
Arcadia_Object_isEqualTo
Arcadia_BooleanValue
Arcadia_Object_isEqualTo_pn
(
Arcadia_Thread* thread,
Arcadia_Object* self,
Arcadia_Value other
)
Arcadia_Object or derived type value is equal to the specified value other.
Parameters
Arcadia_Thread object.Return value
Arcadia_BooleanValue_True if this code>Arcadia_Object or derived type value is equal to the other value.
Arcadia_BooleanValue_False otherwise.
Arcadia_Object_isNotEqualTo
Arcadia_BooleanValue
Arcadia_Object_isEqualTo_pn
(
Arcadia_Thread* thread,
Arcadia_Object* self,
Arcadia_Value other
)
Arcadia_Object or derived type value is not equal to the specified value other.
Parameters
Arcadia_Thread object.Return value
Arcadia_BooleanValue_True if this code>Arcadia_Object or derived type value is not equal to the other value.
Arcadia_BooleanValue_False otherwise.
Arcadia_ByteArray
Arcadia_ByteArray extends Arcadia_Object.
Arcadia_ByteArray represents a mutable sequence of Bytes.
Arcadia_ByteArray_getAt
Arcadia_Natural8Value
Arcadia_ByteArray_getAt
(
Arcadia_Thread* thread,
Arcadia_ByteArray const* self,
Arcadia_SizeValue index
)
Parameters
Arcadia_Thread object.[0,n) where n is the size of this Byte array.Return value
The Byte value.
Arcadia_ByteArray_getBytes
void const*
Arcadia_ByteArray_getBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArray const* self
)
Parameters
Arcadia_Thread object.Return value
A pointer to the Bytes in this Byte array.
Arcadia_ByteArray_getNumberOfBytes
Arcadia_SizeValue
Arcadia_ByteArray_getNumberOfBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArray const* self
)
Parameters
Arcadia_Thread object.Return value
The size of this Byte array.
Arcadia_ByteArray_getSize
Arcadia_SizeValue
Arcadia_ByteArray_getSize
(
Arcadia_Thread* thread,
Arcadia_ByteArray const* self
)
Parameters
Arcadia_Thread object.Return value
The size of this Byte array.
Arcadia_ByteArray_isEmpty
Arcadia_BooleanValue
Arcadia_ByteArray_isEmpty
(
Arcadia_Thread* thread,
Arcadia_ByteArray* self
)
Parameters
Arcadia_Thread object.Return value
Arcadia_BooleanValue_True if this Byte array is empty. Arcadia_BooleanValue_False otherwise.
Errors
self is a null pointer.Arcadia_ByteArrayBuilder_create
Arcadia_ByteArrayBuilder*
Arcadia_ByteArrayBuilder_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread object.Errors
Return value
A pointer to the Arcadia_ByteArrayBuilder object.
Arcadia_ByteArrayBuilder
Arcadia_ByteArrayBuilder extends Arcadia_Object.
Arcadia_ByteArrayBuilder represents a mutable sequence of Bytes.
Arcadia_ByteArrayBuilder_clear
void
Arcadia_ByteArrayBuilder_clear
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self
)
Parameters
Arcadia_Thread object.Arcadia_ByteArrayBuilder_create
Arcadia_ByteArrayBuilder*
Arcadia_ByteArrayBuilder_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread object.Errors
Return value
A pointer to the Arcadia_ByteArrayBuilder object.
Arcadia_ByteArrayBuilder_getBytes
void const*
Arcadia_ByteArrayBuilder_getBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder const* self
)
Parameters
Arcadia_Thread object.Return value
A pointer to the Bytes in this Byte buffer.
Arcadia_ByteArrayBuilder_getNumberOfBytes
Arcadia_SizeValue
Arcadia_ByteArrayBuilder_getNumberOfBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder const* self
)
Parameters
Arcadia_Thread object.Return value
The size of this Byte buffer.
Arcadia_ByteArrayBuilder_getSize
Arcadia_SizeValue
Arcadia_ByteArrayBuilder_getSize
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder const* self
)
Parameters
Arcadia_Thread object.Return value
The size of this Byte buffer.
Arcadia_ByteArrayBuilder_insertBackBytes
void
Arcadia_ByteArrayBuilder_insertBackBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Errors
self is a null pointer.bytes is a null pointer.Arcadia_ByteArrayBuilder_insertBytes
void
Arcadia_ByteArrayBuilder_insertBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self,
Arcadia_SizeValue index,
void const* p,
Arcadia_SizeValue n
)
Parameters
Arcadia_Thread object.[0,n) where n is the size of this Byte buffer.n Bytes.p.Errors
self is a null pointer.bytes is a null pointer.Arcadia_ByteArrayBuilder_insertFrontBytes
void
Arcadia_ByteArrayBuilder_insertFrontBytes
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self,
void const* p,
Arcadia_SizeValue n
)
Parameters
Arcadia_Thread object.n Bytes.p.Errors
self is a null pointer.bytes is a null pointer.Arcadia_ByteArrayBuilder_endsWith_pn
Arcadia_BooleanValue
Arcadia_ByteArrayBuilder_endsWith_pn
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Return value
Arcadia_BooleanValue_True if the sequence of Bytes is a suffix of this byte buffer's sequence of Bytes.
Arcadia_BooleanValue_False otherwise.
Arcadia_ByteArrayBuilder_startsWith_pn
Arcadia_BooleanValue
Arcadia_ByteArrayBuilder_startsWith_pn
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Return value
Arcadia_BooleanValue_True if the sequence of Bytes is a prefix of this byte buffer's sequence of Bytes.
Arcadia_BooleanValue_False otherwise.
Arcadia_isEqualTo_pn
Arcadia_BooleanValue
Arcadia_ByteArrayBuilder_isEqualTo_pn
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Return value
Arcadia_BooleanValue_True if the sequence of Bytes is this byte buffer's sequence of Bytes.
Arcadia_BooleanValue_False otherwise.
Arcadia_ByteArrayBuilder_isEqualTo
Arcadia_BooleanValue
Arcadia_ByteArrayBuilder_isEqualTo
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder const* self,
Arcadia_ByteArrayBuilder const* other
)
Parameters
Arcadia_Thread object.Return value
Arcadia_BooleanValue_True if this Byte buffer is equal to the other Byte buffer.
Arcadia_BooleanValue_False otherwise.
Arcadia_ByteArrayBuilder_getAt
Arcadia_Natural8Value
Arcadia_ByteArrayBuilder_getAt
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder const* self,
Arcadia_SizeValue index
)
Parameters
Arcadia_Thread object.[0,n) where n is the size of this Byte buffer.Return value
The Byte value.
Arcadia_ByteArrayBuilder_isEmpty
Arcadia_BooleanValue
Arcadia_ByteArrayBuilder_isEmpty
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self
)
Parameters
Arcadia_Thread object.Return value
Arcadia_BooleanValue_True if this Byte buffer is empty. Arcadia_BooleanValue_False otherwise.
Errors
self is a null pointer.Arcadia_ByteArrayBuilder_swap
void
Arcadia_ByteArrayBuilder_swap
(
Arcadia_Thread* thread,
Arcadia_ByteArrayBuilder* self,
Arcadia_ByteArrayBuilder* other
)
Parameters
Arcadia_Thread object.Errors
self is a null pointer.other is a null pointer.Arcadia_String
Arcadia_String extends Arcadia_Object.
Arcadia_String represents an immutable sequence of Unicode code points in UTF8 encoding.
Arcadia_String derives fro Arcadia_Object and overrides the following methods:
- Arcadia_Object_isEqualTo
- Arcadia_Object_isNotEqualTo
- Arcadia_Object_getHash
Arcadia_String_createFromBoolean
Arcadia_String*
Arcadia_String_createFromBoolean
(
Arcadia_Thread* thread,
Arcadia_BooleanValue booleanValue
)
Arcadia_BooleanValue value.
The Arcadia_BooleanValue value is converted to the strings true, if its value is Arcadia_BooleanValue_True, and false, if its value is Arcadia_BooleanValue_False, respectively.
Parameters
Arcadia_Thread object.Arcadia_BooleanValue to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromInteger16
Arcadia_String*
Arcadia_String_createFromInteger16
(
Arcadia_Thread* thread,
Arcadia_Integer16Value integer16Value
)
Arcadia_Integer16Value value.
The Arcadia_Integer16Value value is converted to the decimal integer number literal string.
Parameters
Arcadia_Thread object.Arcadia_Integer16Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromInteger32
Arcadia_String*
Arcadia_String_createFromInteger32
(
Arcadia_Thread* thread,
Arcadia_Integer32Value integer32Value
)
Arcadia_Integer32Value value.
The Arcadia_Integer32Value value is converted to the decimal integer number literal string.
Parameters
Arcadia_Thread object.Arcadia_Integer32Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromInteger64
Arcadia_String*
Arcadia_String_createFromInteger64
(
Arcadia_Thread* thread,
Arcadia_Integer64Value integer64Value
)
Arcadia_Integer64Value value.
The Arcadia_Integer64Value value is converted to the decimal integer number literal string.
Parameters
Arcadia_Thread object.Arcadia_Integer64Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromInteger8
Arcadia_String*
Arcadia_String_createFromInteger8
(
Arcadia_Thread* thread,
Arcadia_Integer8Value integer8Value
)
Arcadia_Integer8Value value.
The Arcadia_Integer8Value value is converted to the decimal integer number literal string.
Parameters
Arcadia_Thread object.Arcadia_Integer8Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromNatural16
Arcadia_String*
Arcadia_String_createFromNatural16
(
Arcadia_Thread* thread,
Arcadia_Natural16Value natural64Value
)
Arcadia_Natural16Value value.
The Arcadia_Natural16Value value is converted to the decimal natural number literal string.
Parameters
Arcadia_Thread object.Arcadia_Natural16Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromNatural32
Arcadia_String*
Arcadia_String_createFromNatural32
(
Arcadia_Thread* thread,
Arcadia_Natural32Value natural64Value
)
Arcadia_Natural32Value value.
The Arcadia_Natural32Value value is converted to the decimal natural number literal string.
Parameters
Arcadia_Thread object.Arcadia_Natural32Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromNatural64
Arcadia_String*
Arcadia_String_createFromNatural64
(
Arcadia_Thread* thread,
Arcadia_Natural64Value natural64Value
)
Arcadia_Natural64Value value.
The Arcadia_Natural64Value value is converted to the decimal natural number literal string.
Parameters
Arcadia_Thread object.Arcadia_Natural64Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromNatural8
Arcadia_String*
Arcadia_String_createFromNatural8
(
Arcadia_Thread* thread,
Arcadia_Natural8Value natural64Value
)
Arcadia_Natural8Value value.
The Arcadia_Natural8Value value is converted to the decimal natural number literal string.
Parameters
Arcadia_Thread object.Arcadia_Natural8Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromReal32
Arcadia_String*
Arcadia_String_createFromReal32
(
Arcadia_Thread* thread,
Arcadia_Real32Value real32Value
)
Arcadia_Real3lValue value.
The Arcadia_Real32Value value is converted to the decimal real number literal string.
Parameters
Arcadia_Thread object.Arcadia_Real32Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromReal64
Arcadia_String*
Arcadia_String_createFromReal64
(
Arcadia_Thread* thread,
Arcadia_Real64Value real64Value
)
Arcadia_Real64Value value.
The Arcadia_Real64Value value is converted to the decimal real number literal string.
Parameters
Arcadia_Thread object.Arcadia_Real64Value to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_createFromVoid
Arcadia_String*
Arcadia_String_createFromBoolean
(
Arcadia_Thread* thread,
Arcadia_VoidValue voidValue
)
Arcadia_VoidValue value.
The Arcadia_VoidValue value is converted to the string void.
Parameters
Arcadia_Thread object.Arcadia_VoidValue to be converted into the string value.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_create_pn
Arcadia_String*
Arcadia_String_create_pn
(
Arcadia_Thread* thread,
Arcadia_ImmutableByteArray* immutableByteArray
)
Parameters
Arcadia_Thread object.Arcadia_ImmutableByteArray objectReturn value
A pointer to the Arcadia_String object.
Errors
immutableByteArray is a null pointer.Arcadia_String_create
Arcadia_String*
Arcadia_String_create
(
Arcadia_Thread* thread,
Arcadia_Value value
)
Create a string from a value.
The following values are accepted:
The specified value may contain a Arcadia_ByteBuffer object.
In that case, the string is created from the Bytes of the Byte buffer object.
A Arcadia_Status_EncodingInvalid is raised if the Byte sequence of that Arcada_ByteBuffer object is not a UTF8 Byte sequence.
The specified value may contain a Arcadia_ImmutableByteArray object.
In that case, the string is created from the Arcadia_ImmutableByteArray object.
A Arcadia_Status_EncodingInvalid is raised if the Byte sequence of that Arcada_ImmutableByteArray object is not a UTF8 Byte sequence.
The specified value may contain a Arcadia_String object.
In that case, the string is created from the Arcadia_String object.
The specified value may contain a Arcadia_StringBuffer object.
In that case, the string is created from the Arcadia_StringBuffer object.
The specified value may contain a Arcadia_ImmutableUtf8String object.
In that case, the string is created from the Arcadia_ImmutableUtf8String object.
Parameters
Arcadia_Thread object.
Return value
A pointer to the string.
Errors
Arcadia_ByteBuffer, Arcadia_String, Arcadia_StringBuffer, or Arcadia_ImmutableByteArray.
Arcadia_ByteBuffer or Arcadia_ImmutableByteArray.
However, the Byte sequence of that Arcadia_ByteBuffer or Arcadia_ImmutableByteArray object is not a UTF8 Byte sequence.
Arcadia_String_endsWith_pn
Arcadia_BooleanValue
Arcadia_String_endsWith_pn
(
Arcadia_Thread* thread,
Arcadia_String const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Return value
Arcadia_BooleanValue_True if the sequence of Bytes is a suffix of this string's sequence of Bytes.
Arcadia_BooleanValue_False otherwise.
Arcadia_String_startsWith_pn
Arcadia_BooleanValue
Arcadia_String_startsWith_pn
(
Arcadia_Thread* thread,
Arcadia_String const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Return value
Arcadia_BooleanValue_True if the sequence of Bytes is a prefix of this string's sequence of Bytes.
Arcadia_BooleanValue_False otherwise.
Arcadia_String_isEqualTo_pn
Arcadia_BooleanValue
Arcadia_String_isEqualTo_pn
(
Arcadia_Thread* thread,
Arcadia_String const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread object.n Bytes.p.Return value
Arcadia_BooleanValue_True if the sequence of Bytes is this string's sequence of Bytes.
Arcadia_BooleanValue_False otherwise.
Arcadia_String_getNumberOfBytes
Arcadia_SizeValue
Arcadia_String_getNumberOfBytes
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Parameters
Arcadia_Thread object.Return value
The size, in Bytes, of this string.
Arcadia_String_getByteAt
Arcadia_Natural8Value
Arcadia_String_getByteAt
(
Arcadia_String const* self,
Arcadia_SizeValue index
)
Parameters
Arcadia_Thread object.[0,n) where n is the size, in Bytes, of this string.Return value
The Byte value.
Arcadia_String_toBoolean
Arcadia_BooleanValue
Arcadia_String_toBoolean
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_BooleanValue.
Parameters
Arcadia_Thread object.Return value
The boolean value.
Errors
self is a null pointer.true and false, both case sensitve.Arcadia_String_toInteger16
Arcadia_Integer16Value
Arcadia_String_toInteger16
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer16Value.
Parameters
Arcadia_Thread object.Return value
The integer value.
Errors
self is a null pointer.Arcadia_Integer16Value.Arcadia_String_toInteger32
Arcadia_Integer32Value
Arcadia_String_toInteger32
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer32Value.
Parameters
Arcadia_Thread object.Return value
The integer value.
Errors
self is a null pointer.
Arcadia_Integer32Value.
Arcadia_String_toInteger64
Arcadia_Integer64Value
Arcadia_String_toInteger64
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer64Value.
Parameters
Arcadia_Thread object.Return value
The integer value.
Errors
self is a null pointer.
Arcadia_Integer64Value.Arcadia_String_toInteger8
Arcadia_Integer8Value
Arcadia_String_toInteger8
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer8Value.
Parameters
Arcadia_Thread object.Return value
The integer value.
Errors
self is a null pointer.
Arcadia_Integer8Value.Arcadia_String_toNatural16
Arcadia_Natural16Value
Arcadia_Stringg_toNatural16
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural16Value.
Parameters
Arcadia_Thread object.Return value
The natural value.
Errors
self is a null pointer.Arcadia_Natural16Value.Arcadia_String_toNatural32
Arcadia_Natural32Value
Arcadia_String_toNatural32
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural32Value.
Parameters
Arcadia_Thread object.Return value
The natural value.
Errors
self is a null pointer.Arcadia_Natural32Value.Arcadia_String_toNatural64
Arcadia_Natural64Value
Arcadia_String_toNatural64
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural64Value.
Parameters
Arcadia_Thread object.Return value
The natural value.
Errors
self is a null pointer.Arcadia_Natural64Value.Arcadia_String_toNatural8
Arcadia_Natural8Value
Arcadia_String_toNatural8
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural8Value.
Parameters
Arcadia_Thread object.Return value
The natural value.
Errors
self is a null pointer.Arcadia_Natural8Value.Arcadia_String_toReal32
Arcadia_Real32Value
Arcadia_String_toReal32
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Real32Value.
Parameters
Arcadia_Thread object.Return value
The Arcadia_Real32Value value.
Errors
self is a null pointer.Arcadia_Real32Value.Arcadia_String_toReal64
Arcadia_Real64Value
Arcadia_String_toReal64
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Real64Value.
Parameters
Arcadia_Thread object.Return value
The Arcadia_Real64Value value.
Errors
self is a null pointer.Arcadia_Real64Value.Arcadia_String_toVoid
Arcadia_VoidValue
Arcadia_String_toVoid
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_VoidValue.
Parameters
Arcadia_Thread object.Return value
The void value.
Errors
self is a null pointer.void, case sensitve.Arcadia_StringBuilder
Arcadia_StringBuilder extends Arcadia_Object.
Arcadia_StringBuilder represents a mutable sequence of code points in UTF8 encoding.
Arcadia_StringBuilder_clear
void
Arcadia_StringBuilder_clear
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self
)
Parameters
Arcadia_Thread object.Arcadia_StringBuilder_create
Arcadia_StringBuilder*
Arcadia_StringBuilder_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread object.Errors
Return value
A pointer to the Arcadia_StringBuilder value.
Arcadia_StringBuilder_compareTo
Arcadia_Integer32Value*
Arcadia_StringBuilder_compareTo
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
Arcadia_Value other
)
Parameters
Arcadia_Thread object.Arcadia.ImmutableUtf8String, Arcadia.StringBuilder, or Arcadia.String.
Errors
Return value
- A negative value is returned if the string in this string buffer is lexicographically less than the other string.
- A positive value is returned if the string in this string buffer is lexicographically greater than the other string.
- If both strings are lexicographically equal, then zero is returned.
Remarks
Leta and b be UTF-8 strings of n and m Bytes, respectively.
Denote the i-th Byte of a by a[i] (given a is not empty) and the i-th Byte of b by b[i] (given that b is not empty), respectively.
Then comparing a and b lexicographically means:
Let l := min(n,m).
If l is 0 or a[i] = b[i] for all i in [0, l-1], then
ais lexicographically less thanbifn < mais lexicographically greater thanbifn > maandbare lexicographically equal ifn = m
Otherwise there exists an i in [0, l - 1] such that for all a[j] = b[j] for all j < i holds and a[i] != b[i].
In that case:
ais lexicographically less thanbifa[i] < b[i]ais lexicographically greater thanbifa[i] > b[i]
Arcadia_StringBuilder_getNumberOfBytes
Arcadia_SizeValue
Arcadia_StringBuilder_getNumberOfBytes
(
Arcadia_Thread* thread,
Arcadia_StringBuilder self
)
Parameters
Arcadia_Thread object.Return value
The number of Bytes in this string buffer.
Arcadia_StringBuilder_insertAt
void
Arcadia_StringBuilder_insertAt
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
Arcadia_SizeValue index,
Arcadia_Value value
)
Parameters
Arcadia_Thread object.Arcadia.ImmutableByteArray, Arcadia.ImmutableUtf8String,
Arcadia.ByteBuffer, Arcadia.StringBuilder, or Arcadia.String.
Errors
value is not of an accepted type.index is not within the bounds of [0,n] where n is the number of code points in this string buffer.value is of type Arcadia.ImmutableByteArray or Arcadia.ByteBuffer and the Bytes are not a valid UTF-8 Byte sequence.Arcadia_StringBuilder_insertBack
void
Arcadia_StringBuilder_insertFront
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread object.Arcadia.ImmutableByteArray, Arcadia.ImmutableUtf8String,
Arcadia.ByteBuffer, Arcadia.StringBuilder, or Arcadia.String.
Errors
value is not of an accepted type.value is of type Arcadia.ImmutableByteArray or Arcadia.ByteBuffer and the Bytes are not a valid UTF-8 Byte sequence.Arcadia_StringBuilder_insertFront
void
Arcadia_StringBuilder_insertFront
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread object.Arcadia.ImmutableByteArray, Arcadia.ImmutableUtf8String,
Arcadia.ByteBuffer, Arcadia.StringBuilder, or Arcadia.String.
Errors
value is not of an accepted type.value is of type Arcadia.ImmutableByteArray or Arcadia.ByteBuffer and the Bytes are not a valid UTF-8 Byte sequence.Arcadia_StringBuilder_isEmpty
Arcadia_BooleanValue
Arcadia_StringBuilder_isEmpty
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self
)
Parameters
Arcadia_Thread object.Return value
Arcadia_BooleanValue_True if this string buffer is empty. Arcadia_BooleanValue_False otherwise.
Errors
self is a null pointer.