00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef TAGLIB_BYTEVECTOR_H
00023
#define TAGLIB_BYTEVECTOR_H
00024
00025
#include "taglib.h"
00026
00027
#include <vector>
00028
00029
namespace TagLib {
00030
00032
00039 class ByteVector
00040 {
00041
public:
00042
#ifndef DO_NOT_DOCUMENT
00043
typedef std::vector<char>::iterator Iterator;
00044
typedef std::vector<char>::const_iterator ConstIterator;
00045
#endif
00046
00050
ByteVector();
00051
00056
ByteVector(
uint size,
char value = 0);
00057
00061
ByteVector(
const ByteVector &v);
00062
00066
ByteVector(
char c);
00067
00071
ByteVector(
const char *
data,
uint length);
00072
00079
ByteVector(
const char *data);
00080
00084
virtual ~ByteVector();
00085
00089
void setData(
const char *data,
uint length);
00090
00095
void setData(
const char *data);
00096
00104
char *
data();
00105
00109
const char *
data()
const;
00110
00116
ByteVector mid(
uint index,
uint length = 0xffffffff)
const;
00117
00122
char at(
uint index)
const;
00123
00130
int find(
const ByteVector &pattern,
uint offset = 0,
int byteAlign = 1)
const;
00131
00138
int rfind(
const ByteVector &pattern,
uint offset = 0,
int byteAlign = 1)
const;
00139
00147
bool containsAt(
const ByteVector &pattern,
uint offset,
uint patternOffset = 0,
uint patternLength = 0xffffffff)
const;
00148
00152
bool startsWith(
const ByteVector &pattern)
const;
00153
00157
bool endsWith(
const ByteVector &pattern)
const;
00158
00169
int endsWithPartialMatch(
const ByteVector &pattern)
const;
00170
00174
void append(
const ByteVector &v);
00175
00179
void clear();
00180
00184
uint size()
const;
00185
00191
ByteVector &
resize(
uint size,
char padding = 0);
00192
00196 Iterator
begin();
00197
00201 ConstIterator
begin()
const;
00202
00206 Iterator
end();
00207
00211 ConstIterator
end()
const;
00212
00219
bool isNull()
const;
00220
00227
bool isEmpty()
const;
00228
00232
uint checksum()
const;
00233
00244
uint toUInt(
bool mostSignificantByteFirst =
true)
const;
00245
00246
00257
long long toLongLong(
bool mostSignificantByteFirst =
true)
const;
00258
00268
static ByteVector fromUInt(
uint value,
bool mostSignificantByteFirst =
true);
00269
00279
static ByteVector fromLongLong(
long long value,
bool mostSignificantByteFirst =
true);
00280
00284
static ByteVector fromCString(
const char *s,
uint length = 0xffffffff);
00285
00289
const char &
operator[](
int index)
const;
00290
00294
char &
operator[](
int index);
00295
00299
bool operator==(
const ByteVector &v)
const;
00300
00304
bool operator!=(
const ByteVector &v)
const;
00305
00310
bool operator==(
const char *s)
const;
00311
00316
bool operator!=(
const char *s)
const;
00317
00323
bool operator<(
const ByteVector &v)
const;
00324
00328
bool operator>(
const ByteVector &v)
const;
00329
00333
ByteVector operator+(
const ByteVector &v)
const;
00334
00338
ByteVector &
operator=(
const ByteVector &v);
00339
00343
ByteVector &
operator=(
char c);
00344
00348
ByteVector &
operator=(
const char *data);
00349
00354 static ByteVector null;
00355
00356
protected:
00357
00358
00359
00360
00361
00362
void detach();
00363
00364
private:
00365
class ByteVectorPrivate;
00366 ByteVectorPrivate *d;
00367 };
00368
00369 }
00370
00375 std::ostream &operator<<(std::ostream &s,
const TagLib::ByteVector &v);
00376
00377
#endif