UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::Blob Class

Interface for data handling.

To use this class, include the UnigineBlob.h file.

Unigine::Blob Class

Members


static Ptr< Blob > create (size_t size)

Blob constructor.

Arguments

  • size_t size - Size of the blob in bytes.

static Ptr< Blob > create (const StreamPtr & stream)

Blob constructor.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

virtual void resize (size_t size) const =0

Allocates the required memory and resizes the blob.

Arguments

  • size_t size - Size of the blob in bytes.

virtual void allocate (size_t size) const =0

Allocates the required memory without resizing the blob. It will be resized dynamically when the allocated memory is filled.

Arguments

  • size_t size - Size of the allocated memory in bytes.

virtual void reserve (size_t size) const =0

Reserves the blob, i.e. allocates (size * 1.5) bytes without resizing the blob. It will be resized dynamically when the allocated memory is filled.

Arguments

  • size_t size - Size of the allocated memory.

virtual void clear () const =0

Clears the blob size to 0.

virtual size_t getSize () const =0

Returns the current blob size.

Return value

Blob size.

virtual unsigned char * getData () const =0

Returns the current blob data.

Return value

Blob data.

virtual int eof () const =0

Tests if the end of the blob has been reached.

Return value

Returns 1 if the end of the blob is reached; otherwise, 0.

virtual int getc () const =0

Gets a next symbol from the blob.

Return value

Character read from the blob.

virtual int seekSet (size_t offset) const =0

Seeks to position relative to the start of the blob.

Arguments

  • size_t offset - Offset in bytes from the beginning of the blob.

Return value

Returns 1 if the blob position indicator is set successfully; otherwise, 0.

virtual int seekEnd (size_t offset) const =0

Seeks to position relative to the end of the blob.

Arguments

  • size_t offset - Offset in bytes from the end of the blob.

Return value

Returns 1 if the blob position indicator is set successfully; otherwise, 0.

virtual int seekCur (size_t offset) const =0

Seeks to position relative to the current offset.

Arguments

  • size_t offset - Offset in bytes from the current position of indicator.

Return value

Returns 1 if the blob position indicator is set successfully; otherwise, 0.

virtual size_t tell () const =0

Gets the current blob offset position indicator.

Return value

Returns the current blob offset.

virtual int flush () const =0

Flushes the blob.

Return value

Returns 1 if the blob is flushed successfully; otherwise, 0.

virtual int decode (const char * src) const =0

Decodes a base64 encoded string into the blob.

Arguments

  • const char * src - Source base64 encoded string.

Return value

Returns 1 if the data is decoded successfully; otherwise, 0.

virtual String encode () const =0

Encodes the blob into the base64 encoded string.

Return value

Base64 encoded string.

virtual int compress (const StreamPtr & dest, int quality) const =0

Compresses the blob and writes it into the given stream.

Arguments

  • const StreamPtr & dest - Destination stream.
  • int quality - Compression quality (0 is for fast compression, 1 is for a small size).

Return value

Returns 1 if the data is compressed successfully; otherwise, 0.

virtual int decompress (const StreamPtr & src) const =0

Reads the compressed blob from a stream and decompresses it.

Arguments

  • const StreamPtr & src - Source stream to read data from.

Return value

Returns 1 if the blob is decompressed successfully; otherwise, 0.

virtual String getSHA1 () const =0

Returns the 160-bit SHA1 checksum.

Return value

The 160-bit SHA1 checksum.

virtual String getMD5 () const =0

Returns the 128-bit MD5 checksum.

Return value

The 128-bit MD5 checksum.

virtual String getCRC32 () const =0

Returns the 32-bit CRC checksum.

Return value

The 32-bit CRC checksum.
Last update: 2017-07-03