Tide 0.1.0
Public Member Functions

tide::VoidElement Class Reference

Void primitive element. More...

#include <tide/void_element.h>

Inheritance diagram for tide::VoidElement:
Inheritance graph
[legend]
Collaboration diagram for tide::VoidElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 VoidElement (std::streamsize tgt_size, bool fill=false)
 Create a new void element.
 VoidElement (Element const &element, bool fill=false)
 Create a new VoidElement that replaces another element.
void set_size (std::streamsize tgt_size)
 Set the size of this element.
std::streamsize size () const
 Get the total size of the element.
bool fill () const
 Get the fill setting.
void fill (bool fill)
 Set the fill setting.
virtual std::streamsize write (std::ostream &output)
 Element writing.
virtual std::streamsize write_body (std::ostream &output)
 Element body writing.
std::streamsize read (std::istream &input)
 Element reading.

Detailed Description

Void primitive element.

This is a void element, specified with the EBML ID 0xEC. Void elements are ignored by the parser. They are typically used to reserve some space in a byte stream for later writing, or to blank out an element that is no longer used without re-writing the entire file.

Definition at line 49 of file void_element.h.


Constructor & Destructor Documentation

tide::VoidElement::VoidElement ( std::streamsize  tgt_size,
bool  fill = false 
)

Create a new void element.

Parameters:
[in]tgt_sizeThe size of the element, in bytes. This much space will be reserved in the file.
[in]fillIf true, when writing the element, the element's body will be filled with 0x00.
Exceptions:
VoidTooSmallif tgt_size is less than 2 bytes.
tide::VoidElement::VoidElement ( Element const &  element,
bool  fill = false 
)

Create a new VoidElement that replaces another element.

This constructor creates a VoidElement with its fill set to the necessary size to completely and exactly cover the element passed to it.

Parameters:
[in]elementThe element to replace.
[in]fillWhether to fill the space in the file with zeros.

Member Function Documentation

bool tide::VoidElement::fill ( ) const [inline]

Get the fill setting.

Definition at line 87 of file void_element.h.

void tide::VoidElement::fill ( bool  fill) [inline]

Set the fill setting.

A void element may fill its body when written. This is typically used when writing it at the end of a byte stream, such as reserving space in a file to be filled in later with other data. Set fill to true to do so.

On the other hand, void elements are also used for blanking out existing elements that are no longer used, such as when removing a tag, without needing to rewrite the entire file. In this case, only the element ID and size need to be written, with the remainder of the element's body being left as-is. Set fill to false for this style of writing.

Definition at line 102 of file void_element.h.

std::streamsize tide::VoidElement::read ( std::istream &  input) [virtual]

Element reading.

Reimplemented from tide::Element.

void tide::VoidElement::set_size ( std::streamsize  tgt_size)

Set the size of this element.

A void element has a size value, given in bytes, which determines how much space it reserves in the byte stream.

Exceptions:
VoidTooSmallif tgt_size is less than 2 bytes.
std::streamsize tide::VoidElement::size ( ) const [virtual]

Get the total size of the element.

Reimplemented from tide::Element.

virtual std::streamsize tide::VoidElement::write ( std::ostream &  output) [virtual]

Element writing.

Reimplemented from tide::Element.

virtual std::streamsize tide::VoidElement::write_body ( std::ostream &  output) [virtual]

Element body writing.

Writes the element's size and body to a byte stream providing a std::ostream interface.

Void elements may or may not fill their body with 0x00, based on the setting of the fill member property. Whether or not the body is actually filled by this method, the return value and the write position pointer in the output stream will reflect the full size of the void element.

Returns:
The number of bytes written.

Implements tide::Element.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines