Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kSerializer.h
Go to the documentation of this file.
1
10 #ifndef K_API_SERIALIZER_H
11 #define K_API_SERIALIZER_H
12
13 #include <kApi/kApiDef.h>
14 #include <kApi/Data/kArrayList.h>
15
16 #include <kApi/Io/kSerializer.x.h>
17
139 //typedef kObject kSerializer; --forward-declared in kApiDef.x.h
140
155 kFx(kStatus) kSerializer_Construct(kSerializer* serializer, kStream stream, kType serializerType, kAlloc allocator);
156
167 kFx(kStatus) kSerializer_LoadObject(kObject* object, kType serializerType, const kChar* filePath, kAlloc readAlloc);
168
178 kFx(kStatus) kSerializer_SaveObject(kObject object, kType serializerType, const kChar* filePath);
179
193 kFx(kStatus) kSerializer_SetVersion(kSerializer serializer, kAssembly assembly, kVersion version);
194
206 kInlineFx(kStatus) kSerializer_SetSizeEncoding(kSerializer serializer, k32u byteCount)
207 {
208 kObj(kSerializer, serializer);
209
210 kCheckArgs((byteCount == 4) || (byteCount == 8));
211
212 obj->sizeEncoding = byteCount;
213
214 return kOK;
215 }
216
224 kInlineFx(k32u) kSerializer_SizeEncoding(kSerializer serializer)
225 {
226 kObj(kSerializer, serializer);
227
228 return obj->sizeEncoding;
229 }
230
242 kInlineFx(kStatus) kSerializer_SetEndianness(kSerializer serializer, kEndianness endianness)
243 {
244 kObj(kSerializer, serializer);
245
246 obj->endianness = endianness;
247 obj->swap = kEndianness_ShouldReverse(obj->endianness);
248
249 return kOK;
250 }
251
259 kInlineFx(kEndianness) kSerializer_Endianness(kSerializer serializer)
260 {
261 kObj(kSerializer, serializer);
262
263 return obj->endianness;
264 }
265
274 kInlineFx(kStatus) kSerializer_WriteObject(kSerializer serializer, kObject object)
275 {
276 return xkSerializer_VTable(serializer)->VWriteObject(serializer, object);
277 }
287 kInlineFx(kStatus) kSerializer_ReadObject(kSerializer serializer, kObject* object, kAlloc allocator)
288 {
289 return xkSerializer_VTable(serializer)->VReadObject(serializer, object, allocator);
290 }
291
300 kFx(kStatus) kSerializer_WriteText(kSerializer serializer, const kChar* data);
301
311 kFx(kStatus) kSerializer_ReadText(kSerializer serializer, kChar* data, kSize capacity);
312
321 kInlineFx(kStatus) kSerializer_WriteByte(kSerializer serializer, kByte data)
322 {
323 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_8);
324 }
325
335 kInlineFx(kStatus) kSerializer_WriteByteArray(kSerializer serializer, const void* data, kSize count)
336 {
337 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_8);
338 }
339
348 kInlineFx(kStatus) kSerializer_ReadByte(kSerializer serializer, kByte* data)
349 {
350 kObj(kSerializer, serializer);
351
352 return kStream_Read(obj->readStream, data, 1);
353 }
354
364 kInlineFx(kStatus) kSerializer_ReadByteArray(kSerializer serializer, void* data, kSize count)
365 {
366 kObj(kSerializer, serializer);
367
368 return kStream_Read(obj->readStream, data, count);
369 }
370
379 kInlineFx(kStatus) kSerializer_WriteChar(kSerializer serializer, kChar data)
380 {
381 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_8);
382 }
383
393 kInlineFx(kStatus) kSerializer_WriteCharArray(kSerializer serializer, const kChar* data, kSize count)
394 {
395 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_8);
396 }
397
406 kInlineFx(kStatus) kSerializer_ReadChar(kSerializer serializer, kChar* data)
407 {
408 kObj(kSerializer, serializer);
409
410 return kStream_Read(obj->readStream, data, 1);
411 }
412
422 kInlineFx(kStatus) kSerializer_ReadCharArray(kSerializer serializer, kChar* data, kSize count)
423 {
424 kObj(kSerializer, serializer);
425
426 return kStream_Read(obj->readStream, data, count);
427 }
428
437 kInlineFx(kStatus) kSerializer_Write8u(kSerializer serializer, k8u data)
438 {
439 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_8);
440 }
441
451 kInlineFx(kStatus) kSerializer_Write8uArray(kSerializer serializer, const k8u* data, kSize count)
452 {
453 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_8);
454 }
455
464 kInlineFx(kStatus) kSerializer_Read8u(kSerializer serializer, k8u* data)
465 {
466 kObj(kSerializer, serializer);
467
468 return kStream_Read(obj->readStream, data, 1);
469 }
470
480 kInlineFx(kStatus) kSerializer_Read8uArray(kSerializer serializer, k8u* data, kSize count)
481 {
482 kObj(kSerializer, serializer);
483
484 return kStream_Read(obj->readStream, data, count);
485 }
494 kInlineFx(kStatus) kSerializer_Write8s(kSerializer serializer, k8s data)
495 {
496 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_8);
497 }
498
508 kInlineFx(kStatus) kSerializer_Write8sArray(kSerializer serializer, const k8s* data, kSize count)
509 {
510 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_8);
511 }
512
521 kInlineFx(kStatus) kSerializer_Read8s(kSerializer serializer, k8s* data)
522 {
523 kObj(kSerializer, serializer);
524
525 return kStream_Read(obj->readStream, data, 1);
526 }
527
537 kInlineFx(kStatus) kSerializer_Read8sArray(kSerializer serializer, k8s* data, kSize count)
538 {
539 kObj(kSerializer, serializer);
540
541 return kStream_Read(obj->readStream, data, count);
542 }
543
552 kInlineFx(kStatus) kSerializer_Write16u(kSerializer serializer, k16u data)
553 {
554 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_16);
555 }
565 kInlineFx(kStatus) kSerializer_Write16uArray(kSerializer serializer, const k16u* data, kSize count)
566 {
567 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_16);
568 }
569
578 kInlineFx(kStatus) kSerializer_Read16u(kSerializer serializer, k16u* data)
579 {
580 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_16);
581 }
582
592 kInlineFx(kStatus) kSerializer_Read16uArray(kSerializer serializer, k16u* data, kSize count)
593 {
594 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_16);
595 }
596
605 kInlineFx(kStatus) kSerializer_Write16s(kSerializer serializer, k16s data)
606 {
607 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_16);
608 }
609
619 kInlineFx(kStatus) kSerializer_Write16sArray(kSerializer serializer, const k16s* data, kSize count)
620 {
621 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_16);
622 }
623
632 kInlineFx(kStatus) kSerializer_Read16s(kSerializer serializer, k16s* data)
633 {
634 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_16);
635 }
636
646 kInlineFx(kStatus) kSerializer_Read16sArray(kSerializer serializer, k16s* data, kSize count)
647 {
648 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_16);
649 }
650
659 kInlineFx(kStatus) kSerializer_Write32u(kSerializer serializer, k32u data)
660 {
661 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_32);
662 }
663
673 kInlineFx(kStatus) kSerializer_Write32uArray(kSerializer serializer, const k32u* data, kSize count)
674 {
675 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_32);
676 }
685 kInlineFx(kStatus) kSerializer_Read32u(kSerializer serializer, k32u* data)
686 {
687 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_32);
688 }
689
699 kInlineFx(kStatus) kSerializer_Read32uArray(kSerializer serializer, k32u* data, kSize count)
700 {
701 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_32);
702 }
703
712 kInlineFx(kStatus) kSerializer_Write32s(kSerializer serializer, k32s data)
713 {
714 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_32);
715 }
716
726 kInlineFx(kStatus) kSerializer_Write32sArray(kSerializer serializer, const k32s* data, kSize count)
727 {
728 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_32);
729 }
730
739 kInlineFx(kStatus) kSerializer_Read32s(kSerializer serializer, k32s* data)
740 {
741 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_32);
742 }
743
753 kInlineFx(kStatus) kSerializer_Read32sArray(kSerializer serializer, k32s* data, kSize count)
754 {
755 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_32);
756 }
757
766 kInlineFx(kStatus) kSerializer_Write64u(kSerializer serializer, k64u data)
767 {
768 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_64);
769 }
770
780 kInlineFx(kStatus) kSerializer_Write64uArray(kSerializer serializer, const k64u* data, kSize count)
781 {
782 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_64);
783 }
792 kInlineFx(kStatus) kSerializer_Read64u(kSerializer serializer, k64u* data)
793 {
794 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_64);
795 }
805 kInlineFx(kStatus) kSerializer_Read64uArray(kSerializer serializer, k64u* data, kSize count)
806 {
807 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_64);
808 }
809
818 kInlineFx(kStatus) kSerializer_Write64s(kSerializer serializer, k64s data)
819 {
820 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_64);
821 }
831 kInlineFx(kStatus) kSerializer_Write64sArray(kSerializer serializer, const k64s* data, kSize count)
832 {
833 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_64);
834 }
843 kInlineFx(kStatus) kSerializer_Read64s(kSerializer serializer, k64s* data)
844 {
845 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_64);
846 }
856 kInlineFx(kStatus) kSerializer_Read64sArray(kSerializer serializer, k64s* data, kSize count)
857 {
858 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_64);
859 }
860
869 kInlineFx(kStatus) kSerializer_Write32f(kSerializer serializer, k32f data)
870 {
871 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_32);
872 }
882 kInlineFx(kStatus) kSerializer_Write32fArray(kSerializer serializer, const k32f* data, kSize count)
883 {
884 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_32);
885 }
894 kInlineFx(kStatus) kSerializer_Read32f(kSerializer serializer, k32f* data)
895 {
896 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_32);
897 }
907 kInlineFx(kStatus) kSerializer_Read32fArray(kSerializer serializer, k32f* data, kSize count)
908 {
909 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_32);
910 }
919 kInlineFx(kStatus) kSerializer_Write64f(kSerializer serializer, k64f data)
920 {
921 return xkSerializer_WritePrimitive(serializer, &data, xkSERIALIZER_PRIMATIVE_64);
922 }
932 kInlineFx(kStatus) kSerializer_Write64fArray(kSerializer serializer, const k64f* data, kSize count)
933 {
934 return xkSerializer_WritePrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_64);
935 }
936
945 kInlineFx(kStatus) kSerializer_Read64f(kSerializer serializer, k64f* data)
946 {
947 return xkSerializer_ReadPrimitive(serializer, data, xkSERIALIZER_PRIMATIVE_64);
948 }
949
959 kInlineFx(kStatus) kSerializer_Read64fArray(kSerializer serializer, k64f* data, kSize count)
960 {
961 return xkSerializer_ReadPrimitives(serializer, data, count, xkSERIALIZER_PRIMATIVE_64);
962 }
963
975 kInlineFx(kStatus) kSerializer_WriteSize(kSerializer serializer, kSize data)
976 {
977 return xkSerializer_WriteSizePrimitive(serializer, data);
978 }
979
992 kFx(kStatus) kSerializer_WriteSizeArray(kSerializer serializer, const kSize* data, kSize count);
993
1005 kInlineFx(kStatus) kSerializer_ReadSize(kSerializer serializer, kSize* data)
1006 {
1007 return xkSerializer_ReadSizePrimitive(serializer, data);
1008 }
1009
1022 kFx(kStatus) kSerializer_ReadSizeArray(kSerializer serializer, kSize* data, kSize count);
1023
1035 kInlineFx(kStatus) kSerializer_WriteSSize(kSerializer serializer, kSSize data)
1036 {
1037 return xkSerializer_WriteSSizePrimitive(serializer, data);
1038 }
1039
1052 kFx(kStatus) kSerializer_WriteSSizeArray(kSerializer serializer, const kSSize* data, kSize count);
1053
1065 kInlineFx(kStatus) kSerializer_ReadSSize(kSerializer serializer, kSSize* data)
1066 {
1067 return xkSerializer_ReadSSizePrimitive(serializer, data);
1068 }
1069
1082 kFx(kStatus) kSerializer_ReadSSizeArray(kSerializer serializer, kSSize* data, kSize count);
1083
1097 kInlineFx(kBool) kSerializer_IsMemoryCompatible(kSerializer serializer, kType type)
1098 {
1099 return (kSerializer_Endianness(serializer) == kEndianness_Host()) && kType_IsPacked(type);
1100 }
1101
1110 kInlineFx(kBool) kSerializer_CanWriteType(kSerializer serializer, kType type)
1111 {
1112 return xkSerializer_VTable(serializer)->VCanWriteType(serializer, type);
1113 }
1114
1124 kInlineFx(kStatus) kSerializer_WriteType(kSerializer serializer, kType type, kTypeVersion* version)
1125 {
1126 return xkSerializer_VTable(serializer)->VWriteType(serializer, type, version);
1127 }
1128
1129
1139 kInlineFx(kStatus) kSerializer_ReadType(kSerializer serializer, kType* type, kTypeVersion* version)
1140 {
1141 return xkSerializer_VTable(serializer)->VReadType(serializer, type, version);
1142 }
1143
1155 kFx(kStatus) kSerializer_WriteItems(kSerializer serializer, kType type, kTypeVersion version, const void* items, kSize count);
1156
1171 #define kSerializer_WriteItemsT(kSerializer_serializer, kType_type, kTypeVersion_version, TPtr_items, kSize_count) \
1172 xkSerializer_WriteItemsT(kSerializer_serializer, kType_type, kTypeVersion_version, TPtr_items, kSize_count, sizeof(*TPtr_items))
1173
1185 kFx(kStatus) kSerializer_ReadItems(kSerializer serializer, kType type, kTypeVersion version, void* items, kSize count);
1186
1201 #define kSerializer_ReadItemsT(kSerializer_serializer, kType_type, kTypeVersion_version, TPtr_items, kSize_count) \
1202 xkSerializer_ReadItemsT(kSerializer_serializer, kType_type, kTypeVersion_version, TPtr_items, kSize_count, sizeof(*TPtr_items))
1203
1214 kFx(kStatus) kSerializer_BeginWrite(kSerializer serializer, kType sizeType, kBool includeSize);
1215
1223 kFx(kStatus) kSerializer_EndWrite(kSerializer serializer);
1224
1234 kFx(kStatus) kSerializer_BeginRead(kSerializer serializer, kType sizeType, kBool includeSize);
1235
1243 kFx(kStatus) kSerializer_EndRead(kSerializer serializer);
1244
1252 kInlineFx(kBool) kSerializer_ReadCompleted(kSerializer serializer)
1253 {
1254 kObj(kSerializer, serializer);
1255
1256 kAssert(kArrayList_Count(obj->readSections) > 0);
1257
1258 return kStream_BytesRead(obj->readStream) >= kPointer_ReadAs(kArrayList_Last(obj->readSections), k64u);
1259 }
1260
1269 kInlineFx(kStatus) kSerializer_AdvanceRead(kSerializer serializer, kSize offset)
1270 {
1271 if (offset == 0)
1272 {
1273 return kOK;
1274 }
1275
1276 return xkSerializer_AdvanceReadImpl(serializer, offset);
1277 }
1278
1291 kInlineFx(kStatus) kSerializer_Flush(kSerializer serializer)
1292 {
1293 return xkSerializer_FlushEx(serializer, kTRUE);
1294 }
1295
1303 kInlineFx(kStatus) kSerializer_Reset(kSerializer serializer)
1304 {
1305 return xkSerializer_VTable(serializer)->VReset(serializer);
1306 }
1307
1315 kInlineFx(kStream) kSerializer_Stream(kSerializer serializer)
1316 {
1317 kObj(kSerializer, serializer);
1318
1319 return obj->stream;
1320 }
1321
1322 #endif
kSerializer::kSerializer_Write16s
kStatus kSerializer_Write16s(kSerializer serializer, k16s data)
Writes a k16s value.
Definition: kSerializer.h:605
kSerializer::kSerializer_ReadSizeArray
kStatus kSerializer_ReadSizeArray(kSerializer serializer, kSize *data, kSize count)
Reads a kSize array.
kSerializer::kSerializer_ReadCharArray
kStatus kSerializer_ReadCharArray(kSerializer serializer, kChar *data, kSize count)
Reads a kChar array.
Definition: kSerializer.h:422
k32u
Represents a 32-bit unsigned integer.
kSerializer::kSerializer_Write32sArray
kStatus kSerializer_Write32sArray(kSerializer serializer, const k32s *data, kSize count)
Writes a k32s array.
Definition: kSerializer.h:726
kSerializer::kSerializer_EndWrite
kStatus kSerializer_EndWrite(kSerializer serializer)
Ends writing a measured data section.
kSerializer::kSerializer_Read64u
kStatus kSerializer_Read64u(kSerializer serializer, k64u *data)
Reads a k64u value.
Definition: kSerializer.h:792
kSerializer::kSerializer_Write8u
kStatus kSerializer_Write8u(kSerializer serializer, k8u data)
Writes a k8u value.
Definition: kSerializer.h:437
kSerializer::kSerializer_ReadChar
kStatus kSerializer_ReadChar(kSerializer serializer, kChar *data)
Reads a kChar value.
Definition: kSerializer.h:406
kSerializer::kSerializer_Read32f
kStatus kSerializer_Read32f(kSerializer serializer, k32f *data)
Reads a k32f value.
Definition: kSerializer.h:894
kSerializer::kSerializer_Write16sArray
kStatus kSerializer_Write16sArray(kSerializer serializer, const k16s *data, kSize count)
Writes a k16s array.
Definition: kSerializer.h:619
kStream::kStream_BytesRead
k64u kStream_BytesRead(kStream stream)
Reports the number of bytes read from this stream.
Definition: kStream.h:207
kSerializer::kSerializer_Read8u
kStatus kSerializer_Read8u(kSerializer serializer, k8u *data)
Reads a k8u value.
Definition: kSerializer.h:464
k64u
Represents a 64-bit unsigned integer.
kSerializer::kSerializer_Read8s
kStatus kSerializer_Read8s(kSerializer serializer, k8s *data)
Reads a k8s value.
Definition: kSerializer.h:521
kSerializer::kSerializer_WriteCharArray
kStatus kSerializer_WriteCharArray(kSerializer serializer, const kChar *data, kSize count)
Writes a kChar array.
Definition: kSerializer.h:393
kSerializer::kSerializer_Read16s
kStatus kSerializer_Read16s(kSerializer serializer, k16s *data)
Reads a k16s value.
Definition: kSerializer.h:632
kSerializer::kSerializer_Write8uArray
kStatus kSerializer_Write8uArray(kSerializer serializer, const k8u *data, kSize count)
Writes a k8u array.
Definition: kSerializer.h:451
kSerializer::kSerializer_EndRead
kStatus kSerializer_EndRead(kSerializer serializer)
Ends reading a measured data section.
kSerializer::kSerializer_Write32uArray
kStatus kSerializer_Write32uArray(kSerializer serializer, const k32u *data, kSize count)
Writes a k32u array.
Definition: kSerializer.h:673
kAssembly
Represents a library of types.
kSerializer::kSerializer_Read64f
kStatus kSerializer_Read64f(kSerializer serializer, k64f *data)
Reads a k64f value.
Definition: kSerializer.h:945
kSerializer::kSerializer_SetVersion
kStatus kSerializer_SetVersion(kSerializer serializer, kAssembly assembly, kVersion version)
Sets the version to use when serializing types.
kSerializer::kSerializer_Write32f
kStatus kSerializer_Write32f(kSerializer serializer, k32f data)
Writes a k32f value.
Definition: kSerializer.h:869
kSerializer::kSerializer_ReadByteArray
kStatus kSerializer_ReadByteArray(kSerializer serializer, void *data, kSize count)
Reads a kByte array.
Definition: kSerializer.h:364
kSerializer::kSerializer_Read16u
kStatus kSerializer_Read16u(kSerializer serializer, k16u *data)
Reads a k16u value.
Definition: kSerializer.h:578
kSerializer::kSerializer_WriteType
kStatus kSerializer_WriteType(kSerializer serializer, kType type, kTypeVersion *version)
Writes a type code.
Definition: kSerializer.h:1124
k16u
Represents a 16-bit unsigned integer.
kSerializer::kSerializer_Write16u
kStatus kSerializer_Write16u(kSerializer serializer, k16u data)
Writes a k16u value.
Definition: kSerializer.h:552
kArrayList.h
Declares the kArrayList class.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kSerializer::kSerializer_IsMemoryCompatible
kBool kSerializer_IsMemoryCompatible(kSerializer serializer, kType type)
Determines whether a value type is memory-compatible with the serializer.
Definition: kSerializer.h:1097
kSerializer::kSerializer_Write64f
kStatus kSerializer_Write64f(kSerializer serializer, k64f data)
Writes a k64f value.
Definition: kSerializer.h:919
kSerializer::kSerializer_Stream
kStream kSerializer_Stream(kSerializer serializer)
Gets the underlying stream.
Definition: kSerializer.h:1315
kType::kType_IsPacked
kBool kType_IsPacked(kType type)
Reports whether the fields of a value type are tightly packed (free from structure padding)...
Definition: kType.h:211
kSerializer::kSerializer_Read64uArray
kStatus kSerializer_Read64uArray(kSerializer serializer, k64u *data, kSize count)
Reads a k64u array.
Definition: kSerializer.h:805
kSerializer::kSerializer_Write64u
kStatus kSerializer_Write64u(kSerializer serializer, k64u data)
Writes a k64u value.
Definition: kSerializer.h:766
k8u
Represents an 8-bit unsigned integer.
kArrayList::kArrayList_Last
void * kArrayList_Last(kArrayList list)
Returns a pointer to the last item in the list.
Definition: kArrayList.h:692
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kSerializer::kSerializer_ReadObject
kStatus kSerializer_ReadObject(kSerializer serializer, kObject *object, kAlloc allocator)
Reads an object from the underlying stream.
Definition: kSerializer.h:287
kSerializer::kSerializer_SaveObject
kStatus kSerializer_SaveObject(kObject object, kType serializerType, const kChar *filePath)
Saves an object to file using the specified serializer type.
kChar
Represents a single unit (byte) in a UTF-8 character.
kSerializer::kSerializer_Write64sArray
kStatus kSerializer_Write64sArray(kSerializer serializer, const k64s *data, kSize count)
Writes a k64s array.
Definition: kSerializer.h:831
kSerializer::kSerializer_SetEndianness
kStatus kSerializer_SetEndianness(kSerializer serializer, kEndianness endianness)
Explicitly sets the endianness (byte ordering) of encoded/decoded values.
Definition: kSerializer.h:242
kSerializer::kSerializer_Write64fArray
kStatus kSerializer_Write64fArray(kSerializer serializer, const k64f *data, kSize count)
Writes a k64f array.
Definition: kSerializer.h:932
kSerializer::kSerializer_WriteSize
kStatus kSerializer_WriteSize(kSerializer serializer, kSize data)
Writes a kSize value.
Definition: kSerializer.h:975
kByte
Represents a byte on the current platform.
kSerializer::kSerializer_WriteByte
kStatus kSerializer_WriteByte(kSerializer serializer, kByte data)
Writes a kByte value.
Definition: kSerializer.h:321
kSerializer::kSerializer_SizeEncoding
k32u kSerializer_SizeEncoding(kSerializer serializer)
Reports the number of bytes used to encode/decode kSize and kSSize values.
Definition: kSerializer.h:224
kSerializer::kSerializer_WriteSSizeArray
kStatus kSerializer_WriteSSizeArray(kSerializer serializer, const kSSize *data, kSize count)
Writes a kSSize array.
kSerializer::kSerializer_AdvanceRead
kStatus kSerializer_AdvanceRead(kSerializer serializer, kSize offset)
Reads and discards a specified number of bytes.
Definition: kSerializer.h:1269
kSSize
Represents a signed integer that can store a pointer address.
kSerializer::kSerializer_Read32u
kStatus kSerializer_Read32u(kSerializer serializer, k32u *data)
Reads a k32u value.
Definition: kSerializer.h:685
kSerializer::kSerializer_WriteItems
kStatus kSerializer_WriteItems(kSerializer serializer, kType type, kTypeVersion version, const void *items, kSize count)
Writes an array of values or objects.
kSerializer::kSerializer_Write8s
kStatus kSerializer_Write8s(kSerializer serializer, k8s data)
Writes a k8s value.
Definition: kSerializer.h:494
kSerializer::kSerializer_Read8sArray
kStatus kSerializer_Read8sArray(kSerializer serializer, k8s *data, kSize count)
Reads a k8s array.
Definition: kSerializer.h:537
kSerializer::kSerializer_ReadByte
kStatus kSerializer_ReadByte(kSerializer serializer, kByte *data)
Reads a kByte value.
Definition: kSerializer.h:348
kBool::kTRUE
#define kTRUE
Boolean true.
Definition: kApiDef.h:356
kSerializer
Base class for serialization/deserialization classes.
kSerializer::kSerializer_Reset
kStatus kSerializer_Reset(kSerializer serializer)
Discards any streaming context accumulated by the serializer.
Definition: kSerializer.h:1303
kSerializer::kSerializer_WriteChar
kStatus kSerializer_WriteChar(kSerializer serializer, kChar data)
Writes a kChar value.
Definition: kSerializer.h:379
kSerializer::kSerializer_Read32uArray
kStatus kSerializer_Read32uArray(kSerializer serializer, k32u *data, kSize count)
Reads a k32u array.
Definition: kSerializer.h:699
kSerializer::kSerializer_WriteByteArray
kStatus kSerializer_WriteByteArray(kSerializer serializer, const void *data, kSize count)
Writes a kByte array.
Definition: kSerializer.h:335
kSerializer::kSerializer_CanWriteType
kBool kSerializer_CanWriteType(kSerializer serializer, kType type)
Determines whether this serializer can write the specified object type.
Definition: kSerializer.h:1110
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
kSerializer::kSerializer_Read32s
kStatus kSerializer_Read32s(kSerializer serializer, k32s *data)
Reads a k32s value.
Definition: kSerializer.h:739
kSerializer::kSerializer_Write32u
kStatus kSerializer_Write32u(kSerializer serializer, k32u data)
Writes a k32u value.
Definition: kSerializer.h:659
kSerializer::kSerializer_BeginWrite
kStatus kSerializer_BeginWrite(kSerializer serializer, kType sizeType, kBool includeSize)
Begins writing a measured section of data, using an 8, 16, 32, or 64-bit integer to record the size...
kSerializer::kSerializer_Read64sArray
kStatus kSerializer_Read64sArray(kSerializer serializer, k64s *data, kSize count)
Reads a k64s array.
Definition: kSerializer.h:856
kSerializer::kSerializer_Write32s
kStatus kSerializer_Write32s(kSerializer serializer, k32s data)
Writes a k32s value.
Definition: kSerializer.h:712
kType::kTypeVersion
kPointer kTypeVersion
Represents an opaque reference to type version information (used in object serialization).
kSerializer::kSerializer_BeginRead
kStatus kSerializer_BeginRead(kSerializer serializer, kType sizeType, kBool includeSize)
Begins reading a measured data section.
kSerializer::kSerializer_Write64s
kStatus kSerializer_Write64s(kSerializer serializer, k64s data)
Writes a k64s value.
Definition: kSerializer.h:818
kApiDef.h
Core Zen type declarations.
kArrayList::kArrayList_Count
kSize kArrayList_Count(kArrayList list)
Returns the current count of items in the list.
Definition: kArrayList.h:638
kSerializer::kSerializer_Read64fArray
kStatus kSerializer_Read64fArray(kSerializer serializer, k64f *data, kSize count)
Reads a k64f array.
Definition: kSerializer.h:959
kSerializer::kSerializer_ReadItems
kStatus kSerializer_ReadItems(kSerializer serializer, kType type, kTypeVersion version, void *items, kSize count)
Reads an array of values or objects.
kStream
Represents an I/O stream.
kSerializer::kSerializer_ReadSize
kStatus kSerializer_ReadSize(kSerializer serializer, kSize *data)
Reads a kSize value.
Definition: kSerializer.h:1005
k32s
Represents a 32-bit signed integer.
kSerializer::kSerializer_Write16uArray
kStatus kSerializer_Write16uArray(kSerializer serializer, const k16u *data, kSize count)
Writes a k16u array.
Definition: kSerializer.h:565
kSerializer::kSerializer_LoadObject
kStatus kSerializer_LoadObject(kObject *object, kType serializerType, const kChar *filePath, kAlloc readAlloc)
Loads an object from file using the specified serializer type.
kSerializer::kSerializer_Construct
kStatus kSerializer_Construct(kSerializer *serializer, kStream stream, kType serializerType, kAlloc allocator)
Constructs a serializer object using the specified serialization format.
kCheckArgs
#define kCheckArgs(EXPRESSION)
Executes a return statement if the given expression is not kTRUE.
Definition: kApiDef.h:584
kSerializer::kSerializer_Write8sArray
kStatus kSerializer_Write8sArray(kSerializer serializer, const k8s *data, kSize count)
Writes a k8s array.
Definition: kSerializer.h:508
kSerializer::kSerializer_Read64s
kStatus kSerializer_Read64s(kSerializer serializer, k64s *data)
Reads a k64s value.
Definition: kSerializer.h:843
kSerializer::kSerializer_Read16sArray
kStatus kSerializer_Read16sArray(kSerializer serializer, k16s *data, kSize count)
Reads a k16s array.
Definition: kSerializer.h:646
kEndianness::kEndianness_Host
kEndianness kEndianness_Host()
Reports the endianness of the current platform.
Definition: kApiDef.h:923
kEndianness_ShouldReverse
kBool kEndianness_ShouldReverse(kEndianness endianness)
Reports whether byte ordering must be reversed to be consistent with the current platform.
Definition: kApiDef.h:934
kSerializer::kSerializer_WriteSizeArray
kStatus kSerializer_WriteSizeArray(kSerializer serializer, const kSize *data, kSize count)
Writes a kSize array.
k64s
Represents a 64-bit signed integer.
kSerializer::kSerializer_ReadText
kStatus kSerializer_ReadText(kSerializer serializer, kChar *data, kSize capacity)
Reads a null-terminated kChar array.
kSerializer::kSerializer_WriteText
kStatus kSerializer_WriteText(kSerializer serializer, const kChar *data)
Writes a null-terminated kChar array.
k8s
Represents an 8-bit signed integer.
kEndianness
Represents the byte-ordering of primitive data types.
kSerializer::kSerializer_Read32sArray
kStatus kSerializer_Read32sArray(kSerializer serializer, k32s *data, kSize count)
Reads a k32s array.
Definition: kSerializer.h:753
kType
Represents metadata about a type (class, interface, or value).
kSerializer::kSerializer_SetSizeEncoding
kStatus kSerializer_SetSizeEncoding(kSerializer serializer, k32u byteCount)
Explicitly sets the number of bytes used to encode/decode kSize and kSSize values.
Definition: kSerializer.h:206
kSerializer::kSerializer_WriteObject
kStatus kSerializer_WriteObject(kSerializer serializer, kObject object)
Writes an object to the underlying stream.
Definition: kSerializer.h:274
kSerializer::kSerializer_ReadCompleted
kBool kSerializer_ReadCompleted(kSerializer serializer)
Determines whether the current measured read section has more bytes.
Definition: kSerializer.h:1252
kSerializer::kSerializer_Write32fArray
kStatus kSerializer_Write32fArray(kSerializer serializer, const k32f *data, kSize count)
Writes a k32f array.
Definition: kSerializer.h:882
kAssert
#define kAssert(EXPRESSION)
Aborts execution if EXPRESSION is kFALSE.
Definition: kApiDef.h:751
k16s
Represents a 16-bit signed integer.
k32f
Represents a 32-bit floating-point number.
kObject
Root of all Zen classes.
kVersion
Represents a version number.
kStatus::kOK
#define kOK
Operation successful.
Definition: kApiDef.h:515
kSerializer::kSerializer_Read16uArray
kStatus kSerializer_Read16uArray(kSerializer serializer, k16u *data, kSize count)
Reads a k16u array.
Definition: kSerializer.h:592
kStatus
Represents an error code.
kSerializer::kSerializer_ReadSSize
kStatus kSerializer_ReadSSize(kSerializer serializer, kSSize *data)
Reads a kSSize value.
Definition: kSerializer.h:1065
kSerializer::kSerializer_ReadType
kStatus kSerializer_ReadType(kSerializer serializer, kType *type, kTypeVersion *version)
Reads a type code.
Definition: kSerializer.h:1139
kSerializer::kSerializer_Read8uArray
kStatus kSerializer_Read8uArray(kSerializer serializer, k8u *data, kSize count)
Reads a k8u array.
Definition: kSerializer.h:480
kPointer::kPointer_ReadAs
#define kPointer_ReadAs(POINTER, TYPE)
Deferences a pointer, assuming the specified type, and returns the resulting value.
Definition: kApiDef.h:320
kSerializer::kSerializer_Write64uArray
kStatus kSerializer_Write64uArray(kSerializer serializer, const k64u *data, kSize count)
Writes a k64u array.
Definition: kSerializer.h:780
kSerializer::kSerializer_ReadSSizeArray
kStatus kSerializer_ReadSSizeArray(kSerializer serializer, kSSize *data, kSize count)
Reads a kSSize array.
k64f
Represents a 64-bit floating-point number.
kSerializer::kSerializer_Read32fArray
kStatus kSerializer_Read32fArray(kSerializer serializer, k32f *data, kSize count)
Reads a k32f array.
Definition: kSerializer.h:907
kBool
Represents a boolean value.
kSerializer::kSerializer_WriteSSize
kStatus kSerializer_WriteSSize(kSerializer serializer, kSSize data)
Writes a kSSize value.
Definition: kSerializer.h:1035
kSerializer::kSerializer_Endianness
kEndianness kSerializer_Endianness(kSerializer serializer)
Reports the (byte ordering) of encoded/decoded values.
Definition: kSerializer.h:259
kStream::kStream_Read
kStatus kStream_Read(kStream stream, void *buffer, kSize size)
Reads the specified number of bytes from the stream.
Definition: kStream.h:37
kSerializer::kSerializer_Flush
kStatus kSerializer_Flush(kSerializer serializer)
Flushes the serializer write buffer to the underlying stream.
Definition: kSerializer.h:1291