kwave  18.07.70
ID3_QIODeviceWriter.cpp
Go to the documentation of this file.
1 /*************************************************************************
2  ID3_QIODeviceWriter.cpp - Adapter between QIODevice and ID3_Writer
3  -------------------
4  begin : Mon May 28 2012
5  copyright : (C) 2012 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 #include "config.h"
19 
20 #include <QIODevice>
21 
22 #include "ID3_QIODeviceWriter.h"
23 
24 //***************************************************************************
26  :ID3_Writer(), m_dest(dest), m_written(0)
27 {
28 }
29 
30 //***************************************************************************
32 {
33 }
34 
35 //***************************************************************************
37 {
38 }
39 
40 //***************************************************************************
42 {
43 }
44 
45 //***************************************************************************
46 ID3_Writer::pos_type Kwave::ID3_QIODeviceWriter::getBeg()
47 {
48  return 0;
49 }
50 
51 //***************************************************************************
52 ID3_Writer::pos_type Kwave::ID3_QIODeviceWriter::getEnd()
53 {
54  return getMaxSize();
55 }
56 
57 //***************************************************************************
58 ID3_Writer::pos_type Kwave::ID3_QIODeviceWriter::getCur()
59 {
60  return m_written;
61 }
62 
63 //***************************************************************************
64 ID3_Writer::size_type Kwave::ID3_QIODeviceWriter::getSize()
65 {
66  return m_written;
67 }
68 
69 //***************************************************************************
71 {
72  return (1U << ((sizeof(ID3_Writer::size_type) * 8) - 1));
73 }
74 
75 //***************************************************************************
77  const ID3_Writer::char_type buf[], ID3_Writer::size_type len)
78 {
79  return this->writeChars(reinterpret_cast<const char *>(buf), len);
80 }
81 
82 //***************************************************************************
84  const char buf[], ID3_Writer::size_type len)
85 {
86  ID3_Writer::size_type bytes = static_cast<ID3_Writer::size_type>(
87  m_dest.write(&(buf[0]), static_cast<qint64>(len)));
88  if (bytes > 0)
89  m_written += bytes;
90  return bytes;
91 }
92 
93 //***************************************************************************
95 {
96  return false;
97 }
98 
99 //***************************************************************************
100 //***************************************************************************
ID3_Writer::size_type m_written
virtual ID3_Writer::size_type getMaxSize()
virtual ID3_Writer::size_type getSize()
virtual ID3_Writer::size_type writeChars(const ID3_Writer::char_type buf[], ID3_Writer::size_type len)
virtual ID3_Writer::pos_type getCur()
virtual ID3_Writer::pos_type getEnd()
virtual ID3_Writer::pos_type getBeg()