Tag Parser  6.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
Media::GenericFileElement< ImplementationType > Class Template Reference

The GenericFileElement class helps to parse binary files which consist of an arboreal element strucutre. More...

#include <genericfileelement.h>

Inheritance diagram for Media::GenericFileElement< ImplementationType >:
[legend]
Collaboration diagram for Media::GenericFileElement< ImplementationType >:
[legend]

Public Types

typedef FileElementTraits< ImplementationType >::containerType containerType
 Specifies the type of the corresponding container. More...
 
typedef FileElementTraits< ImplementationType >::identifierType identifierType
 Specifies the type used to store identifiers. More...
 
typedef FileElementTraits< ImplementationType >::dataSizeType dataSizeType
 Specifies the type used to store data sizes. More...
 
typedef FileElementTraits< ImplementationType >::implementationType implementationType
 Specifies the type of the actual implementation. More...
 
- Public Types inherited from Media::StatusProvider
typedef std::function< void(StatusProvider &sender)> CallbackFunction
 
typedef std::vector< CallbackFunctionCallbackVector
 
typedef std::pair< int, CallbackFunctionCallbackPair
 

Public Member Functions

 GenericFileElement (containerType &container, uint64 startOffset)
 
 GenericFileElement (implementationType &parent, uint64 startOffset)
 
 GenericFileElement (containerType &container, uint64 startOffset, uint64 maxSize)
 
 GenericFileElement (const GenericFileElement &other)=delete
 
 GenericFileElement (GenericFileElement &other)=delete
 
GenericFileElementoperator= (const GenericFileElement &other)=delete
 
containerTypecontainer ()
 Returns the related container. More...
 
const containerTypecontainer () const
 Returns the related container. More...
 
std::iostream & stream ()
 Returns the related stream. More...
 
IoUtilities::BinaryReader & reader ()
 Returns the related BinaryReader. More...
 
IoUtilities::BinaryWriter & writer ()
 Returns the related BinaryWriter. More...
 
uint64 startOffset () const
 Returns the start offset in the related stream. More...
 
uint64 relativeStartOffset () const
 Returns the offset of the element in its parent or - if it is a top-level element - in the related stream. More...
 
const identifierTypeid () const
 Returns the element ID. More...
 
std::string idToString () const
 Returns a printable string representation of the element ID. More...
 
uint32 idLength () const
 Returns the length of the id denotation in byte. More...
 
uint32 headerSize () const
 Returns the header size of the element in byte. More...
 
dataSizeType dataSize () const
 Returns the data size of the element in byte. More...
 
uint32 sizeLength () const
 Returns the length of the size denotation of the element in byte. More...
 
uint64 dataOffset () const
 Returns the data offset of the element in the related stream. More...
 
uint64 totalSize () const
 Returns the total size of the element. More...
 
uint64 endOffset () const
 Returns the offset of the first byte which doesn't belong to this element anymore. More...
 
uint64 maxTotalSize () const
 Returns maximum total size. More...
 
implementationTypeparent ()
 Returns the parent of the element. More...
 
const implementationTypeparent () const
 Returns the parent of the element. More...
 
implementationTypenextSibling ()
 Returns the next sibling of the element. More...
 
const implementationTypenextSibling () const
 Returns the next sibling of the element. More...
 
implementationTypefirstChild ()
 Returns the first child of the element. More...
 
const implementationTypefirstChild () const
 Returns the first child of the element. More...
 
implementationTypesubelementByPath (const std::initializer_list< identifierType > &path)
 Returns the sub element for the specified path. More...
 
implementationTypesubelementByPath (std::list< identifierType > &path)
 
implementationTypechildById (const identifierType &id)
 Returns the first child with the specified id. More...
 
implementationTypesiblingById (const identifierType &id, bool includeThis=false)
 Returns the first sibling with the specified id. More...
 
FileElementIterator< implementationTypebegin ()
 Returns an iterator for iterating over the element's childs. More...
 
FileElementIterator< implementationTypeend ()
 Returns an invalid iterator. More...
 
const FileElementIterator< implementationTypebegin () const
 Returns an iterator for iterating over the element's childs (constant). More...
 
const FileElementIterator< implementationTypeend () const
 Returns an invalid iterator. More...
 
bool isParent () const
 Returns an indication whether this instance is a parent element. More...
 
bool isPadding () const
 Returns an indication whether this instance is a padding element. More...
 
uint64 firstChildOffset () const
 Returns the offset of the first child (relative to the start offset of this element). More...
 
bool isParsed () const
 Returns an indication whether this instance has been parsed yet. More...
 
void clear ()
 Clears the status of the element. More...
 
void parse ()
 Parses the header information of the element which is read from the related stream at the start offset. More...
 
void reparse ()
 Parses the header information of the element which is read from the related stream at the start offset. More...
 
void validateSubsequentElementStructure (NotificationList &gatheredNotifications, uint64 *paddingSize=nullptr)
 Parses (see parse()) this and all subsequent elements. More...
 
void copyHeader (std::ostream &targetStream)
 Writes the header informaton of the element to the specified targetStream. More...
 
void copyWithoutChilds (std::ostream &targetStream)
 Writes the element without its childs to the specified targetStream. More...
 
void copyEntirely (std::ostream &targetStream)
 Writes the entire element including all childs to the specified targetStream. More...
 
void makeBuffer ()
 Buffers the element (header and data). More...
 
void discardBuffer ()
 Discards buffered data. More...
 
void copyBuffer (std::ostream &targetStream)
 Copies buffered data to targetStream. More...
 
void copyPreferablyFromBuffer (std::ostream &targetStream)
 Copies buffered data to targetStream if data has been buffered; copies from input stream otherwise. More...
 
const std::unique_ptr< char[]> & buffer ()
 Returns buffered data. More...
 
implementationTypedenoteFirstChild (uint32 offset)
 Denotes the first child to start at the specified offset (relative to the start offset of this descriptor). More...
 
- Public Member Functions inherited from Media::StatusProvider
const NotificationListnotifications () const
 Returns notifications for the current object. More...
 
bool hasNotifications () const
 Returns an indication whether there are notifications for the current object. More...
 
bool hasCriticalNotifications () const
 Returns an indication whether there are critical notifications for the current object. More...
 
NotificationType worstNotificationType () const
 Returns the worst notification type. More...
 
const std::string & currentStatus () const
 Returns a status information for the current object. More...
 
double currentPercentage () const
 Returns the progress percentage of the current object. More...
 
size_t registerCallback (CallbackFunction callback)
 Registers a callback function. More...
 
void unregisterCallback (size_t id)
 Unregisters a previously registered callback function whith the specified id. More...
 
void unregisterAllCallbacks ()
 Unregisters all callback functions. More...
 
void forwardStatusUpdateCalls (StatusProvider *other=nullptr)
 Forwards all status updates calls to the specified statusProvider. More...
 
StatusProviderusedProvider ()
 Returns the provider which callback functions will be called when the status or the percentage is updated. More...
 
void tryToAbort ()
 Commands the object to abort the current operation. More...
 
bool isAborted () const
 Returns an indication whether the current operation should be aborted. More...
 
void invalidateStatus ()
 Invalidates the current status. More...
 
void invalidateNotifications ()
 Invalidates the object's notifications. More...
 
void updateStatus (const std::string &status)
 This method is meant to be called by the derived class to report updated status information. More...
 
void updateStatus (const std::string &status, double percentage)
 This method is meant to be called by the derived class to report updated status information. More...
 
void updatePercentage (double percentage)
 This method is meant to be called by the derived class to report updated progress percentage only. More...
 
void addNotification (const Notification &notification)
 This protected method is meant to be called by the derived class to add a notification. More...
 
void addNotification (NotificationType type, const std::string &message, const std::string &context)
 This protected method is meant to be called by the derived class to add a notification of the specified type, message and context. More...
 
void addNotifications (const StatusProvider &from)
 This protected method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More...
 
void addNotifications (const std::string &higherContext, const StatusProvider &from)
 This protected method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More...
 
void addNotifications (const NotificationList &notifications)
 This protected method is meant to be called by the derived class to add the specified notifications. More...
 

Static Public Member Functions

static constexpr uint32 maximumIdLengthSupported ()
 Returns the maximum id length supported by the class in byte. More...
 
static constexpr uint32 maximumSizeLengthSupported ()
 Returns the maximum size length supported by the class in byte. More...
 
static constexpr byte minimumElementSize ()
 Returns the mimimum element size. More...
 

Protected Attributes

identifierType m_id
 
uint64 m_startOffset
 
uint64 m_maxSize
 
uint32 m_idLength
 
dataSizeType m_dataSize
 
uint32 m_sizeLength
 
implementationTypem_parent
 
std::unique_ptr< implementationTypem_nextSibling
 
std::unique_ptr< implementationTypem_firstChild
 
std::unique_ptr< char[]> m_buffer
 

Friends

class FileElementTraits< ImplementationType >
 

Additional Inherited Members

- Protected Member Functions inherited from Media::StatusProvider
 StatusProvider ()
 Constructs a new StatusProvider. More...
 

Detailed Description

template<class ImplementationType>
class Media::GenericFileElement< ImplementationType >

The GenericFileElement class helps to parse binary files which consist of an arboreal element strucutre.

Template Parameters
ImplementationTypeSpecifies the type of the actual implementation.

Definition at line 27 of file genericfileelement.h.

Member Typedef Documentation

◆ containerType

template<class ImplementationType>
typedef FileElementTraits<ImplementationType>::containerType Media::GenericFileElement< ImplementationType >::containerType

Specifies the type of the corresponding container.

Definition at line 123 of file genericfileelement.h.

◆ dataSizeType

template<class ImplementationType>
typedef FileElementTraits<ImplementationType>::dataSizeType Media::GenericFileElement< ImplementationType >::dataSizeType

Specifies the type used to store data sizes.

Definition at line 133 of file genericfileelement.h.

◆ identifierType

template<class ImplementationType>
typedef FileElementTraits<ImplementationType>::identifierType Media::GenericFileElement< ImplementationType >::identifierType

Specifies the type used to store identifiers.

Definition at line 128 of file genericfileelement.h.

◆ implementationType

template<class ImplementationType>
typedef FileElementTraits<ImplementationType>::implementationType Media::GenericFileElement< ImplementationType >::implementationType

Specifies the type of the actual implementation.

Definition at line 138 of file genericfileelement.h.

Constructor & Destructor Documentation

◆ GenericFileElement() [1/5]

template<class ImplementationType>
Media::GenericFileElement< ImplementationType >::GenericFileElement ( containerType container,
uint64  startOffset 
)

◆ GenericFileElement() [2/5]

template<class ImplementationType>
Media::GenericFileElement< ImplementationType >::GenericFileElement ( implementationType parent,
uint64  startOffset 
)

◆ GenericFileElement() [3/5]

template<class ImplementationType>
Media::GenericFileElement< ImplementationType >::GenericFileElement ( containerType container,
uint64  startOffset,
uint64  maxSize 
)

◆ GenericFileElement() [4/5]

template<class ImplementationType>
Media::GenericFileElement< ImplementationType >::GenericFileElement ( const GenericFileElement< ImplementationType > &  other)
delete

◆ GenericFileElement() [5/5]

template<class ImplementationType>
Media::GenericFileElement< ImplementationType >::GenericFileElement ( GenericFileElement< ImplementationType > &  other)
delete

Member Function Documentation

◆ begin() [1/2]

template<class ImplementationType >
FileElementIterator< typename GenericFileElement< ImplementationType >::implementationType > Media::GenericFileElement< ImplementationType >::begin ( )

Returns an iterator for iterating over the element's childs.

Definition at line 620 of file genericfileelement.h.

◆ begin() [2/2]

template<class ImplementationType >
const FileElementIterator< typename GenericFileElement< ImplementationType >::implementationType > Media::GenericFileElement< ImplementationType >::begin ( ) const

Returns an iterator for iterating over the element's childs (constant).

Definition at line 629 of file genericfileelement.h.

◆ buffer()

template<class ImplementationType >
const std::unique_ptr< char[]> & Media::GenericFileElement< ImplementationType >::buffer ( )
inline

Returns buffered data.

The returned array is totalSize() bytes long.

Remarks
Data must have been buffered using the makeBuffer() method.

Definition at line 872 of file genericfileelement.h.

◆ childById()

template<class ImplementationType>
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::childById ( const identifierType id)

Returns the first child with the specified id.

The current element keeps ownership over the returned element. If no element could be found nullptr is returned.

Exceptions
Throwsa parsing exception when a parsing error occurs.
Throwsstd::ios_base::failure when an IO error occurs.

Definition at line 577 of file genericfileelement.h.

◆ clear()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::clear ( )

Clears the status of the element.

Resets id length, data size, size length to zero. Subsequent elements will be deleted.

Definition at line 695 of file genericfileelement.h.

◆ container() [1/2]

template<class ImplementationType >
GenericFileElement< ImplementationType >::containerType & Media::GenericFileElement< ImplementationType >::container ( )
inline

Returns the related container.

Definition at line 278 of file genericfileelement.h.

◆ container() [2/2]

template<class ImplementationType >
const GenericFileElement< ImplementationType >::containerType & Media::GenericFileElement< ImplementationType >::container ( ) const
inline

Returns the related container.

Definition at line 287 of file genericfileelement.h.

◆ copyBuffer()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::copyBuffer ( std::ostream &  targetStream)
inline

Copies buffered data to targetStream.

Remarks
Data must have been buffered using the makeBuffer() method.

Definition at line 852 of file genericfileelement.h.

◆ copyEntirely()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::copyEntirely ( std::ostream &  targetStream)

Writes the entire element including all childs to the specified targetStream.

Definition at line 821 of file genericfileelement.h.

◆ copyHeader()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::copyHeader ( std::ostream &  targetStream)

Writes the header informaton of the element to the specified targetStream.

Definition at line 799 of file genericfileelement.h.

◆ copyPreferablyFromBuffer()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::copyPreferablyFromBuffer ( std::ostream &  targetStream)
inline

Copies buffered data to targetStream if data has been buffered; copies from input stream otherwise.

Remarks
So this is copyBuffer() with a fallback to copyEntirely().

Definition at line 862 of file genericfileelement.h.

◆ copyWithoutChilds()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::copyWithoutChilds ( std::ostream &  targetStream)

Writes the element without its childs to the specified targetStream.

Definition at line 808 of file genericfileelement.h.

◆ dataOffset()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::dataOffset ( ) const
inline

Returns the data offset of the element in the related stream.

This is the sum of start offset and header size.

Definition at line 401 of file genericfileelement.h.

◆ dataSize()

template<class ImplementationType >
GenericFileElement< ImplementationType >::dataSizeType Media::GenericFileElement< ImplementationType >::dataSize ( ) const
inline

Returns the data size of the element in byte.

This is the size of the element excluding the header.

Definition at line 381 of file genericfileelement.h.

◆ denoteFirstChild()

template<class ImplementationType >
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::denoteFirstChild ( uint32  relativeFirstChildOffset)

Denotes the first child to start at the specified offset (relative to the start offset of this descriptor).

Remarks
A new first child is constructed. A possibly existing subtree is invalidated.

Definition at line 908 of file genericfileelement.h.

◆ discardBuffer()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::discardBuffer ( )
inline

Discards buffered data.

Definition at line 842 of file genericfileelement.h.

◆ end() [1/2]

template<class ImplementationType >
FileElementIterator< typename GenericFileElement< ImplementationType >::implementationType > Media::GenericFileElement< ImplementationType >::end ( )

Returns an invalid iterator.

Definition at line 638 of file genericfileelement.h.

◆ end() [2/2]

template<class ImplementationType >
const FileElementIterator< typename GenericFileElement< ImplementationType >::implementationType > Media::GenericFileElement< ImplementationType >::end ( ) const

Returns an invalid iterator.

Definition at line 647 of file genericfileelement.h.

◆ endOffset()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::endOffset ( ) const
inline

Returns the offset of the first byte which doesn't belong to this element anymore.

Definition at line 421 of file genericfileelement.h.

◆ firstChild() [1/2]

template<class ImplementationType >
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::firstChild ( )
inline

Returns the first child of the element.

The current element keeps ownership over the returned element. If no childs are present nullptr is returned.

Remarks
parse() needs to be called before.

Definition at line 499 of file genericfileelement.h.

◆ firstChild() [2/2]

template<class ImplementationType >
const GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::firstChild ( ) const
inline

Returns the first child of the element.

The current element keeps ownership over the returned element. If no childs are present nullptr is returned.

Remarks
parse() needs to be called before.

Definition at line 513 of file genericfileelement.h.

◆ firstChildOffset()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::firstChildOffset ( ) const
inline

Returns the offset of the first child (relative to the start offset of this element).

Definition at line 674 of file genericfileelement.h.

◆ headerSize()

template<class ImplementationType >
uint32 Media::GenericFileElement< ImplementationType >::headerSize ( ) const
inline

Returns the header size of the element in byte.

This is the sum of the id length and the size length.

Definition at line 370 of file genericfileelement.h.

◆ id()

template<class ImplementationType >
const GenericFileElement< ImplementationType >::identifierType & Media::GenericFileElement< ImplementationType >::id ( ) const
inline

Returns the element ID.

Definition at line 341 of file genericfileelement.h.

◆ idLength()

template<class ImplementationType >
uint32 Media::GenericFileElement< ImplementationType >::idLength ( ) const
inline

Returns the length of the id denotation in byte.

Definition at line 359 of file genericfileelement.h.

◆ idToString()

template<class ImplementationType >
std::string Media::GenericFileElement< ImplementationType >::idToString ( ) const
inline

Returns a printable string representation of the element ID.

Definition at line 350 of file genericfileelement.h.

◆ isPadding()

template<class ImplementationType >
bool Media::GenericFileElement< ImplementationType >::isPadding ( ) const
inline

Returns an indication whether this instance is a padding element.

Definition at line 665 of file genericfileelement.h.

◆ isParent()

template<class ImplementationType >
bool Media::GenericFileElement< ImplementationType >::isParent ( ) const
inline

Returns an indication whether this instance is a parent element.

Definition at line 656 of file genericfileelement.h.

◆ isParsed()

template<class ImplementationType >
bool Media::GenericFileElement< ImplementationType >::isParsed ( ) const
inline

Returns an indication whether this instance has been parsed yet.

Definition at line 683 of file genericfileelement.h.

◆ makeBuffer()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::makeBuffer ( )

Buffers the element (header and data).

Remarks
The element must have been parsed.

Definition at line 831 of file genericfileelement.h.

◆ maximumIdLengthSupported()

template<class ImplementationType >
constexpr uint32 Media::GenericFileElement< ImplementationType >::maximumIdLengthSupported ( )
static

Returns the maximum id length supported by the class in byte.

Definition at line 922 of file genericfileelement.h.

◆ maximumSizeLengthSupported()

template<class ImplementationType >
constexpr uint32 Media::GenericFileElement< ImplementationType >::maximumSizeLengthSupported ( )
static

Returns the maximum size length supported by the class in byte.

Definition at line 931 of file genericfileelement.h.

◆ maxTotalSize()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::maxTotalSize ( ) const
inline

Returns maximum total size.

This is usually the size of the file for top-level elements and the remaining size of the parent for non-top-level elements.

Definition at line 433 of file genericfileelement.h.

◆ minimumElementSize()

template<class ImplementationType >
constexpr byte Media::GenericFileElement< ImplementationType >::minimumElementSize ( )
static

