00001 #ifndef __BYTEARRAYUTILS_H__
00002 #define __BYTEARRAYUTILS_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 class QByteArray;
00029 #include <QString>
00030 #include <QDate>
00031 #include <QDateTime>
00032
00033 class ByteArrayUtils
00034 {
00035 public:
00036 static QString readString(const QByteArray& data, int index=0, int* pNbRead=NULL);
00037 static QDate readDate(const QByteArray& data, int index=0, int* pNbRead=NULL);
00038 static QDateTime readDateTime(const QByteArray& data, int index=0, int* pNbRead=NULL);
00039 static QByteArray readData(const QByteArray& data, int index=0, int* pNbRead=NULL);
00040
00041 static int readNumber(const QByteArray& data, int index=0, int* pNbRead=NULL);
00042
00043 static void writeString(QByteArray& data, const QString& stringData);
00044 static void writeDate(QByteArray& data, const QDate& dateData);
00045 static void writeDateTime(QByteArray& data, const QDateTime& dateTimeData);
00046 static void writeData(QByteArray& data, const QByteArray& dataData);
00047
00048 template <typename T>
00049 static void writeNumber(QByteArray& data, const T numberData)
00050 {
00051 ByteArrayUtils::writeString(data,QString::number(numberData));
00052 }
00053
00054 };
00055
00130 #endif