This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::Blob Class

Interface for data handling.

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

Blob Class

Members


Blob (size_t size = 0)

Constructor. Creates a new blob of the specified size.

Arguments

  • size_t size - Blob size.

size_t tell ()

Gets the current blob offset position indicator.

Return value

Returns the current blob offset.

void resize (size_t size)

Allocates the required memory and resizes the blob.

Arguments

  • size_t size - Size of the blob in bytes.

size_t getSize ()

Returns the current blob size.

Return value

Blob size.

int compress (const Ptr<Stream> & dest, int quality)

Compresses the blob and writes it into the given stream.

Arguments

  • const Ptr<Stream> & 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.

int seekEnd (size_t offset)

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.

String getMD5 ()

Returns the 128-bit MD5 checksum.

Return value

The 128-bit MD5 checksum.

int seekCur (size_t offset)

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.

String getCRC32 ()

Returns the 32-bit CRC checksum.

Return value

The 32-bit CRC checksum.

int seekSet (size_t offset)

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.

int getc ()

Gets a next symbol from the blob.

Return value

Character read from the blob.

int decompress (const Ptr<Stream> & src)

Reads the compressed blob from a stream and decompresses it.

Arguments

  • const Ptr<Stream> & src - Source stream to read data from.

Return value

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

int decode (const char * src)

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.

unsigned char get (size_t offset)

Returns the value of the specified byte in the blob.

Arguments

  • size_t offset - The offset, in bytes.

Return value

The byte value.

int eof ()

Tests if the end of the blob has been reached.

Return value

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

String getSHA1 ()

Returns the 160-bit SHA1 checksum.

Return value

The 160-bit SHA1 checksum.

void clear ()

Clears the blob size to 0.

unsigned char * getData ()

Returns the current blob data.

Return value

Blob data.

void set (size_t offset, unsigned char value)

Sets the value of the specified byte in the blob.

Arguments

  • size_t offset - The offset in the blob.
  • unsigned char value - The byte value.

void reserve (size_t size)

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.

Ptr<Blob> create (const Ptr<Stream> & stream)

Blob constructor.

Arguments

  • const Ptr<Stream> & stream - Size of the blob in bytes.

Return value

String encode ()

Encodes the blob into the base64 encoded string.

Return value

Base64 encoded string.

int flush ()

Flushes the blob.

Return value

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

void allocate (size_t size)

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.
Last update: 2017-07-03
Build: ()