2013-10-30 11:46:18 +00:00
|
|
|
#ifndef PACKSTREAM_H
|
|
|
|
#define PACKSTREAM_H
|
|
|
|
|
|
|
|
#include "system_global.h"
|
2013-12-10 21:32:58 +00:00
|
|
|
|
2013-10-30 11:46:18 +00:00
|
|
|
class QFile;
|
|
|
|
class QDataStream;
|
|
|
|
|
|
|
|
namespace paysages
|
|
|
|
{
|
|
|
|
namespace system
|
|
|
|
{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Data (de)serialization in files or streams.
|
|
|
|
*/
|
|
|
|
class SYSTEMSHARED_EXPORT PackStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PackStream();
|
|
|
|
~PackStream();
|
|
|
|
|
2013-12-10 21:32:58 +00:00
|
|
|
bool bindToFile(const std::string &filepath, bool write=false);
|
2013-10-30 11:46:18 +00:00
|
|
|
|
2013-11-11 12:56:39 +00:00
|
|
|
void write(const int *value);
|
|
|
|
void write(const double *value);
|
|
|
|
void write(const char *value, const int max_length);
|
2013-12-10 21:32:58 +00:00
|
|
|
void write(const std::string &value);
|
2013-10-30 11:46:18 +00:00
|
|
|
|
|
|
|
void read(int* value);
|
|
|
|
void read(double* value);
|
|
|
|
void read(char* value, int max_length);
|
2013-12-10 21:32:58 +00:00
|
|
|
std::string readString();
|
2013-10-30 11:46:18 +00:00
|
|
|
|
2014-08-21 10:36:28 +00:00
|
|
|
void skip(const int &value, int count=1);
|
|
|
|
void skip(const double &value, int count=1);
|
|
|
|
|
2013-10-30 11:46:18 +00:00
|
|
|
private:
|
|
|
|
QFile* file;
|
|
|
|
QDataStream* stream;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PACKSTREAM_H
|