1 /*************************************************************************
2     ID3_QIODeviceReader.h  -  Adapter between QIODevice and ID3_Reader
3                              -------------------
4     begin                : Wed Aug 14 2002
5     copyright            : (C) 2002 by Thomas Eschenbacher
6     email                : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef ID3_QIODEVICE_READER_H
19 #define ID3_QIODEVICE_READER_H
20 
21 #include "config.h"
22 
23 #include <id3/globals.h>
24 #include <id3/reader.h>
25 
26 class QIODevice;
27 
28 namespace Kwave
29 {
30     /**
31      * @class ID3_QIODeviceReader
32      * Adapter between QIODevice and ID3_Reader
33      */
34     class ID3_QIODeviceReader: public ID3_Reader
35     {
36     public:
37 
38 	/** Constructor */
39 	explicit ID3_QIODeviceReader(QIODevice &source);
40 
41 	/** Destructor */
42 	virtual ~ID3_QIODeviceReader();
43 
44 	/** Close the source. Not implemented. */
45 	virtual void close() Q_DECL_OVERRIDE;
46 
47 	/** Get the start position, always zero */
48 	virtual ID3_Reader::pos_type getBeg() Q_DECL_OVERRIDE;
49 
50 	/** Get the end position, identical to size()-1 */
51 	virtual ID3_Reader::pos_type getEnd() Q_DECL_OVERRIDE;
52 
53 	/** Returns the current position */
54 	virtual ID3_Reader::pos_type getCur() Q_DECL_OVERRIDE;
55 
56 	/** Sets a new position and returns the new one */
57 	virtual ID3_Reader::pos_type setCur(ID3_Reader::pos_type pos = 0)
58 	    Q_DECL_OVERRIDE;
59 
60 	/** Reads out one single character */
61 	virtual ID3_Reader::int_type readChar() Q_DECL_OVERRIDE;
62 
63 	/** Reads one character without advancing the current position */
64 	virtual ID3_Reader::int_type peekChar() Q_DECL_OVERRIDE;
65 
66 	/** Read out a block of characters */
67 	virtual size_type readChars(char_type buf[], size_type len)
68 	    Q_DECL_OVERRIDE;
69 	virtual size_type readChars(char buf[], size_type len)
70 	    Q_DECL_OVERRIDE;
71 
72     private:
73 
74 	/** reference to a QIODevice that is used as source */
75 	QIODevice &m_source;
76     };
77 }
78 
79 #endif /* ID3_QIODEVICE_READER_H */
80 
81 //***************************************************************************
82 //***************************************************************************
83