Returns the mimimum element size.

Definition at line 940 of file genericfileelement.h.

◆ nextSibling() [1/2]

template<class ImplementationType >
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::nextSibling ( )
inline

Returns the next sibling of the element.

The current element keeps ownership over the returned element. If no next sibling is present nullptr is returned.

Remarks
parse() needs to be called before.

Definition at line 471 of file genericfileelement.h.

◆ nextSibling() [2/2]

template<class ImplementationType >
const GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::nextSibling ( ) const
inline

Returns the next sibling of the element.

The current element keeps ownership over the returned element. If no next sibling is present nullptr is returned.

Remarks
parse() needs to be called before.

Definition at line 485 of file genericfileelement.h.

◆ operator=()

template<class ImplementationType>
GenericFileElement& Media::GenericFileElement< ImplementationType >::operator= ( const GenericFileElement< ImplementationType > &  other)
delete

◆ parent() [1/2]

template<class ImplementationType >
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::parent ( )
inline

Returns the parent of the element.

The returned element has ownership over the current instance. If the current element is a top level element nullptr is returned.

Definition at line 445 of file genericfileelement.h.

◆ parent() [2/2]

template<class ImplementationType >
const GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::parent ( ) const
inline

Returns the parent of the element.

The returned element has ownership over the current instance. If the current element is a top level element nullptr is returned.

Definition at line 457 of file genericfileelement.h.

◆ parse()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::parse ( )

Parses the header information of the element which is read from the related stream at the start offset.

The parsed information can accessed using the corresponding methods such as id() for the elemement id and totalSize() for the element size.

If the element has already been parsed (isParsed() returns true) this method does nothing. To force reparsing call reparse().

Exceptions
Throwsstd::ios_base::failure when an IO error occurs.
ThrowsMedia::Failure or a derived exception when a parsing error occurs.

Definition at line 722 of file genericfileelement.h.

◆ reader()

template<class ImplementationType >
IoUtilities::BinaryReader & Media::GenericFileElement< ImplementationType >::reader ( )
inline

Returns the related BinaryReader.

Definition at line 305 of file genericfileelement.h.

◆ relativeStartOffset()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::relativeStartOffset ( ) const
inline

Returns the offset of the element in its parent or - if it is a top-level element - in the related stream.

Definition at line 332 of file genericfileelement.h.

◆ reparse()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::reparse ( )

Parses the header information of the element which is read from the related stream at the start offset.

The parsed information can accessed using the corresponding methods such as id() for the elemement id and totalSize() for the element size.

If the element has already been parsed (isParsed() returns true) this method clears the parsed information and reparses the header.

Exceptions
Throwsstd::ios_base::failure when an IO error occurs.
ThrowsMedia::Failure or a derived exception when a parsing error occurs.
See also
parse()

Definition at line 747 of file genericfileelement.h.

◆ siblingById()

template<class ImplementationType>
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::siblingById ( const identifierType id,
bool  includeThis = false 
)

Returns the first sibling with the specified id.

Parameters
idSpecifies the id of the sibling to be returned.
includeThisIndicates whether this instance should be returned if it has the specified id.

The current element keeps ownership over the returned element. If no element could be found nullptr is returned. Possibly returns a pointer to the current instance (see includeThis).

Exceptions
Throwsa parsing exception when a parsing error occurs.
Throwsstd::ios_base::failure when an IO error occurs.

Definition at line 604 of file genericfileelement.h.

◆ sizeLength()

template<class ImplementationType >
uint32 Media::GenericFileElement< ImplementationType >::sizeLength ( ) const
inline

Returns the length of the size denotation of the element in byte.

Definition at line 390 of file genericfileelement.h.

◆ startOffset()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::startOffset ( ) const
inline

Returns the start offset in the related stream.

Definition at line 323 of file genericfileelement.h.

◆ stream()

template<class ImplementationType >
std::iostream & Media::GenericFileElement< ImplementationType >::stream ( )
inline

Returns the related stream.

Definition at line 296 of file genericfileelement.h.

◆ subelementByPath() [1/2]

template<class ImplementationType >
GenericFileElement< ImplementationType >::implementationType * Media::GenericFileElement< ImplementationType >::subelementByPath ( const std::initializer_list< identifierType > &  path)
inline

Returns the sub element for the specified path.

The current element keeps ownership over the returned element. If no element could be found nullptr is returned.

Exceptions
Throwsa parsing exception when a parsing error occurs.
Throwsstd::ios_base::failure when an IO error occurs.

Definition at line 528 of file genericfileelement.h.

◆ subelementByPath() [2/2]

template<class ImplementationType>
implementationType* Media::GenericFileElement< ImplementationType >::subelementByPath ( std::list< identifierType > &  path)

◆ totalSize()

template<class ImplementationType >
uint64 Media::GenericFileElement< ImplementationType >::totalSize ( ) const
inline

Returns the total size of the element.

This is the sum of the header size and the data size.

Definition at line 412 of file genericfileelement.h.

◆ validateSubsequentElementStructure()

template<class ImplementationType >
void Media::GenericFileElement< ImplementationType >::validateSubsequentElementStructure ( NotificationList gatheredNotifications,
uint64 *  paddingSize = nullptr 
)

Parses (see parse()) this and all subsequent elements.

All parsing notifications will be stored in gatheredNotifications. If padding is found its size will be set to paddingSize if not nullptr.

Exceptions
Throwsstd::ios_base::failure when an IO error occurs.
ThrowsMedia::Failure or a derived exception when a parsing error occurs.
See also
parse()

Definition at line 767 of file genericfileelement.h.

◆ writer()

template<class ImplementationType >
IoUtilities::BinaryWriter & Media::GenericFileElement< ImplementationType >::writer ( )
inline

Returns the related BinaryWriter.

Definition at line 314 of file genericfileelement.h.

Friends And Related Function Documentation

◆ FileElementTraits< ImplementationType >

template<class ImplementationType>
friend class FileElementTraits< ImplementationType >
friend

Definition at line 117 of file genericfileelement.h.

Member Data Documentation

◆ m_buffer

template<class ImplementationType>
std::unique_ptr<char[]> Media::GenericFileElement< ImplementationType >::m_buffer
protected

Definition at line 209 of file genericfileelement.h.

◆ m_dataSize

template<class ImplementationType>
dataSizeType Media::GenericFileElement< ImplementationType >::m_dataSize
protected

Definition at line 204 of file genericfileelement.h.

◆ m_firstChild

template<class ImplementationType>
std::unique_ptr<implementationType> Media::GenericFileElement< ImplementationType >::m_firstChild
protected

Definition at line 208 of file genericfileelement.h.

◆ m_id

template<class ImplementationType>
identifierType Media::GenericFileElement< ImplementationType >::m_id
protected

Definition at line 200 of file genericfileelement.h.

◆ m_idLength

template<class ImplementationType>
uint32 Media::GenericFileElement< ImplementationType >::m_idLength
protected

Definition at line 203 of file genericfileelement.h.

◆ m_maxSize

template<class ImplementationType>
uint64 Media::GenericFileElement< ImplementationType >::m_maxSize
protected

Definition at line 202 of file genericfileelement.h.

◆ m_nextSibling

template<class ImplementationType>
std::unique_ptr<implementationType> Media::GenericFileElement< ImplementationType >::m_nextSibling
protected

Definition at line 207 of file genericfileelement.h.

◆ m_parent

template<class ImplementationType>
implementationType* Media::GenericFileElement< ImplementationType >::m_parent
protected

Definition at line 206 of file genericfileelement.h.

◆ m_sizeLength

template<class ImplementationType>
uint32 Media::GenericFileElement< ImplementationType >::m_sizeLength
protected

Definition at line 205 of file genericfileelement.h.

◆ m_startOffset

template<class ImplementationType>
uint64 Media::GenericFileElement< ImplementationType >::m_startOffset
protected

Definition at line 201 of file genericfileelement.h.


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