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
220 kInlineFx(kStatus) kString_Split(kString str, const kChar* delimiters, kArrayList* tokens, kAlloc allocator)
221 {
222 return kString_SplitEx(str, delimiters, tokens, kFALSE, allocator);
223 }
224
238 kFx(kStatus) kString_SplitEx(kString str, const kChar* delimiters, kArrayList* tokens, kBool discardEmpty, kAlloc allocator);
239
247 kInlineFx(kChar*) kString_Chars(kString str)
248 {
249 kObj(kString, str);
250
251 return obj->chars;
252 }
253
264 kInlineFx(kSize) kString_Length(kString str)
265 {
266 kObj(kString, str);
267
268 return obj->length;
269 }
270
278 kInlineFx(kSize) kString_Capacity(kString str)
279 {
280 kObj(kString, str);
281
282 return obj->capacity;
283 }
284
285 #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:2923
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:247
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.
Definition: kString.h:220
kString::kString_Capacity
kSize kString_Capacity(kString str)
Returns the number of character units that can be stored without reallocation.
Definition: kString.h:278
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.
kBool::kFALSE
#define kFALSE
Boolean false.
Definition: kApiDef.h:355
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:264
kString::kString_Trim
kStatus kString_Trim(kString str)
Removes leading and trailing whitespace.
kString::kString_SplitEx
kStatus kString_SplitEx(kString str, const kChar *delimiters, kArrayList *tokens, kBool discardEmpty, kAlloc allocator)
Splits this string into substrings using the supplied delimiters.