Ultralight C API 1.3.0
Loading...
Searching...
No Matches
CAPI_String.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is a part of Ultralight, an ultra-portable web-browser engine. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2023 Ultralight, Inc. *
7 *****************************************************************************/
8#ifndef ULTRALIGHT_CAPI_STRING_H
9#define ULTRALIGHT_CAPI_STRING_H
10
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/******************************************************************************
18 * String
19 *****************************************************************************/
20
21///
22/// Create string from null-terminated ASCII C-string.
23///
25
26///
27/// Create string from UTF-8 buffer.
28///
29ULExport ULString ulCreateStringUTF8(const char* str, size_t len);
30
31///
32/// Create string from UTF-16 buffer.
33///
35
36///
37/// Create string from copy of existing string.
38///
40
41///
42/// Destroy string (you should destroy any strings you explicitly Create).
43///
45
46///
47/// Get native UTF-8 buffer data (always null-terminated).
48///
50
51///
52/// Get length (in bytes) of the UTF-8 buffer data, not including null terminator.
53///
55
56///
57/// Whether this string is empty or not.
58///
60
61///
62/// Replaces the contents of 'str' with the contents of 'new_str'
63///
65
66///
67/// Replaces the contents of 'str' with the contents of a C-string.
68///
69ULExport void ulStringAssignCString(ULString str, const char* c_str);
70
71#ifdef __cplusplus
72} // extern "C"
73#endif
74
75#endif // ULTRALIGHT_CAPI_STRING_H
unsigned short ULChar16
Definition CAPI_Defines.h:41
struct C_String * ULString
Definition CAPI_Defines.h:54
#define ULExport
Definition CAPI_Defines.h:27
ULExport char * ulStringGetData(ULString str)
Get native UTF-8 buffer data (always null-terminated).
ULExport ULString ulCreateStringUTF8(const char *str, size_t len)
Create string from UTF-8 buffer.
ULExport bool ulStringIsEmpty(ULString str)
Whether this string is empty or not.
ULExport void ulStringAssignCString(ULString str, const char *c_str)
Replaces the contents of 'str' with the contents of a C-string.
ULExport ULString ulCreateStringFromCopy(ULString str)
Create string from copy of existing string.
ULExport void ulDestroyString(ULString str)
Destroy string (you should destroy any strings you explicitly Create).
ULExport ULString ulCreateStringUTF16(ULChar16 *str, size_t len)
Create string from UTF-16 buffer.
ULExport ULString ulCreateString(const char *str)
Create string from null-terminated ASCII C-string.
ULExport void ulStringAssignString(ULString str, ULString new_str)
Replaces the contents of 'str' with the contents of 'new_str'.
ULExport size_t ulStringGetLength(ULString str)
Get length (in bytes) of the UTF-8 buffer data, not including null terminator.