TagLib 1.8.0 (tstring.h Source File)
Home
Class Hierarchy
Namespaces
Classes
Headers
Namespace Members
Class Members
File Members
taglib
toolkit
tstring.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_STRING_H
27
#define TAGLIB_STRING_H
28
29
#include "
taglib_export.h
"
30
#include "
taglib.h
"
31
#include "
tbytevector.h
"
32
33
#include <string>
34
#include <iostream>
35
44
#define QStringToTString(s) TagLib::String(s.utf8().data(), TagLib::String::UTF8)
45
55
#define TStringToQString(s) QString::fromUtf8(s.toCString(true))
56
57
namespace
TagLib {
58
59
class
StringList
;
60
62
78
class
TAGLIB_EXPORT
String
79
{
80
public
:
81
82
#ifndef DO_NOT_DOCUMENT
83
typedef
std::basic_string<wchar>::iterator Iterator;
84
typedef
std::basic_string<wchar>::const_iterator ConstIterator;
85
#endif
86
91
enum
Type
{
95
Latin1 = 0,
99
UTF16 = 1,
104
UTF16BE = 2,
108
UTF8 = 3,
112
UTF16LE = 4
113
};
114
118
String
();
119
125
String
(
const
String
&s);
126
133
String
(
const
std::string &s, Type t = Latin1);
134
138
String
(
const
wstring
&s, Type t = UTF16BE);
139
143
String
(
const
wchar_t
*s, Type t = UTF16BE);
144
151
String
(
char
c, Type t = Latin1);
152
156
String
(
wchar_t
c, Type t = Latin1);
157
158
165
String
(
const
char
*s, Type t = Latin1);
166
173
String
(
const
ByteVector
&v, Type t = Latin1);
174
178
virtual
~
String
();
179
185
std::string to8Bit(
bool
unicode =
false
)
const
;
186
190
wstring
toWString()
const
;
191
207
const
char
*toCString(
bool
unicode =
false
)
const
;
208
212
Iterator begin();
213
217
ConstIterator begin()
const
;
218
223
Iterator end();
224
229
ConstIterator end()
const
;
230
235
int
find(
const
String
&s,
int
offset = 0)
const
;
236
242
int
rfind(
const
String
&s,
int
offset = -1)
const
;
243
247
StringList
split(
const
String
&separator =
" "
)
const
;
248
252
bool
startsWith(
const
String
&s)
const
;
253
258
String
substr(
uint
position,
uint
n = 0xffffffff)
const
;
259
264
String
&append(
const
String
&s);
265
271
String
upper()
const
;
272
276
uint
size()
const
;
277
281
uint
length()
const
;
282
288
bool
isEmpty()
const
;
289
297
bool
isNull()
const
;
298
304
ByteVector
data(Type t)
const
;
305
312
// BIC: merge with the method below
313
int
toInt()
const
;
314
322
int
toInt(
bool
*ok)
const
;
323
327
String
stripWhiteSpace()
const
;
328
332
bool
isLatin1()
const
;
333
337
bool
isAscii()
const
;
338
342
static
String
number(
int
n);
343
347
wchar
&operator[](
int
i);
348
352
const
wchar
&operator[](
int
i)
const
;
353
358
bool
operator==(
const
String
&s)
const
;
359
364
bool
operator!=(
const
String
&s)
const
;
365
369
String
&operator+=(
const
String
&s);
370
374
String
&operator+=(
const
wchar_t
* s);
375
379
String
&operator+=(
const
char
* s);
380
384
String
&operator+=(
wchar_t
c);
385
389
String
&operator+=(
char
c);
390
395
String
&operator=(
const
String
&s);
396
400
String
&operator=(
const
std::string &s);
401
405
String
&operator=(
const
wstring
&s);
406
410
String
&operator=(
const
wchar_t
*s);
411
415
String
&operator=(
char
c);
416
420
String
&operator=(
wchar_t
c);
421
425
String
&operator=(
const
char
*s);
426
430
String
&operator=(
const
ByteVector
&v);
431
437
bool
operator<(
const
String
&s)
const
;
438
442
static
String
null
;
443
444
protected
:
450
void
detach();
451
452
private
:
459
void
prepare(
Type
t);
460
461
class
StringPrivate;
462
StringPrivate *d;
463
};
464
465
}
466
472
TAGLIB_EXPORT
const
TagLib::String
operator+
(
const
TagLib::String
&s1,
const
TagLib::String
&s2);
473
479
TAGLIB_EXPORT
const
TagLib::String
operator+
(
const
char
*s1,
const
TagLib::String
&s2);
480
486
TAGLIB_EXPORT
const
TagLib::String
operator+
(
const
TagLib::String
&s1,
const
char
*s2);
487
488
494
TAGLIB_EXPORT
std::ostream &
operator<<
(std::ostream &s,
const
TagLib::String
&str);
495
496
#endif