Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kUtils.h
Go to the documentation of this file.
1
10 #include <kApi/kApiDef.h> //--inclusion order controlled by kApiDef
11
12 #ifndef K_API_UTILS_H
13 #define K_API_UTILS_H
14
15 kBeginHeader()
16
17
31 kFx(kStatus) kDestroyRef(kObject* object);
32
40 kFx(kStatus) kDisposeRef(kObject* object);
41
50 kFx(kStatus) kShareRef(kObject* object, kObject source);
51
63 kFx(kStatus) kReplaceRef(kObject* object, kObject source);
64
74 kFx(kStatus) kLoad5(kObject* object, const kChar* fileName, kAlloc allocator);
75
84 kFx(kStatus) kSave5(kObject object, const kChar* fileName);
85
95 kFx(kStatus) kLoad6(kObject* object, const kChar* fileName, kAlloc allocator);
96
105 kFx(kStatus) kSave6(kObject object, const kChar* fileName);
106
117 kFx(kStatus) kMemAlloc(kSize size, void* mem);
118
129 kFx(kStatus) kMemAllocZero(kSize size, void* mem);
130
138 kFx(kStatus) kMemFree(void* mem);
139
147 kFx(kStatus) kMemFreeRef(void* mem);
148
158 kFx(kStatus) kMemSet(void* dest, kByte fill, kSize size);
159
169 kFx(kStatus) kMemCopy(void* dest, const void* src, kSize size);
170
180 kFx(kStatus) kMemMove(void* dest, const void* src, kSize size);
181
191 kFx(kBool) kMemEquals(const void* a, const void* b, kSize size);
192
207 kFx(kStatus) kStrCopy(kChar* dest, kSize capacity, const kChar* src);
208
223 kFx(kStatus) kStrCat(kChar* dest, kSize capacity, const kChar* src);
224
234 kFx(kStatus) kStrToLower(kChar* str);
235
244 kFx(kBool) kStrEquals(const kChar* a, const kChar* b);
245
255 kFx(kBool) kStrnEquals(const kChar* a, const kChar* b, kSize maxCount);
256
270 kFx(k32s) kStrCompare(const kChar* a, const kChar* b);
271
286 kFx(k32s) kStrnCompare(const kChar* a, const kChar* b, kSize maxCount);
287
298 kFx(k32s) kStrCompareLower(const kChar* a, const kChar* b);
299
307 kFx(kSize) kStrLength(const kChar* str);
308
317 kFx(const kChar*) kStrFindFirst(const kChar* str, const kChar* subStr);
318
327 kFx(const kChar*) kStrFindLast(const kChar* str, const kChar* subStr);
328
343 kFx(kStatus) kStrPrintf(kChar* dest, kSize capacity, const kChar* format, ...);
344
356 kFx(kStatus) kStrPrintvf(kChar* dest, kSize capacity, const kChar* format, kVarArgList argList);
357
366 kFx(kStatus) kLogf(const kChar* format, ...);
367
377 kFx(kStatus) kLogvf(const kChar* format, kVarArgList argList);
378
385 kFx(k32u) kRandom32u();
386
393 kFx(k64u) kRandom64u();
394
401 kFx(kSize) kRandomSize();
402
410 kFx(kChar) kChar_ToLower(kChar ch);
411
419 kFx(kChar) kChar_ToUpper(kChar ch);
420
428 kFx(kBool) kChar_IsSpace(kChar ch);
429
437 kFx(kBool) kChar_IsLetter(kChar ch);
438
446 kFx(kBool) kChar_IsDigit(kChar ch);
447
448 #define kChar_ToLower_(IN) kxChar_ToLower_(IN)
449 #define kChar_ToUpper_(IN) kxChar_ToUpper_(IN)
450
451 kEndHeader()
452
453 #include <kApi/Utils/kUtils.x.h>
454
455 #endif
kUtils::kStrLength
kSize kStrLength(const kChar *str)
Determines the number of kChar units in a characater sequence.
k32u
Represents a 32-bit unsigned integer.
kUtils::kChar_ToUpper
kChar kChar_ToUpper(kChar ch)
Convert ASCII character to upper case.
kUtils::kStrPrintvf
kStatus kStrPrintvf(kChar *dest, kSize capacity, const kChar *format, kVarArgList argList)
Variable-argument version of kStrPrintf.
kUtils::kStrnCompare
k32s kStrnCompare(const kChar *a, const kChar *b, kSize maxCount)
Compares one string to another, only up to a maximum number of characters.
kUtils::kMemFree
kStatus kMemFree(void *mem)
Frees a block of memory that was allocated using kMemAlloc or kMemAllocZero.
k64u
Represents a 64-bit unsigned integer.
kUtils::kLoad5
kStatus kLoad5(kObject *object, const kChar *fileName, kAlloc allocator)
Loads an object from file using kDat-5 serialization.
kUtils::kStrCat
kStatus kStrCat(kChar *dest, kSize capacity, const kChar *src)
Appends characters from source to destination.
kUtils::kChar_IsLetter
kBool kChar_IsLetter(kChar ch)
Checks whether ASCII character is a letter.
kUtils::kMemMove
kStatus kMemMove(void *dest, const void *src, kSize size)
Copies memory from a source buffer to a potentially-overlapping destination.
kUtils::kStrCompareLower
k32s kStrCompareLower(const kChar *a, const kChar *b)
Performs a case-insenstive comparison of two strings.
kUtils::kLogvf
kStatus kLogvf(const kChar *format, kVarArgList argList)
Variable-argument version of kLogf.
kUtils::kChar_ToLower
kChar kChar_ToLower(kChar ch)
Convert ASCII character to lower case.
kUtils::kStrFindLast
const kChar * kStrFindLast(const kChar *str, const kChar *subStr)
Finds the last occurrence of a character sequence.
kUtils::kStrEquals
kBool kStrEquals(const kChar *a, const kChar *b)
Tests a pair of character sequences for equality.
kUtils::kSave5
kStatus kSave5(kObject object, const kChar *fileName)
Saves an object to file using kDat-5 serialization.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kUtils::kMemAlloc
kStatus kMemAlloc(kSize size, void *mem)
Allocates a block of memory from the application heap.
kUtils::kShareRef
kStatus kShareRef(kObject *object, kObject source)
Shares an object and sets a handle to refer to the shared object.
kUtils::kChar_IsSpace
kBool kChar_IsSpace(kChar ch)
Checks whether ASCII character is a some kind of white space character type.
kUtils::kStrCompare
k32s kStrCompare(const kChar *a, const kChar *b)
Compares one string to another.
kUtils::kStrToLower
kStatus kStrToLower(kChar *str)
Converts characters in the given sequence to lower case.
kUtils::kMemEquals
kBool kMemEquals(const void *a, const void *b, kSize size)
Compares one memory buffer with another.
kUtils::kMemCopy
kStatus kMemCopy(void *dest, const void *src, kSize size)
Copies memory from a source buffer to a non-overlapping destination.
kChar
Represents a single unit (byte) in a UTF-8 character.
kByte
Represents a byte on the current platform.
kUtils::kDisposeRef
kStatus kDisposeRef(kObject *object)
Disposes an object and resets the object handle to kNULL.
kUtils::kMemFreeRef
kStatus kMemFreeRef(void *mem)
Frees a block of memory that was allocated using kMemAlloc or kMemAllocZero and resets the memory poi...
kUtils::kRandom32u
k32u kRandom32u()
Generates a random 32-bit number.
kUtils::kDestroyRef
kStatus kDestroyRef(kObject *object)
Destroys an object and resets the object handle to kNULL.
kUtils::kLogf
kStatus kLogf(const kChar *format,...)
Writes to logging handler (if registered).
kUtils::kSave6
kStatus kSave6(kObject object, const kChar *fileName)
Saves an object to file using kDat-6 serialization.
kUtils::kLoad6
kStatus kLoad6(kObject *object, const kChar *fileName, kAlloc allocator)
Loads an object from file using kDat-6 serialization.
kUtils::kMemAllocZero
kStatus kMemAllocZero(kSize size, void *mem)
Allocates and zero-initializes block of memory from the application heap.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kUtils::kChar_IsDigit
kBool kChar_IsDigit(kChar ch)
Checks whether ASCII character is a digit.
kUtils::kRandom64u
k64u kRandom64u()
Generates a random 64-bit number.
kUtils::kStrPrintf
kStatus kStrPrintf(kChar *dest, kSize capacity, const kChar *format,...)
Formats a string using printf-style arguments.
kUtils::kStrCopy
kStatus kStrCopy(kChar *dest, kSize capacity, const kChar *src)
Copies characters from source to destination.
kUtils::kRandomSize
kSize kRandomSize()
Generates a random number of type kSize.
kObject
Root of all Zen classes.
kStatus
Represents an error code.
kUtils::kStrFindFirst
const kChar * kStrFindFirst(const kChar *str, const kChar *subStr)
Finds the first occurrence of a character sequence.
kBool
Represents a boolean value.
kUtils::kStrnEquals
kBool kStrnEquals(const kChar *a, const kChar *b, kSize maxCount)
Tests a pair of character sequences for equality, up to a maximum number of characters.
kUtils::kReplaceRef
kStatus kReplaceRef(kObject *object, kObject source)
Replaces a reference to existing object with a new object.
kUtils::kMemSet
kStatus kMemSet(void *dest, kByte fill, kSize size)
Sets a block of memory to the given byte value.