Tide 0.1.0
|
Void primitive element. More...
#include <tide/void_element.h>
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. |
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.
tide::VoidElement::VoidElement | ( | std::streamsize | tgt_size, |
bool | fill = false |
||
) |
Create a new void element.
[in] | tgt_size | The size of the element, in bytes. This much space will be reserved in the file. |
[in] | fill | If true, when writing the element, the element's body will be filled with 0x00. |
VoidTooSmall | if 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.
[in] | element | The element to replace. |
[in] | fill | Whether to fill the space in the file with zeros. |
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.
VoidTooSmall | if 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.
Implements tide::Element.