kwave  18.07.70
Kwave::ID3_QIODeviceReader Class Reference

#include <ID3_QIODeviceReader.h>

Inheritance diagram for Kwave::ID3_QIODeviceReader:
Inheritance graph
Collaboration diagram for Kwave::ID3_QIODeviceReader:
Collaboration graph

Public Member Functions

 ID3_QIODeviceReader (QIODevice &source)
 
virtual ~ID3_QIODeviceReader ()
 
virtual void close ()
 
virtual ID3_Reader::pos_type getBeg ()
 
virtual ID3_Reader::pos_type getEnd ()
 
virtual ID3_Reader::pos_type getCur ()
 
virtual ID3_Reader::pos_type setCur (ID3_Reader::pos_type pos=0)
 
virtual ID3_Reader::int_type readChar ()
 
virtual ID3_Reader::int_type peekChar ()
 
virtual size_type readChars (char_type buf[], size_type len)
 
virtual size_type readChars (char buf[], size_type len)
 

Private Attributes

QIODevice & m_source
 

Detailed Description

Adapter between QIODevice and ID3_Reader

Definition at line 34 of file ID3_QIODeviceReader.h.

Constructor & Destructor Documentation

◆ ID3_QIODeviceReader()

Kwave::ID3_QIODeviceReader::ID3_QIODeviceReader ( QIODevice &  source)
explicit

Constructor

Definition at line 25 of file ID3_QIODeviceReader.cpp.

26  :ID3_Reader(), m_source(source)
27 {
28 }

◆ ~ID3_QIODeviceReader()

Kwave::ID3_QIODeviceReader::~ID3_QIODeviceReader ( )
virtual

Destructor

Definition at line 31 of file ID3_QIODeviceReader.cpp.

32 {
33 }

Member Function Documentation

◆ close()

void Kwave::ID3_QIODeviceReader::close ( )
virtual

Close the source. Not implemented.

Definition at line 36 of file ID3_QIODeviceReader.cpp.

37 {
38 }

◆ getBeg()

ID3_Reader::pos_type Kwave::ID3_QIODeviceReader::getBeg ( )
virtual

Get the start position, always zero

Definition at line 41 of file ID3_QIODeviceReader.cpp.

42 {
43  return 0;
44 }

◆ getCur()

ID3_Reader::pos_type Kwave::ID3_QIODeviceReader::getCur ( )
virtual

Returns the current position

Definition at line 53 of file ID3_QIODeviceReader.cpp.

References m_source.

54 {
55  return static_cast<ID3_Reader::pos_type>(m_source.pos());
56 }

◆ getEnd()

ID3_Reader::pos_type Kwave::ID3_QIODeviceReader::getEnd ( )
virtual

Get the end position, identical to size()-1

Definition at line 47 of file ID3_QIODeviceReader.cpp.

References m_source.

48 {
49  return static_cast<ID3_Reader::pos_type>(m_source.size());
50 }

◆ peekChar()

ID3_Reader::int_type Kwave::ID3_QIODeviceReader::peekChar ( )
virtual

Reads one character without advancing the current position

Definition at line 75 of file ID3_QIODeviceReader.cpp.

References m_source, and readChar().

76 {
77  qint64 pos = m_source.pos();
78  ID3_Reader::int_type ch = readChar();
79  m_source.seek(pos);
80  return ch;
81 }
virtual ID3_Reader::int_type readChar()
Here is the call graph for this function:

◆ readChar()

ID3_Reader::int_type Kwave::ID3_QIODeviceReader::readChar ( )
virtual

Reads out one single character

Definition at line 67 of file ID3_QIODeviceReader.cpp.

References m_source.

Referenced by peekChar().

68 {
69  unsigned char c = 0;
70  m_source.getChar(reinterpret_cast<char *>(&c));
71  return static_cast<ID3_Reader::int_type>(c);
72 }
Here is the caller graph for this function:

◆ readChars() [1/2]

ID3_Reader::size_type Kwave::ID3_QIODeviceReader::readChars ( char_type  buf[],
size_type  len 
)
virtual

Read out a block of characters

Definition at line 84 of file ID3_QIODeviceReader.cpp.

References m_source.

Referenced by readChars().

86 {
87  qint64 size = m_source.read(
88  reinterpret_cast<char *>(&(buf[0])),
89  static_cast<qint64>(len)
90  );
91  return static_cast<ID3_Reader::size_type>(size);
92 }
Here is the caller graph for this function:

◆ readChars() [2/2]

ID3_Reader::size_type Kwave::ID3_QIODeviceReader::readChars ( char  buf[],
size_type  len 
)
virtual

Definition at line 95 of file ID3_QIODeviceReader.cpp.

References readChars().

97 {
98  return this->readChars(reinterpret_cast<char_type *>(buf), len);
99 }
virtual size_type readChars(char_type buf[], size_type len)
Here is the call graph for this function:

◆ setCur()

ID3_Reader::pos_type Kwave::ID3_QIODeviceReader::setCur ( ID3_Reader::pos_type  pos = 0)
virtual

Sets a new position and returns the new one

Definition at line 59 of file ID3_QIODeviceReader.cpp.

References m_source.

60 {
61  if (!m_source.seek(static_cast<qint64>(pos)))
62  return static_cast<ID3_Reader::pos_type>(-1);
63  return static_cast<ID3_Reader::pos_type>(m_source.pos());
64 }

Member Data Documentation

◆ m_source

QIODevice& Kwave::ID3_QIODeviceReader::m_source
private

reference to a QIODevice that is used as source

Definition at line 72 of file ID3_QIODeviceReader.h.

Referenced by getCur(), getEnd(), peekChar(), readChar(), readChars(), and setCur().


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