Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::resources::ResourceEncoder Class Reference

A class that handles encoding of resources to binary data. More...

#include <omResourceEncoder.h>

Inheritance diagram for om::resources::ResourceEncoder:
om::io::DataOutputStream

Public Member Functions

const ResourceIDgetFileID () const
 Return the resource ID of the resource set file that is being encoded. More...
 
void setFileID (const ResourceID &newFileID)
 Set the resource ID of the resource set file that is being encoded. More...
 
const io::BinaryFormatgetFormat () const
 Return a reference to the binary format this encoder is using. More...
 
void setFormat (const io::BinaryFormat &newFormat)
 Set the binary format this encoder is using. More...
 
io::DataOutputStreamgetStream () const
 Return a pointer to a data stream that is the destination of this encoder. More...
 
void setStream (io::DataOutputStream *newStream)
 Set a pointer to a data stream that is the destination of this encoder. More...
 
const UBytegetBufferData () const
 Return a pointer to the start of the data encoding buffer. More...
 
Size getBufferSize () const
 Return the number of bytes that have been written to the buffer. More...
 
Size getBufferCapacity () const
 Return the total capacity of the internal buffer. More...
 
Bool setBufferCapacity (Size newCapacity)
 Set the total capacity of the internal buffer. More...
 
void pad ()
 Pad the alignment of the write position to the next aligned object boundary. More...
 
template<typename T >
void write (const T &value)
 Write a value of the templated type and advance the position. More...
 
template<typename T >
void writeArray (const T *array, Size number)
 Write an array of values of the templated type and advance the data pointer. More...
 
template<typename T >
void writeReference (const T *resource, const ResourceSet &resourceSet)
 Write a resource reference for the specified pointer to a concrete template resource type. More...
 
void writeOpaqueReference (const OpaqueResource &resource, const ResourceSet &resourceSet)
 Write a resource reference for the specified opaque resource. More...
 
void writeOpaqueReference (const ResourceType &type, const void *resource, const ResourceSet &resourceSet)
 Write a resource reference for the specified opaque resource. More...
 
void writeASCIIString (const data::String &string)
 Write an ASCII encoded string starting at the specified data pointer and return it and advance the position. More...
 
void writeUTF8String (const data::UTF8String &string)
 Write a UTF-8 encoded string starting at the specified data pointer and return it and advance the position. More...
 
void writeUTF16String (const data::UTF16String &string)
 Write a UTF-16 encoded string starting at the specified data pointer and return it and advance the position. More...
 
void writeUTF32String (const data::UTF32String &string)
 Write a UTF-32 encoded string starting at the specified data pointer and return it and advance the position. More...
 
Bool write (const UByte *newData, Size number)
 Write the specified number of bytes of data from the buffer to the stream. More...
 
virtual Size writeData (const UByte *newData, Size number)
 Write the specified number of bytes of data from the buffer to the stream. More...
 
virtual Bool canSeek () const
 Return whether or not this type of stream allows seeking. More...
 
virtual Bool canSeek (Int64 relativeOffset) const
 Return whether or not this stream can seek by the specified amount in bytes. More...
 
virtual Int64 seek (Int64 relativeOffset)
 Move the current position in the stream by the specified relative signed offset in bytes. More...
 
virtual void flush ()
 Flush buffered output to the stream if the encoder has a valid stream. More...
 
virtual LargeIndex getPosition () const
 Return the current write position of the encoder relative to the start of the output. More...
 
- Public Member Functions inherited from om::io::DataOutputStream
virtual ~DataOutputStream ()
 Destroy an output stream and free all of its resources (close it). More...
 
Size writeData (const data::Data &data)
 Write as much of the specified data array to the stream and return the number of bytes written. More...
 
Size writeData (const data::DataBuffer &dataBuffer)
 Write as much of the specified data array to the stream and return the number of bytes written. More...
 

Detailed Description

A class that handles encoding of resources to binary data.

Member Function Documentation

const ResourceID& om::resources::ResourceEncoder::getFileID ( ) const
inline

Return the resource ID of the resource set file that is being encoded.

void om::resources::ResourceEncoder::setFileID ( const ResourceID newFileID)
inline

Set the resource ID of the resource set file that is being encoded.

const io::BinaryFormat& om::resources::ResourceEncoder::getFormat ( ) const
inline

Return a reference to the binary format this encoder is using.

