IWriterHelper Class Referenceabstract

Helper to write basic EBML types. More...

Inherited by CWriterHelper.

Public Member Functions

virtual void release (void)=0
 Tells this object it won't be used anymore. More...
 
Writer connection
virtual EBML::boolean connect (EBML::IWriter *pWriter)=0
 Connects an EBML writer to this helper. More...
 
virtual EBML::boolean disconnect (void)=0
 Disconnects the currently connected EBML writer. More...
 
Writer binding functions
virtual EBML::boolean openChild (const EBML::CIdentifier &rIdentifier)=0
 Child opening binding. More...
 
virtual EBML::boolean closeChild (void)=0
 Child closing binding. More...
 
Standard EBML formating

EBML::IWriter::setChildData replacement

Returns
true on success.
false on error.

Those functions should be used in place of the basic EBML::IWriter::setChildData function. They format standard EBML types into corresponding buffers and then send those built buffers to the writer using the EBML::IWriter::setChildData function.

virtual EBML::boolean setSIntegerAsChildData (const EBML::int64 iValue)=0
 Sets a signed integer as child data. More...
 
virtual EBML::boolean setUIntegerAsChildData (const EBML::uint64 uiValue)=0
 Sets an unsigned integer as child data. More...
 
virtual EBML::boolean setFloat32AsChildData (const EBML::float32 fValue)=0
 Sets a 32 bits float value as child data. More...
 
virtual EBML::boolean setFloat64AsChildData (const EBML::float64 fValue)=0
 Sets a 64 bits float value as child data. More...
 
virtual EBML::boolean setBinaryAsChildData (const void *pBuffer, const EBML::uint64 ui64BufferLength)=0
 Sets a buffer as child data. More...
 
virtual EBML::boolean setASCIIStringAsChildData (const char *sValue)=0
 Sets an ASCII string as child data. More...
 

Protected Member Functions

virtual ~IWriterHelper (void)
 Virtual destructor - should be overloaded.
 

Detailed Description

Helper to write basic EBML types.

Author
Yann Renard (INRIA/IRISA)
Date
2006-08-07 This class may be used by the user in order to correctly format simple types defined in the EBML description such as integers, floats, strings etc... It directly uses the EBML::IWriter connected instance so one could simply use the helper in order to write his EBML stream.

A similar class exists to help parsing process... See EBML::IReaderHelper for more details.

Be sure to look at http://ebml.sourceforge.net/specs/ in order to understand what EBML is and how it should be used.

Todo:

float80 formating implementation

date formating implementation

utf8 string formating implementation

Member Function Documentation

virtual EBML::boolean connect ( EBML::IWriter pWriter)
pure virtual

Connects an EBML writer to this helper.

Parameters
pWriter[in] : The writer to connect
Returns
true on success.
false on error.

This function gives the helper a handle to the writer to use in order to forward requests. Thus, when the user calls a helper function, the call is forwarded to the correct writer that effictively does the work. The aim of this helper is simply to transform standard EBML types into bytes buffers.

Once a writer is connected, it could be disconnected thanks to the disconnect function. It must be done before calling connect again.

virtual EBML::boolean disconnect ( void  )
pure virtual

Disconnects the currently connected EBML writer.

Returns
true on success.
false on error.

This function should be called to release the EBML writer handle. The helper instance may then be used with another EBML writer instance calling connect again.

virtual EBML::boolean openChild ( const EBML::CIdentifier rIdentifier)
pure virtual

Child opening binding.

Parameters
rIdentifier[in] : The identifier of the new child node
Returns
true on success.
false on error.

This function simply forwards the call to the corresponding EBML::IWriter function. See EBML::IWriter::openChild for more details.

virtual EBML::boolean closeChild ( void  )
pure virtual

Child closing binding.

Returns
true on success.
false on error.

This function simply forwards the call to the corresponding EBML::IWriter function. See EBML::IWriter::closeChild for more details.

virtual EBML::boolean setSIntegerAsChildData ( const EBML::int64  iValue)
pure virtual

Sets a signed integer as child data.

Parameters
iValue[in] : The integer value to set
virtual EBML::boolean setUIntegerAsChildData ( const EBML::uint64  uiValue)
pure virtual

Sets an unsigned integer as child data.

Parameters
uiValue[in] : The integer value to set
virtual EBML::boolean setFloat32AsChildData ( const EBML::float32  fValue)
pure virtual

Sets a 32 bits float value as child data.

Parameters
fValue[in] : The 32 bits float value to set
virtual EBML::boolean setFloat64AsChildData ( const EBML::float64  fValue)
pure virtual

Sets a 64 bits float value as child data.

Parameters
fValue[in] : The 64 bits float value to set
virtual EBML::boolean setBinaryAsChildData ( const void *  pBuffer,
const EBML::uint64  ui64BufferLength 
)
pure virtual

Sets a buffer as child data.

Parameters
pBuffer[in] : The buffer to send to the writer
ui64BufferLength[in] : The buffer size in bytes
Note
This function simply calls the basic EBML::IWriter::setChildData function with the same two parameters.
virtual EBML::boolean setASCIIStringAsChildData ( const char *  sValue)
pure virtual

Sets an ASCII string as child data.

Parameters
sValue[in] : The ASCII string value to set
virtual void release ( void  )
pure virtual

Tells this object it won't be used anymore.

Instances of this class can not be instanciated another way than calling createWriterHelper. They can not be deleted either because the destructor is. protected. The library knows how to create and delete an instance of this class... Calling release will simply delete this instance and handle necessary cleanings when needed.

The current object is invalid after calling this function. It can not be used anymore.

Warning
Releasing this obbject does not release the connected writer instance !