Skip to content

TStaticString<TStorage>

A UTF-8 string with fixed static capacity and contiguous inplace storage. The string class uses Unicode (ISO/IEC 10646) terminology throughout its interface. In particular: - A code point is the numerical index assigned to a character in the Unicode standard. - A code unit is the basic component of a character encoding system. For UTF-8, the code unit has a size of 8-bits For example, the code point U+0041 represents the letter 'A' and can be encoded in a single 8-bit code unit in UTF-8. The code point U+1F4A9 requires four 8-bit code units in the UTF-8 encoding.

Definition

Unit: Neslib.Iceoryx2.Containers

type TStaticString<TStorage> = record ... end;

Type Parameters

TStorage: A dummy data type whose size is the maximum number of UTF-8 code units that the string can store, excluding the terminating NUL character. You can use one of the T*Bytes types or create your own.

Remarks

The NUL code point (U+0000) is not allowed anywhere in the string.

The layout of this record is compatible with its C++ and Rust counterparts, so it can be used for cross-language communication.

Methods

Name Description
Init Constructs a static string from a Unicode string.
InitUtf8 Constructs a static string from a UTF8String.
ToDebugString Returns a string-presentation of the vector for debugging purposes
ToString Converts the static string to a Unicode string
ToStringUtf8 Converts the static string to a UTF8String

Method Descriptions

Init(String)

Constructs a static string from a Unicode string.

function Init(const AStr: String): Boolean

Parameters

AStr: String

Returns

Boolean: True if the string fits into this static string (after UTF-8 conversion). False otherwise.

Remarks

Use InitUtf8 for a more efficient version that bypasses UTF-8 conversion.


InitUtf8(UTF8String)

Constructs a static string from a UTF8String.

function InitUtf8(const AStr: UTF8String): Boolean

Parameters

AStr: UTF8String

Returns

Boolean: True if the string fits into this static string. False otherwise.


ToDebugString

Returns a string-presentation of the vector for debugging purposes

function ToDebugString: String

Returns

String


ToString

Converts the static string to a Unicode string

function ToString: String; inline

Returns

String

Remarks

Use ToStringUtf8 for a more efficient version that bypasses UTF-8 conversion.


ToStringUtf8

Converts the static string to a UTF8String

function ToStringUtf8: UTF8String; inline

Returns

UTF8String