|
libebml_ng
|
Abstract base class for EBML Element instances. More...
#include <ebmlElement.h>
Public Member Functions | |||||
| virtual | ~ebmlElement () | ||||
| virtual const ebmlElementType & | cls () const | ||||
| Returns a reference to the associated element class. More... | |||||
| ebmlID_t | ebmlID () const | ||||
| Retrieve the EBML ID of the element. More... | |||||
| template<typename T = ebmlElement> | |||||
| T & | as () | ||||
| Dynamically cast the element to the requested type. More... | |||||
| template<typename T = ebmlElement> | |||||
| T & | as () const | ||||
| Const version of the dynamic cast. More... | |||||
| ebml::ptr< ebmlElement > | sp () | ||||
| Returns a shared pointer to the element instance. More... | |||||
| ebml::ptr< const ebmlElement > | sp () const | ||||
| Returns a shared pointer to a const element. More... | |||||
| template<typename T > | |||||
| ebml::ptr< T > | sp () | ||||
| template<typename T > | |||||
| ebml::ptr< T > | sp () const | ||||
| ebml::wptr< ebmlElement > | wp () | ||||
| ebml::wptr< const ebmlElement > | wp () const | ||||
| template<typename T > | |||||
| ebml::wptr< T > | wp () | ||||
| template<typename T > | |||||
| ebml::wptr< T > | wp () const | ||||
| bool | parent_is_const () const | ||||
| Check if the element's parent is a const object. More... | |||||
| ebml::ptr< ebmlMasterElement > | parent () const | ||||
| Retrieve the parent of this element. More... | |||||
| ebml::ptr< const ebmlMasterElement > | c_parent () const | ||||
| Retrieve a const shared pointer to the parent element. More... | |||||
| ebmlElement_sp | root () const | ||||
| c_ebmlElement_sp | c_root () const | ||||
| ebmlDocument_sp | document () const | ||||
| bool | hasParent () const | ||||
| unsigned char | headSize () const | ||||
| unsigned char | headSize (size_t) const | ||||
| unsigned char | sizeWidth () const | ||||
| unsigned char | sizeWidth (size_t) const | ||||
| size_t | outerSize () const | ||||
| size_t | outerSize (size_t) const | ||||
| virtual size_t | dataSize () const =0 | ||||
| off_t | offsetInParent () const | ||||
| off_t | offsetInFile () const | ||||
| off_t | dataOffsetInParent () const | ||||
| off_t | dataOffsetInFile () const | ||||
| ebml::ptr< ebmlElement > | clone () const | ||||
| virtual std::wstring | minirepr () const =0 | ||||
| virtual std::wstring | repr () const | ||||
| seekData_t * | makeSeekData () | ||||
| seekData_t * | makeSeekData () const | ||||
Encode Functions | |||||
Provides a set of overloaded methods for encoding an EBML element. This group of methods converts an EBML element instance into a raw byte representation according to the EBML specification.
| |||||
| std::string | encode () const | ||||
Encodes the element and returns it as a std::string. More... | |||||
| size_t | encode (char *) const | ||||
| Encodes the element into a pre-allocated buffer. More... | |||||
| size_t | encode (ioBase &) const | ||||
| Encodes the element and writes it to a generic I/O stream. More... | |||||
| size_t | encode (ioBase &, off_t) const | ||||
| Encodes the element and writes it to a specific offset in a stream. More... | |||||
| size_t | encode (char *, size_t) const | ||||
| Encodes the element using a pre-computed size. More... | |||||
Protected Member Functions | |
| ebmlElement (const ebmlElementType *) | |
| Protected constructor. More... | |
| void | _validate () |
| void | _setParent (const ebml::ptr< ebmlMasterElement > &parent, bool weak=true) |
| void | _setParent (const ebml::ptr< const ebmlMasterElement > &parent, bool weak=true) |
| void | _setParent (ebml::ptr< ebmlMasterElement > &&parent, bool weak=true) |
| void | _setParent (ebml::ptr< const ebmlMasterElement > &&parent, bool weak=true) |
| void | _setParent (ebmlMasterElement &parent, bool weak=true) |
| void | _setParent (const ebmlMasterElement &parent, bool weak=true) |
| void | _detach () |
| size_t | _encode_head (char *, size_t) const |
| virtual size_t | _encode (char *) const =0 |
| virtual ebmlElement * | _clone () const =0 |
Protected Attributes | |
| const ebmlElementType * | _cls |
| Pointer to the companion element type (an ebmlElementClass subclass). More... | |
| wptr< ebmlElement > | _self |
| Custom weak pointer to self (used for shared-from-this semantics). More... | |
| ebmlDocument_wp | _document |
| vintWidth_t | _sizeWidth = 0 |
| off_t | _offsetInParent = -1 |
Friends | |
| class | ebmlDocument |
| class | ebmlElementType |
| class | ebmlMasterElement |
| class | ebmlLazyLoad |
| template<typename T > | |
| class | ebmlDataElementClass |
Abstract base class for EBML Element instances.
Each EBML element instance corresponds to an entry in an EBML file or data stream. This abstract class defines the interface for encoding/decoding, cloning, accessing parent/child relationships, and obtaining size and location information.
The class also employs shared and weak pointer semantics tailored for EBML operations.
ebml::ebmlElementCRTP<ebmltype_t, ebmlinst_t, instbase_t>
|
protected |
Protected constructor.
| cls | Pointer to the companion ebml::ebmlElementType instance describing this element type. |
This constructor can only be called by friend classes (typically the companion element type).
|
virtual |
|
protectedpure virtual |
Implemented in ebml::ebmlElementCRTP< ebmlVoidType, ebmlVoid >, ebml::ebmlElementCRTP< ebmlMasterElementType, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlLazyLoadType, ebmlLazyLoad, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlDataType< const T >, ebmlDataElement< const T > >, ebml::ebmlElementCRTP< ebmlPairType< K, V >, ebmlPair< K, V >, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlMapType< K, V, H, E, A, B >, ebmlMap< K, V, H, E, A, B >, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlStructType, ebmlStruct, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlListType, ebmlList, ebmlMasterElement >, and ebml::ebmlElementCRTP< ebmlDataType< T >, ebmlDataElement< T > >.
|
protected |
|
protectedpure virtual |
Implemented in ebml::ebmlDataElement< const T >, ebml::ebmlMasterElement, and ebml::ebmlVoid.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inlineprotected |
|
inline |
Dynamically cast the element to the requested type.
| T | The desired element type (defaults to ebmlElement). |
| std::bad_cast | if the dynamic_cast fails. |
|
inline |
Const version of the dynamic cast.
| T | The desired element type. |
| std::bad_cast | if the dynamic_cast fails. |
| ebml::ptr< const ebmlMasterElement > ebml::ebmlElement::c_parent | ( | ) | const |
Retrieve a const shared pointer to the parent element.
| c_ebmlElement_sp ebml::ebmlElement::c_root | ( | ) | const |
| ebml::ptr< ebmlElement > ebml::ebmlElement::clone | ( | ) | const |
|
virtual |
Returns a reference to the associated element class.
This function typically performs a dynamic_cast to obtain a more specific subclass based on the element’s actual type.
| std::bad_cast | If the dynamic_cast fails. |
Reimplemented in ebml::ebmlElementCRTP< ebmlVoidType, ebmlVoid >, ebml::ebmlElementCRTP< ebmlMasterElementType, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlLazyLoadType, ebmlLazyLoad, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlDataType< const T >, ebmlDataElement< const T > >, ebml::ebmlElementCRTP< ebmlPairType< K, V >, ebmlPair< K, V >, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlMapType< K, V, H, E, A, B >, ebmlMap< K, V, H, E, A, B >, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlStructType, ebmlStruct, ebmlMasterElement >, ebml::ebmlElementCRTP< ebmlListType, ebmlList, ebmlMasterElement >, and ebml::ebmlElementCRTP< ebmlDataType< T >, ebmlDataElement< T > >.
| off_t ebml::ebmlElement::dataOffsetInFile | ( | ) | const |
| off_t ebml::ebmlElement::dataOffsetInParent | ( | ) | const |
|
pure virtual |
Implemented in ebml::ebmlLazyLoad, ebml::ebmlLazyLoad, ebml::ebmlDataElement< const T >, ebml::ebmlMasterElement, and ebml::ebmlVoid.
| ebmlDocument_sp ebml::ebmlElement::document | ( | ) | const |
| ebmlID_t ebml::ebmlElement::ebmlID | ( | ) | const |
Retrieve the EBML ID of the element.
|
inline |
Encodes the element and returns it as a std::string.
|
inline |
Encodes the element into a pre-allocated buffer.
|
inline |
Encodes the element and writes it to a generic I/O stream.
|
inline |
Encodes the element and writes it to a specific offset in a stream.
| size_t ebml::ebmlElement::encode | ( | char * | dest, |
| size_t | dataSize | ||
| ) | const |
Encodes the element using a pre-computed size.
This specialized overload takes a pre-computed size as an argument, which avoids redundant dataSize() calls for master elements and their descendants, significantly improving performance for deep trees.
| dest | A pointer to the destination buffer where the encoded element will be written. |
| dataSize | The pre-computed size of the element's data payload. |
| bool ebml::ebmlElement::hasParent | ( | ) | const |
| unsigned char ebml::ebmlElement::headSize | ( | ) | const |
| unsigned char ebml::ebmlElement::headSize | ( | size_t | dataSize | ) | const |
| seekData_t * ebml::ebmlElement::makeSeekData | ( | ) |
| seekData_t * ebml::ebmlElement::makeSeekData | ( | ) | const |
|
pure virtual |
| off_t ebml::ebmlElement::offsetInFile | ( | ) | const |
|
inline |
| size_t ebml::ebmlElement::outerSize | ( | ) | const |
| size_t ebml::ebmlElement::outerSize | ( | size_t | dataSize | ) | const |
| ebml::ptr< ebmlMasterElement > ebml::ebmlElement::parent | ( | ) | const |
Retrieve the parent of this element.
| std::runtime_error | If the parent is const. |
| bool ebml::ebmlElement::parent_is_const | ( | ) | const |
Check if the element's parent is a const object.
|
virtual |
Reimplemented in ebml::ebmlVoid.
| ebmlElement_sp ebml::ebmlElement::root | ( | ) | const |
| unsigned char ebml::ebmlElement::sizeWidth | ( | ) | const |
| unsigned char ebml::ebmlElement::sizeWidth | ( | size_t | dataSize | ) | const |
| ebml::ptr< ebmlElement > ebml::ebmlElement::sp | ( | ) |
Returns a shared pointer to the element instance.
| ebml::ptr< const ebmlElement > ebml::ebmlElement::sp | ( | ) | const |
Returns a shared pointer to a const element.
|
inline |
|
inline |
| ebml::wptr< ebmlElement > ebml::ebmlElement::wp | ( | ) |
| ebml::wptr< const ebmlElement > ebml::ebmlElement::wp | ( | ) | const |
|
inline |
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
Pointer to the companion element type (an ebmlElementClass subclass).
|
protected |
|
protected |
|
protected |
Custom weak pointer to self (used for shared-from-this semantics).
|
protected |
1.8.14