void om::resources::ResourceEncoder::setFormat ( const io::BinaryFormat newFormat)
inline

Set the binary format this encoder is using.

io::DataOutputStream* om::resources::ResourceEncoder::getStream ( ) const
inline

Return a pointer to a data stream that is the destination of this encoder.

If the stream is NULL, the encoder keeps enlarging its internal buffer as necessary.

void om::resources::ResourceEncoder::setStream ( io::DataOutputStream newStream)
inline

Set a pointer to a data stream that is the destination of this encoder.

If the stream is NULL, the encoder keeps enlarging its internal buffer as necessary.

const UByte* om::resources::ResourceEncoder::getBufferData ( ) const
inline

Return a pointer to the start of the data encoding buffer.

Size om::resources::ResourceEncoder::getBufferSize ( ) const
inline

Return the number of bytes that have been written to the buffer.

Size om::resources::ResourceEncoder::getBufferCapacity ( ) const
inline

Return the total capacity of the internal buffer.

Bool om::resources::ResourceEncoder::setBufferCapacity ( Size  newCapacity)
inline

Set the total capacity of the internal buffer.

The method returns whether or not the capacity was successfully changed.

void om::resources::ResourceEncoder::pad ( )
inline

Pad the alignment of the write position to the next aligned object boundary.

template<typename T >
void om::resources::ResourceEncoder::write ( const T &  value)
inline

Write a value of the templated type and advance the position.

template<typename T >
void om::resources::ResourceEncoder::writeArray ( const T *  array,
Size  number 
)
inline

Write an array of values of the templated type and advance the data pointer.

template<typename T >
void om::resources::ResourceEncoder::writeReference ( const T *  resource,
const ResourceSet resourceSet 
)
inline

Write a resource reference for the specified pointer to a concrete template resource type.

void om::resources::ResourceEncoder::writeOpaqueReference ( const OpaqueResource resource,
const ResourceSet resourceSet 
)
inline

Write a resource reference for the specified opaque resource.

void om::resources::ResourceEncoder::writeOpaqueReference ( const ResourceType type,
const void *  resource,
const ResourceSet resourceSet 
)
inline

Write a resource reference for the specified opaque resource.

void om::resources::ResourceEncoder::writeASCIIString ( const data::String string)
inline

Write an ASCII encoded string starting at the specified data pointer and return it and advance the position.

void om::resources::ResourceEncoder::writeUTF8String ( const data::UTF8String string)
inline

Write a UTF-8 encoded string starting at the specified data pointer and return it and advance the position.

void om::resources::ResourceEncoder::writeUTF16String ( const data::UTF16String string)
inline

Write a UTF-16 encoded string starting at the specified data pointer and return it and advance the position.

void om::resources::ResourceEncoder::writeUTF32String ( const data::UTF32String string)
inline

Write a UTF-32 encoded string starting at the specified data pointer and return it and advance the position.

Bool om::resources::ResourceEncoder::write ( const UByte newData,
Size  number 
)
inline

Write the specified number of bytes of data from the buffer to the stream.

virtual Size om::resources::ResourceEncoder::writeData ( const UByte newData,
Size  number 
)
inlinevirtual

Write the specified number of bytes of data from the buffer to the stream.

The method returns the number of bytes that were actually written.

Implements om::io::DataOutputStream.

virtual Bool om::resources::ResourceEncoder::canSeek ( ) const
inlinevirtual

Return whether or not this type of stream allows seeking.

Implements om::io::DataOutputStream.

virtual Bool om::resources::ResourceEncoder::canSeek ( Int64  relativeOffset) const
inlinevirtual

Return whether or not this stream can seek by the specified amount in bytes.

Implements om::io::DataOutputStream.

virtual Int64 om::resources::ResourceEncoder::seek ( Int64  relativeOffset)
inlinevirtual

Move the current position in the stream by the specified relative signed offset in bytes.

Implements om::io::DataOutputStream.

virtual void om::resources::ResourceEncoder::flush ( )
inlinevirtual

Flush buffered output to the stream if the encoder has a valid stream.

Implements om::io::DataOutputStream.

virtual LargeIndex om::resources::ResourceEncoder::getPosition ( ) const
inlinevirtual

Return the current write position of the encoder relative to the start of the output.

Implements om::io::DataOutputStream.


The documentation for this class was generated from the following file: