Tag Parser  8.0.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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, std::istream::off_type startOffset=0, std::ios_base::seekdir startDir=std::ios_base::beg, std::istream::off_type endOffset=0, std::ios_base::seekdir endDir=std::ios_base::end)
 
virtual ~StreamDataBlock ()
 Discards buffered data. More...
 
std::istream & stream () const
 Returns the associated stream. More...
 
std::istream::pos_type startOffset () const
 Returns the absolute start offset of the data block in the stream. More...
 
std::istream::pos_type endOffset () const
 Returns the absolute end offset of the data block in the stream. More...
 
std::istream::pos_type size () const
 Returns the size of the data block. More...
 
const std::unique_ptr< char[]> & buffer () const
 Returns the data buffered via makeBuffer(). More...
 
void makeBuffer () const
 Buffers the data block. More...
 
void discardBuffer ()
 Discards buffered data. More...
 
void copyTo (std::ostream &stream) const
 Copies the data to the specified stream. More...
 

Protected Member Functions

 StreamDataBlock ()
 Constructs a new StreamDataBlock. More...
 

Protected Attributes

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

Detailed Description

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

Definition at line 15 of file abstractattachment.h.

Constructor & Destructor Documentation

◆ StreamDataBlock() [1/2]

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

◆ ~StreamDataBlock()

TagParser::StreamDataBlock::~StreamDataBlock ( )
virtual

Discards buffered data.

Definition at line 63 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 27 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 81 of file abstractattachment.cpp.

◆ discardBuffer()

void TagParser::StreamDataBlock::discardBuffer ( )
inline

Discards buffered data.

Definition at line 85 of file abstractattachment.h.

◆ endOffset()

std::istream::pos_type 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 70 of file abstractattachment.cpp.

◆ size()

std::istream::pos_type TagParser::StreamDataBlock::size ( ) const
inline

Returns the size of the data block.

Definition at line 69 of file abstractattachment.h.

◆ startOffset()

std::istream::pos_type 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::istream::pos_type TagParser::StreamDataBlock::m_endOffset
protected

Definition at line 36 of file abstractattachment.h.

◆ m_startOffset

std::istream::pos_type 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: