TagLib 1.7.2 (tfile.h Source File)
Home
Class Hierarchy
Namespaces
Classes
Headers
Namespace Members
Class Members
File Members
taglib
toolkit
tfile.h
Go to the documentation of this file.
1
/***************************************************************************
2
copyright : (C) 2002 - 2008 by Scott Wheeler
3
email : wheeler@kde.org
4
***************************************************************************/
5
6
/***************************************************************************
7
* This library is free software; you can redistribute it and/or modify *
8
* it under the terms of the GNU Lesser General Public License version *
9
* 2.1 as published by the Free Software Foundation. *
10
* *
11
* This library is distributed in the hope that it will be useful, but *
12
* WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14
* Lesser General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU Lesser General Public *
17
* License along with this library; if not, write to the Free Software *
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19
* 02110-1301 USA *
20
* *
21
* Alternatively, this file is available under the Mozilla Public *
22
* License Version 1.1. You may obtain a copy of the License at *
23
* http://www.mozilla.org/MPL/ *
24
***************************************************************************/
25
26
#ifndef TAGLIB_FILE_H
27
#define TAGLIB_FILE_H
28
29
#include "
taglib_export.h
"
30
#include "
taglib.h
"
31
#include "
tbytevector.h
"
32
33
namespace
TagLib {
34
35
class
String;
36
class
Tag;
37
class
AudioProperties
;
38
39
#ifdef _WIN32
40
class
TAGLIB_EXPORT
FileName
41
{
42
public
:
43
FileName
(
const
wchar_t
*name) : m_wname(name) {}
44
FileName
(
const
char
*name) : m_name(name) {}
45
operator
const
wchar_t
*()
const
{
return
m_wname.c_str(); }
46
operator
const
char
*()
const
{
return
m_name.c_str(); }
47
private
:
48
std::string m_name;
49
std::wstring
m_wname;
50
};
51
#else
52
typedef
const
char
*
FileName
;
53
#endif
54
56
63
class
TAGLIB_EXPORT
File
64
{
65
public
:
69
enum
Position
{
71
Beginning
,
73
Current
,
75
End
76
};
77
81
virtual
~
File
();
82
86
FileName
name()
const
;
87
92
virtual
Tag
*tag()
const
= 0;
93
99
virtual
AudioProperties
*audioProperties()
const
= 0;
100
111
virtual
bool
save() = 0;
112
116
ByteVector
readBlock(
ulong
length);
117
127
void
writeBlock(
const
ByteVector
&data);
128
141
long
find(
const
ByteVector
&pattern,
142
long
fromOffset = 0,
143
const
ByteVector
&before =
ByteVector::null
);
144
157
long
rfind(
const
ByteVector
&pattern,
158
long
fromOffset = 0,
159
const
ByteVector
&before =
ByteVector::null
);
160
168
void
insert(
const
ByteVector
&data,
ulong
start = 0,
ulong
replace = 0);
169
177
void
removeBlock(
ulong
start = 0,
ulong
length = 0);
178
182
bool
readOnly()
const
;
183
188
bool
isOpen()
const
;
189
193
bool
isValid()
const
;
194
201
void
seek(
long
offset, Position p = Beginning);
202
206
void
clear();
207
211
long
tell()
const
;
212
216
long
length();
217
224
static
bool
isReadable(
const
char
*file);
225
231
static
bool
isWritable(
const
char
*name);
232
233
protected
:
241
File
(
FileName
file);
242
248
void
setValid(
bool
valid);
249
253
void
truncate(
long
length);
254
258
static
uint
bufferSize();
259
260
private
:
261
File
(
const
File
&);
262
File
&operator=(
const
File
&);
263
264
class
FilePrivate;
265
FilePrivate *d;
266
};
267
268
}
269
270
#endif