JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
fstreamer.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------
2// Project : SDK Base
3// Version : 1.0
4//
5// Category : Helpers
6// Filename : base/source/fstreamer.cpp
7// Created by : Steinberg, 15.12.2005
8// Description : Extract of typed stream i/o methods from FStream
9//
10//-----------------------------------------------------------------------------
11// LICENSE
12// (c) 2023, Steinberg Media Technologies GmbH, All Rights Reserved
13//-----------------------------------------------------------------------------
14// Redistribution and use in source and binary forms, with or without modification,
15// are permitted provided that the following conditions are met:
16//
17// * Redistributions of source code must retain the above copyright notice,
18// this list of conditions and the following disclaimer.
19// * Redistributions in binary form must reproduce the above copyright notice,
20// this list of conditions and the following disclaimer in the documentation
21// and/or other materials provided with the distribution.
22// * Neither the name of the Steinberg Media Technologies nor the names of its
23// contributors may be used to endorse or promote products derived from this
24// software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35// OF THE POSSIBILITY OF SUCH DAMAGE.
36//-----------------------------------------------------------------------------
37
38#include "fstreamer.h"
39
40#include "base/source/fstring.h"
41#include "base/source/fbuffer.h"
43
44#ifndef UNICODE
46#endif
47
48namespace Steinberg {
49
50//------------------------------------------------------------------------
51// IBStreamer
52//------------------------------------------------------------------------
53IBStreamer::IBStreamer (IBStream* stream, int16 _byteOrder)
54: FStreamer (_byteOrder)
55, stream (stream)
56{}
57
58//------------------------------------------------------------------------
59TSize IBStreamer::readRaw (void* buffer, TSize size)
60{
61 int32 numBytesRead = 0;
62 stream->read (buffer, (int32)size, &numBytesRead);
63 return numBytesRead;
64}
65
66//------------------------------------------------------------------------
67TSize IBStreamer::writeRaw (const void* buffer, TSize size)
68{
69 int32 numBytesWritten = 0;
70 stream->write ((void*)buffer, (int32)size, &numBytesWritten);
71 return numBytesWritten;
72}
73
74//------------------------------------------------------------------------
75int64 IBStreamer::seek (int64 pos, FSeekMode mode)
76{
77 int64 result = -1;
78 stream->seek (pos, mode, &result);
79 return result;
80}
81
82//------------------------------------------------------------------------
84{
85 int64 pos = 0;
86 stream->tell (&pos);
87 return pos;
88}
89
90//------------------------------------------------------------------------
91// FStreamSizeHolder Implementation
92//------------------------------------------------------------------------
93FStreamSizeHolder::FStreamSizeHolder (FStreamer &s)
94: stream (s), sizePos (-1)
95{}
96
97//------------------------------------------------------------------------
99{
100 sizePos = stream.tell ();
101 stream.writeInt32 (0L);
102}
103
104//------------------------------------------------------------------------
106{
107 if (sizePos < 0)
108 return 0;
109
110 int64 currentPos = stream.tell ();
111
112 stream.seek (sizePos, kSeekSet);
113 int32 size = int32 (currentPos - sizePos - sizeof (int32));
114 stream.writeInt32 (size);
115
116 stream.seek (currentPos, kSeekSet);
117 return size;
118}
119
120//------------------------------------------------------------------------
122{
123 sizePos = stream.tell ();
124 int32 size = 0;
125 stream.readInt32 (size);
126 sizePos += size + sizeof (int32);
127 return size;
128}
129
130//------------------------------------------------------------------------
132{
133 if (sizePos >= 0)
134 stream.seek (sizePos, kSeekSet);
135}
136
137//------------------------------------------------------------------------
138// FStreamer
139//------------------------------------------------------------------------
140FStreamer::FStreamer (int16 _byteOrder)
141: byteOrder (_byteOrder)
142{}
143
144// int8 / char -----------------------------------------------------------
145//------------------------------------------------------------------------
146bool FStreamer::writeChar8 (char8 c)
147{
148 return writeRaw ((void*)&c, sizeof (char8)) == sizeof (char8);
149}
150
151//------------------------------------------------------------------------
152bool FStreamer::readChar8 (char8& c)
153{
154 return readRaw ((void*)&c, sizeof (char8)) == sizeof (char8);
155}
156
157//------------------------------------------------------------------------
158bool FStreamer::writeUChar8 (unsigned char c)
159{
160 return writeRaw ((void*)&c, sizeof (unsigned char)) == sizeof (unsigned char);
161}
162
163//------------------------------------------------------------------------
164bool FStreamer::readUChar8 (unsigned char& c)
165{
166 return readRaw ((void*)&c, sizeof (unsigned char)) == sizeof (unsigned char);
167}
168
169//------------------------------------------------------------------------
170bool FStreamer::writeChar16 (char16 c)
171{
172 if (BYTEORDER != byteOrder)
173 SWAP_16 (c);
174 return writeRaw ((void*)&c, sizeof (char16)) == sizeof (char16);
175}
176
177//------------------------------------------------------------------------
178bool FStreamer::readChar16 (char16& c)
179{
180 if (readRaw ((void*)&c, sizeof (char16)) == sizeof (char16))
181 {
182 if (BYTEORDER != byteOrder)
183 SWAP_16 (c);
184 return true;
185 }
186 c = 0;
187 return false;
188}
189
190//------------------------------------------------------------------------
191bool FStreamer::writeInt8 (int8 c)
192{
193 return writeRaw ((void*)&c, sizeof (int8)) == sizeof (int8);
194}
195
196//------------------------------------------------------------------------
197bool FStreamer::readInt8 (int8& c)
198{
199 return readRaw ((void*)&c, sizeof (int8)) == sizeof (int8);
200}
201
202//------------------------------------------------------------------------
203bool FStreamer::writeInt8u (uint8 c)
204{
205 return writeRaw ((void*)&c, sizeof (uint8)) == sizeof (uint8);
206}
207
208//------------------------------------------------------------------------
209bool FStreamer::readInt8u (uint8& c)
210{
211 return readRaw ((void*)&c, sizeof (uint8)) == sizeof (uint8);
212}
213
214// int16 -----------------------------------------------------------------
215//------------------------------------------------------------------------
216bool FStreamer::writeInt16 (int16 i)
217{
218 if (BYTEORDER != byteOrder)
219 SWAP_16 (i);
220 return writeRaw ((void*)&i, sizeof (int16)) == sizeof (int16);
221}
222
223//------------------------------------------------------------------------
224bool FStreamer::readInt16 (int16& i)
225{
226 if (readRaw ((void*)&i, sizeof (int16)) == sizeof (int16))
227 {
228 if (BYTEORDER != byteOrder)
229 SWAP_16 (i);
230 return true;
231 }
232 i = 0;
233 return false;
234}
235
236//------------------------------------------------------------------------
237bool FStreamer::writeInt16Array (const int16* array, int32 count)
238{
239 for (int32 i = 0; i < count; i++)
240 {
241 if (!writeInt16 (array[i]))
242 return false;
243 }
244 return true;
245}
246
247//------------------------------------------------------------------------
248bool FStreamer::readInt16Array (int16* array, int32 count)
249{
250 for (int32 i = 0; i < count; i++)
251 {
252 if (!readInt16 (array[i]))
253 return false;
254 }
255 return true;
256}
257
258//------------------------------------------------------------------------
259bool FStreamer::writeInt16u (uint16 i)
260{
261 if (BYTEORDER != byteOrder)
262 SWAP_16 (i);
263 return writeRaw ((void*)&i, sizeof (uint16)) == sizeof (uint16);
264}
265
266//------------------------------------------------------------------------
267bool FStreamer::readInt16u (uint16& i)
268{
269 if (readRaw ((void*)&i, sizeof (uint16)) == sizeof (uint16))
270 {
271 if (BYTEORDER != byteOrder)
272 SWAP_16 (i);
273 return true;
274 }
275 i = 0;
276 return false;
277}
278
279//------------------------------------------------------------------------
280bool FStreamer::writeInt16uArray (const uint16* array, int32 count)
281{
282 for (int32 i = 0; i < count; i++)
283 {
284 if (!writeInt16u (array[i]))
285 return false;
286 }
287 return true;
288}
289
290//------------------------------------------------------------------------
291bool FStreamer::readInt16uArray (uint16* array, int32 count)
292{
293 for (int32 i = 0; i < count; i++)
294 {
295 if (!readInt16u (array[i]))
296 return false;
297 }
298 return true;
299}
300
301// int32 -----------------------------------------------------------------
302//------------------------------------------------------------------------
303bool FStreamer::writeInt32 (int32 i)
304{
305 if (BYTEORDER != byteOrder)
306 SWAP_32 (i);
307 return writeRaw ((void*)&i, sizeof (int32)) == sizeof (int32);
308}
309
310//------------------------------------------------------------------------
311bool FStreamer::readInt32 (int32& i)
312{
313 if (readRaw ((void*)&i, sizeof (int32)) == sizeof (int32))
314 {
315 if (BYTEORDER != byteOrder)
316 SWAP_32 (i);
317 return true;
318 }
319 i = 0;
320 return false;
321}
322
323//------------------------------------------------------------------------
324bool FStreamer::writeInt32Array (const int32* array, int32 count)
325{
326 for (int32 i = 0; i < count; i++)
327 {
328 if (!writeInt32 (array[i]))
329 return false;
330 }
331 return true;
332}
333
334//------------------------------------------------------------------------
335bool FStreamer::readInt32Array (int32* array, int32 count)
336{
337 for (int32 i = 0; i < count; i++)
338 {
339 if (!readInt32 (array[i]))
340 return false;
341 }
342 return true;
343}
344
345//------------------------------------------------------------------------
346bool FStreamer::writeInt32u (uint32 i)
347{
348 if (BYTEORDER != byteOrder)
349 SWAP_32 (i);
350 return writeRaw ((void*)&i, sizeof (uint32)) == sizeof (uint32);
351}
352
353//------------------------------------------------------------------------
354bool FStreamer::readInt32u (uint32& i)
355{
356 if (readRaw ((void*)&i, sizeof (uint32)) == sizeof (uint32))
357 {
358 if (BYTEORDER != byteOrder)
359 SWAP_32 (i);
360 return true;
361 }
362 i = 0;
363 return false;
364}
365
366//------------------------------------------------------------------------
367bool FStreamer::writeInt32uArray (const uint32* array, int32 count)
368{
369 for (int32 i = 0; i < count; i++)
370 {
371 if (!writeInt32u (array[i]))
372 return false;
373 }
374 return true;
375}
376
377//------------------------------------------------------------------------
378bool FStreamer::readInt32uArray (uint32* array, int32 count)
379{
380 for (int32 i = 0; i < count; i++)
381 {
382 if (!readInt32u (array[i]))
383 return false;
384 }
385 return true;
386}
387
388// int64 -----------------------------------------------------------------
389//------------------------------------------------------------------------
390bool FStreamer::writeInt64 (int64 i)
391{
392 if (BYTEORDER != byteOrder)
393 SWAP_64 (i);
394 return writeRaw ((void*)&i, sizeof (int64)) == sizeof (int64);
395}
396
397//------------------------------------------------------------------------
398bool FStreamer::readInt64 (int64& i)
399{
400 if (readRaw ((void*)&i, sizeof (int64)) == sizeof (int64))
401 {
402 if (BYTEORDER != byteOrder)
403 SWAP_64 (i);
404 return true;
405 }
406 i = 0;
407 return false;
408}
409
410//------------------------------------------------------------------------
411bool FStreamer::writeInt64Array (const int64* array, int32 count)
412{
413 for (int32 i = 0; i < count; i++)
414 {
415 if (!writeInt64 (array[i]))
416 return false;
417 }
418 return true;
419}
420
421//------------------------------------------------------------------------
422bool FStreamer::readInt64Array (int64* array, int32 count)
423{
424 for (int32 i = 0; i < count; i++)
425 {
426 if (!readInt64 (array[i]))
427 return false;
428 }
429 return true;
430}
431
432//------------------------------------------------------------------------
433bool FStreamer::writeInt64u (uint64 i)
434{
435 if (BYTEORDER != byteOrder)
436 SWAP_64 (i);
437 return writeRaw ((void*)&i, sizeof (uint64)) == sizeof (uint64);
438}
439
440//------------------------------------------------------------------------
441bool FStreamer::readInt64u (uint64& i)
442{
443 if (readRaw ((void*)&i, sizeof (uint64)) == sizeof (uint64))
444 {
445 if (BYTEORDER != byteOrder)
446 SWAP_64 (i);
447 return true;
448 }
449 i = 0;
450 return false;
451}
452
453//------------------------------------------------------------------------
454bool FStreamer::writeInt64uArray (const uint64* array, int32 count)
455{
456 for (int32 i = 0; i < count; i++)
457 {
458 if (!writeInt64u (array[i]))
459 return false;
460 }
461 return true;
462}
463
464//------------------------------------------------------------------------
465bool FStreamer::readInt64uArray (uint64* array, int32 count)
466{
467 for (int32 i = 0; i < count; i++)
468 {
469 if (!readInt64u (array[i]))
470 return false;
471 }
472 return true;
473}
474
475// float / double --------------------------------------------------------
476//------------------------------------------------------------------------
477bool FStreamer::writeFloat (float f)
478{
479 if (BYTEORDER != byteOrder)
480 SWAP_32 (f);
481 return writeRaw ((void*)&f, sizeof (float)) == sizeof (float);
482}
483
484//------------------------------------------------------------------------
485bool FStreamer::readFloat (float& f)
486{
487 if (readRaw ((void*)&f, sizeof (float)) == sizeof (float))
488 {
489 if (BYTEORDER != byteOrder)
490 SWAP_32 (f);
491 return true;
492 }
493 f = 0.f;
494 return false;
495}
496
497//------------------------------------------------------------------------
498bool FStreamer::writeFloatArray (const float* array, int32 count)
499{
500 for (int32 i = 0; i < count; i++)
501 {
502 if (!writeFloat (array[i]))
503 return false;
504 }
505 return true;
506}
507
508//------------------------------------------------------------------------
509bool FStreamer::readFloatArray (float* array, int32 count)
510{
511 for (int32 i = 0; i < count; i++)
512 {
513 if (!readFloat (array[i]))
514 return false;
515 }
516 return true;
517}
518
519//------------------------------------------------------------------------
520bool FStreamer::writeDouble (double d)
521{
522 if (BYTEORDER != byteOrder)
523 SWAP_64 (d);
524 return writeRaw ((void*)&d, sizeof (double)) == sizeof (double);
525}
526
527//------------------------------------------------------------------------
528bool FStreamer::readDouble (double& d)
529{
530 if (readRaw ((void*)&d, sizeof (double)) == sizeof (double))
531 {
532 if (BYTEORDER != byteOrder)
533 SWAP_64 (d);
534 return true;
535 }
536 d = 0.0;
537 return false;
538}
539
540//------------------------------------------------------------------------
541bool FStreamer::writeDoubleArray (const double* array, int32 count)
542{
543 for (int32 i = 0; i < count; i++)
544 {
545 if (!writeDouble (array[i]))
546 return false;
547 }
548 return true;
549}
550
551//------------------------------------------------------------------------
552bool FStreamer::readDoubleArray (double* array, int32 count)
553{
554 for (int32 i = 0; i < count; i++)
555 {
556 if (!readDouble (array[i]))
557 return false;
558 }
559 return true;
560}
561
562//------------------------------------------------------------------------
564{
565 int16 v = 0;
566 bool res = readInt16 (v);
567 b = (v != 0);
568 return res;
569}
570
571//------------------------------------------------------------------------
573{
574 return writeInt16 ((int16)b);
575}
576
577//------------------------------------------------------------------------
578TSize FStreamer::writeString8 (const char8* ptr, bool terminate)
579{
580 TSize size = strlen (ptr);
581 if (terminate) // write \0
582 size++;
583
584 return writeRaw ((void*)ptr, size);
585}
586
587//------------------------------------------------------------------------
588TSize FStreamer::readString8 (char8* ptr, TSize size)
589{
590 if (size < 1 || ptr == nullptr)
591 return 0;
592
593 TSize i = 0;
594 char8 c = 0;
595 while (i < size)
596 {
597 if (readRaw ((void*)&c, sizeof (char)) != sizeof (char))
598 break;
599 ptr[i] = c;
600 if (c == '\n' || c == '\0')
601 break;
602 i++;
603 }
604 // remove at end \n (LF) or \r\n (CR+LF)
605 if (c == '\n')
606 {
607 if (i > 0 && ptr[i - 1] == '\r')
608 i--;
609 }
610 ptr[i] = 0;
611
612 return i;
613}
614
615//------------------------------------------------------------------------
616bool FStreamer::writeStringUtf8 (const tchar* ptr)
617{
618 bool isUtf8 = false;
619
620 String str (ptr);
621 if (str.isAsciiString () == false)
622 {
623 str.toMultiByte (kCP_Utf8);
624 isUtf8 = true;
625 }
626 else
627 {
628 str.toMultiByte ();
629 }
630
631 if (isUtf8)
632 if (writeRaw (kBomUtf8, kBomUtf8Length) != kBomUtf8Length)
633 return false;
634
635 TSize size = str.length () + 1;
636 if (writeRaw (str.text8 (), size) != size)
637 return false;
638
639 return true;
640}
641
642//------------------------------------------------------------------------
643int32 FStreamer::readStringUtf8 (tchar* ptr, int32 nChars)
644{
645 char8 c = 0;
646
647 ptr [0] = 0;
648
649 Buffer tmp;
650 tmp.setDelta (1024);
651
652 while (true)
653 {
654 if (readRaw ((void*)&c, sizeof (char)) != sizeof (char))
655 break;
656 tmp.put (c);
657 if (c == '\0')
658 break;
659 }
660
661 char8* source = tmp.str8 ();
662 uint32 codePage = kCP_Default; // for legacy take default page if no utf8 bom is present...
663 if (tmp.getFillSize () > 2)
664 {
665 if (memcmp (source, kBomUtf8, kBomUtf8Length) == 0)
666 {
667 codePage = kCP_Utf8;
668 source += 3;
669 }
670 }
671
672 if (tmp.getFillSize () > 1)
673 {
674#ifdef UNICODE
675 ConstString::multiByteToWideString (ptr, source, nChars, codePage);
676#else
677 if (codePage == kCP_Utf8)
678 {
679 Buffer wideBuffer (tmp.getFillSize () * 3);
680 ConstString::multiByteToWideString (wideBuffer.wcharPtr (), source, wideBuffer.getSize () / 2, kCP_Utf8);
681 ConstString::wideStringToMultiByte (ptr, wideBuffer.wcharPtr (), nChars);
682 }
683 else
684 {
685 memcpy (ptr, source, Min<TSize> (nChars, tmp.getFillSize ()));
686 }
687#endif
688 }
689
690 ptr[nChars - 1] = 0;
691 return ConstString (ptr).length ();
692}
693
694//------------------------------------------------------------------------
695bool FStreamer::writeStr8 (const char8* s)
696{
697 int32 length = (s) ? (int32) strlen (s) + 1 : 0;
698 if (!writeInt32 (length))
699 return false;
700
701 if (length > 0)
702 return writeRaw (s, sizeof (char8) * length) == static_cast<TSize>(sizeof (char8) * length);
703
704 return true;
705}
706
707//------------------------------------------------------------------------
708int32 FStreamer::getStr8Size (const char8* s)
709{
710 return sizeof (int32) + (int32)strlen (s) + 1;
711}
712
713//------------------------------------------------------------------------
715{
716 int32 length;
717 if (!readInt32 (length))
718 return nullptr;
719
720 // check corruption
721 if (length > 262144)
722 return nullptr;
723
724 char8* s = (length > 0) ? NEWVEC char8[length] : nullptr;
725 if (s)
726 readRaw (s, length * sizeof (char8));
727 return s;
728}
729
730//------------------------------------------------------------------------
731bool FStreamer::skip (uint32 bytes)
732{
733 int8 tmp;
734 while (bytes-- > 0)
735 {
736 if (readInt8 (tmp) == false)
737 return false;
738 }
739 return true;
740}
741
742//------------------------------------------------------------------------
743bool FStreamer::pad (uint32 bytes)
744{
745 while (bytes-- > 0)
746 {
747 if (writeInt8 (0) == false)
748 return false;
749 }
750 return true;
751}
752
753//------------------------------------------------------------------------
754} // namespace Steinberg
uint32 getSize() const
Definition fbuffer.h:101
bool put(uint8)
append value at end, grows Buffer if necessary
Definition fbuffer.cpp:168
void setDelta(uint32 d)
define the block size by which the Buffer grows, see grow()
Definition fbuffer.h:132
uint32 getFillSize() const
Definition fbuffer.h:117
char16 * wcharPtr() const
conversion
Definition fbuffer.h:209
char8 * str8() const
conversion
Definition fbuffer.h:199
Invariant String.
Definition fstring.h:117
bool isAsciiString() const
Checks if all characters in string are in ascii range.
Definition fstring.cpp:1784
static int32 wideStringToMultiByte(char8 *dest, const char16 *source, int32 char8Count, uint32 destCodePage=kCP_Default)
If dest is zero, this returns the maximum number of bytes needed to convert source.
Definition fstring.cpp:1889
static int32 multiByteToWideString(char16 *dest, const char8 *source, int32 wcharCount, uint32 sourceCodePage=kCP_Default)
If dest is zero, this returns the maximum number of bytes needed to convert source.
Definition fstring.cpp:1823
virtual int32 length() const
Return length of string.
Definition fstring.h:128
void beginWrite()
remembers position and writes 0
Definition fstreamer.cpp:98
void endRead()
jump to end of chunk
int32 endWrite()
writes and returns size (since the start marker)
int32 beginRead()
returns size
Byteorder-aware base class for typed stream i/o.
Definition fstreamer.h:58
char8 * readStr8()
read a string length and string text (The return string must be deleted when use is finished)
virtual TSize writeRaw(const void *, TSize)=0
Write one buffer of size.
TSize writeString8(const char8 *ptr, bool terminate=false)
a direct output function writing only one string (ascii 8bit)
int32 readStringUtf8(tchar *ptr, int32 maxSize)
read a UTF8 string
virtual int64 seek(int64, FSeekMode)=0
Set file position for stream.
TSize readString8(char8 *ptr, TSize size)
a direct input function reading only one string (ascii) (ended by a or \0 or eof)
virtual int64 tell()=0
Return current file position.
static int32 getStr8Size(const char8 *ptr)
returns the size of a saved string
bool writeStringUtf8(const tchar *ptr)
always terminated, converts to utf8 if non ascii characters are in string
bool writeBool(bool)
Write one boolean.
virtual TSize readRaw(void *, TSize)=0
Read one buffer of size.
bool writeStr8(const char8 *ptr)
write a string length (strlen) and string itself
bool readBool(bool &)
Read one bool.
Base class for streams.
Definition ibstream.h:30
virtual tresult PLUGIN_API tell(int64 *pos)=0
Gets current stream read-write position.
virtual tresult PLUGIN_API read(void *buffer, int32 numBytes, int32 *numBytesRead=nullptr)=0
Reads binary data from stream.
virtual tresult PLUGIN_API seek(int64 pos, int32 mode, int64 *result=nullptr)=0
Sets stream read-write position.
virtual tresult PLUGIN_API write(void *buffer, int32 numBytes, int32 *numBytesWritten=nullptr)=0
Writes binary data to stream.
int64 tell() SMTG_OVERRIDE
Return current file position.
Definition fstreamer.cpp:83
TSize writeRaw(const void *, TSize) SMTG_OVERRIDE
Write one buffer of size.
Definition fstreamer.cpp:67
TSize readRaw(void *, TSize) SMTG_OVERRIDE
Read one buffer of size.
Definition fstreamer.cpp:59
int64 seek(int64, FSeekMode) SMTG_OVERRIDE
Set file position for stream.
Definition fstreamer.cpp:75
IBStreamer(IBStream *stream, int16 byteOrder=BYTEORDER)
Constructor for a given IBSTream and a byteOrder.
Definition fstreamer.cpp:53
const char8 * text8() const SMTG_OVERRIDE
Returns pointer to string of type char8.
Definition fstring.h:640
T count(T... args)
@ kCP_Default
Default ANSI codepage.
Definition fstring.h:76
@ kCP_Utf8
UTF8 Encoding.
Definition fstring.h:72
#define SWAP_32(l)
Byte-order Conversion Macros.
Definition ftypes.h:126
typedef char
typedef float
memcmp
memcpy
strlen