Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kString.h
Go to the documentation of this file.
1
10 #ifndef K_API_STRING_H
11 #define K_API_STRING_H
12
13 #include <kApi/kApiDef.h>
14 #include <kApi/Data/kString.x.h>
15
28 //typedef kObject kString; --forward-declared in kApiDef.x.h
29
39 kFx(kStatus) kString_Construct(kString* str, const kChar* content, kAlloc allocator);
40
49 kFx(kStatus) kString_Assign(kString str, kString source);
50
58 kFx(kStatus) kString_Clear(kString str);
59
70 kFx(kStatus) kString_Reserve(kString str, kSize minimumCapacity);
71
89 kFx(kStatus) kString_SetLength(kString str, kSize length);
90
99 kFx(kStatus) kString_Set(kString str, const kChar* content);
100
111 kFx(kStatus) kString_Setf(kString str, const kChar* format, ...);
112
122 kFx(kStatus) kString_Setvf(kString str, const kChar* format, kVarArgList argList);
123
132 kFx(kStatus) kString_Add(kString str, const kChar* content);
133
144 kFx(kStatus) kString_Addf(kString str, const kChar* format, ...);
145
155 kFx(kStatus) kString_Addvf(kString str, const kChar* format, kVarArgList argList);
156
167 kFx(kStatus) kString_AddSubstring(kString str, const kChar* content, kSize start, kSize count);
168
182 kFx(k32s) kString_Compare(kString str, const kChar* content);
183
192 kFx(kBool) kString_Equals(kString str, const kChar* content);
193
201 kFx(kStatus) kString_Trim(kString str);
202
215 kFx(kStatus) kString_Split(kString str, const kChar* delimiters, kArrayList* tokens, kAlloc allocator);
216
224 kInlineFx(kChar*) kString_Chars(kString str)
225 {
226 kObj(kString, str);
227
228 return obj->chars;
229 }
230
241 kInlineFx(kSize) kString_Length(kString str)
242 {
243 kObj(kString, str);
244
245 return obj->length;
246 }
247
255 kInlineFx(kSize) kString_Capacity(kString str)
256 {
257 kObj(kString, str);
258
259 return obj->capacity;
260 }
261
262 #endif
kString::kString_Set
kStatus kString_Set(kString str, const kChar *content)
Sets the content of the string.
kString::kString_Add
kStatus kString_Add(kString str, const kChar *content)
Appends content to the string.
kString::kString_Setf
kStatus kString_Setf(kString str, const kChar *format,...)
Sets the content of the string using a printf-like format string and arguments.
kString::kString_Equals
kBool kString_Equals(kString str, const kChar *content)
Compares this string to another character sequence to determine equality.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kString::kString_Clear
kStatus kString_Clear(kString str)
Sets the length of the string to zero.
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kString::kString_Addvf
kStatus kString_Addvf(kString str, const kChar *format, kVarArgList argList)
Variable-argument version of kString_Addf.
kChar
Represents a single unit (byte) in a UTF-8 character.
kString::kString_Reserve
kStatus kString_Reserve(kString str, kSize minimumCapacity)
Ensures that capacity is reserved for at least the specified number of character units (excluding nul...
kString::kString_Setvf
kStatus kString_Setvf(kString str, const kChar *format, kVarArgList argList)
Variable-argument version of kString_Setf.
kObj
#define kObj(TypeName_T, T_object)
Declares a local "obj" (this-pointer) variable and initializes it from a type-checked object handle...
Definition: kApiDef.h:2858
kString::kString_Addf
kStatus kString_Addf(kString str, const kChar *format,...)
Appends content to the string using a printf-like format string and arguments.
kString::kString_Chars
kChar * kString_Chars(kString str)
Returns a pointer to the internal character buffer.
Definition: kString.h:224
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kString::kString_Split
kStatus kString_Split(kString str, const kChar *delimiters, kArrayList *tokens, kAlloc allocator)
Splits this string into substrings using the supplied delimiters.
kString::kString_Capacity
kSize kString_Capacity(kString str)
Returns the number of character units that can be stored without reallocation.
Definition: kString.h:255
kString
Represents a character string.
kString::kString_Construct
kStatus kString_Construct(kString *str, const kChar *content, kAlloc allocator)
Constructs a kString object.
kArrayList
Represents a list implemented with a dynamic array.
kStatus
Represents an error code.
kString::kString_Compare
k32s kString_Compare(kString str, const kChar *content)
Compares this string to another string.
kString::kString_Assign
kStatus kString_Assign(kString str, kString source)
Copies the source string content.
kString::kString_AddSubstring
kStatus kString_AddSubstring(kString str, const kChar *content, kSize start, kSize count)
Appends a portion of another string to this string.
kBool
Represents a boolean value.
kString::kString_SetLength
kStatus kString_SetLength(kString str, kSize length)
Explicitly sets the length of the string.
kString::kString_Length
kSize kString_Length(kString str)
Returns the number of character units in the string buffer (excluding null-terminator).
Definition: kString.h:241
kString::kString_Trim
kStatus kString_Trim(kString str)
Removes leading and trailing whitespace.