Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
TagParser::StreamDataBlock Class Reference

The StreamDataBlock class is a reference to a certain data block of a stream. More...

#include <abstractattachment.h>

Inheritance diagram for TagParser::StreamDataBlock:
[legend]
Collaboration diagram for TagParser::StreamDataBlock:
[legend]

Public Member Functions

 StreamDataBlock (const std::function< std::istream &()> &stream, uint64_t startOffset=0, std::ios_base::seekdir startDir=std::ios_base::beg, uint64_t endOffset=0, std::ios_base::seekdir endDir=std::ios_base::end)
 
virtual ~StreamDataBlock ()
 Discards buffered data.
 
std::istream & stream () const
 Returns the associated stream.
 
std::uint64_t startOffset () const
 Returns the absolute start offset of the data block in the stream.
 
std::uint64_t endOffset () const
 Returns the absolute end offset of the data block in the stream.
 
std::uint64_t size () const
 Returns the size of the data block.
 
const std::unique_ptr< char[]> & buffer () const
 Returns the data buffered via makeBuffer().
 
void makeBuffer () const
 Buffers the data block.
 
void discardBuffer ()
 Discards buffered data.
 
void copyTo (std::ostream &stream) const
 Copies the data to the specified stream.
 

Protected Member Functions

 StreamDataBlock ()
 Constructs a new StreamDataBlock.
 

Protected Attributes

std::function< std::istream &()> m_stream
 
std::uint64_t m_startOffset
 
std::uint64_t m_endOffset
 
std::unique_ptr< char[]> m_buffer
 

Detailed Description

The StreamDataBlock class is a reference to a certain data block of a stream.

Constructor & Destructor Documentation

◆ StreamDataBlock() [1/2]

TagParser::StreamDataBlock::StreamDataBlock ( const std::function< std::istream &()> & stream,
uint64_t startOffset = 0,
std::ios_base::seekdir startDir = std::ios_base::beg,
uint64_t endOffset = 0,
std::ios_base::seekdir endDir = std::ios_base::end )

◆ ~StreamDataBlock()

TagParser::StreamDataBlock::~StreamDataBlock ( )
virtual

Discards buffered data.

Definition at line 66 of file abstractattachment.cpp.

◆ StreamDataBlock() [2/2]

TagParser::StreamDataBlock::StreamDataBlock ( )
protected

Constructs a new StreamDataBlock.

The derived is responsible for the prober initialization of the object.

Definition at line 30 of file abstractattachment.cpp.

Member Function Documentation

◆ buffer()

const std::unique_ptr< char[]> & TagParser::StreamDataBlock::buffer ( ) const
inline

Returns the data buffered via makeBuffer().

Definition at line 77 of file abstractattachment.h.

◆ copyTo()

void TagParser::StreamDataBlock::copyTo ( std::ostream & stream) const

Copies the data to the specified stream.

Remarks
Makes use of the buffer allocated with makeBuffer() if this method has been called before.

Definition at line 84 of file abstractattachment.cpp.

◆ discardBuffer()

void TagParser::StreamDataBlock::discardBuffer ( )
inline

Discards buffered data.

Definition at line 85 of file abstractattachment.h.

◆ endOffset()

std::uint64_t TagParser::StreamDataBlock::endOffset ( ) const
inline

Returns the absolute end offset of the data block in the stream.

Definition at line 61 of file abstractattachment.h.

◆ makeBuffer()

void TagParser::StreamDataBlock::makeBuffer ( ) const

Buffers the data block.

Buffered data can be accessed via buffer().

Definition at line 73 of file abstractattachment.cpp.

◆ size()

std::uint64_t TagParser::StreamDataBlock::size ( ) const
inline

Returns the size of the data block.

Definition at line 69 of file abstractattachment.h.

◆ startOffset()

std::uint64_t TagParser::StreamDataBlock::startOffset ( ) const
inline

Returns the absolute start offset of the data block in the stream.

Definition at line 53 of file abstractattachment.h.

◆ stream()

std::istream & TagParser::StreamDataBlock::stream ( ) const
inline

Returns the associated stream.

Calling this method on invalid objects causes undefined behaviour. See isValid().

Definition at line 45 of file abstractattachment.h.

Member Data Documentation

◆ m_buffer

std::unique_ptr<char[]> TagParser::StreamDataBlock::m_buffer
mutableprotected

Definition at line 37 of file abstractattachment.h.

◆ m_endOffset

std::uint64_t TagParser::StreamDataBlock::m_endOffset
protected

Definition at line 36 of file abstractattachment.h.

◆ m_startOffset

std::uint64_t TagParser::StreamDataBlock::m_startOffset
protected

Definition at line 35 of file abstractattachment.h.

◆ m_stream

std::function<std::istream &()> TagParser::StreamDataBlock::m_stream
protected

Definition at line 34 of file abstractattachment.h.


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