diff --git a/src/map/IMG/img.cpp b/src/map/IMG/img.cpp index cdff3e6c..c4f498b6 100644 --- a/src/map/IMG/img.cpp +++ b/src/map/IMG/img.cpp @@ -182,7 +182,7 @@ IMG::IMG(const QString &fileName) : _fileName(fileName) _valid = true; } -qint64 IMG::read(QFile &file, char *data, qint64 maxSize) +qint64 IMG::read(QFile &file, char *data, qint64 maxSize) const { qint64 ret = file.read(data, maxSize); if (_key) @@ -191,7 +191,7 @@ qint64 IMG::read(QFile &file, char *data, qint64 maxSize) return ret; } -template bool IMG::readValue(QFile &file, T &val) +template bool IMG::readValue(QFile &file, T &val) const { T data; @@ -203,7 +203,7 @@ template bool IMG::readValue(QFile &file, T &val) return true; } -bool IMG::readBlock(QFile &file, int blockNum, char *data) +bool IMG::readBlock(QFile &file, int blockNum, char *data) const { if (!file.seek((quint64)blockNum << _blockBits)) return false; diff --git a/src/map/IMG/img.h b/src/map/IMG/img.h index fd6a65e1..d4b31415 100644 --- a/src/map/IMG/img.h +++ b/src/map/IMG/img.h @@ -12,13 +12,12 @@ public: const QString &fileName() const {return _fileName;} -private: - friend class SubFile; - unsigned blockBits() const {return _blockBits;} - bool readBlock(QFile &file, int blockNum, char *data); - qint64 read(QFile &file, char *data, qint64 maxSize); - template bool readValue(QFile &file, T &val); + bool readBlock(QFile &file, int blockNum, char *data) const; + +private: + qint64 read(QFile &file, char *data, qint64 maxSize) const; + template bool readValue(QFile &file, T &val) const; QString _fileName; quint8 _key; diff --git a/src/map/IMG/lblfile.h b/src/map/IMG/lblfile.h index 48a3dfa5..0db69b44 100644 --- a/src/map/IMG/lblfile.h +++ b/src/map/IMG/lblfile.h @@ -12,7 +12,7 @@ class RGNFile; class LBLFile : public SubFile { public: - LBLFile(IMG *img) + LBLFile(const IMG *img) : SubFile(img), _huffmanText(0), _table(0), _offset(0), _size(0), _poiOffset(0), _poiSize(0), _imgOffsetIdSize(0), _poiMultiplier(0), _multiplier(0), _encoding(0) {} @@ -20,7 +20,7 @@ public: : SubFile(path), _huffmanText(0), _table(0), _offset(0), _size(0), _poiOffset(0), _poiSize(0), _imgOffsetIdSize(0), _poiMultiplier(0), _multiplier(0), _encoding(0) {} - LBLFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset), + LBLFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _huffmanText(0), _table(0), _offset(0), _size(0), _poiOffset(0), _poiSize(0), _imgOffsetIdSize(0), _poiMultiplier(0), _multiplier(0), _encoding(0) {} diff --git a/src/map/IMG/netfile.h b/src/map/IMG/netfile.h index 4a85bb1d..2b11fb5c 100644 --- a/src/map/IMG/netfile.h +++ b/src/map/IMG/netfile.h @@ -12,12 +12,12 @@ class HuffmanTable; class NETFile : public SubFile { public: - NETFile(IMG *img) : SubFile(img), _huffmanTable(0), _tp(0), _offset(0), + NETFile(const IMG *img) : SubFile(img), _huffmanTable(0), _tp(0), _offset(0), _size(0), _linksOffset(0), _linksSize(0), _shift(0), _linksShift(0) {} NETFile(const QString *path) : SubFile(path), _huffmanTable(0), _tp(0), _offset(0), _size(0), _linksOffset(0), _linksSize(0), _shift(0), _linksShift(0) {} - NETFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset), + NETFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _huffmanTable(0), _tp(0), _offset(0), _size(0), _linksOffset(0), _linksSize(0), _shift(0), _linksShift(0) {} ~NETFile(); diff --git a/src/map/IMG/nodfile.h b/src/map/IMG/nodfile.h index 4495a873..737e201e 100644 --- a/src/map/IMG/nodfile.h +++ b/src/map/IMG/nodfile.h @@ -53,13 +53,13 @@ public: bool eog; }; - NODFile(IMG *img) : SubFile(img), _indexOffset(0), _indexSize(0), + NODFile(const IMG *img) : SubFile(img), _indexOffset(0), _indexSize(0), _indexFlags(0), _blockOffset(0), _blockSize(0), _indexRecordSize(0), _blockRecordSize(0), _blockShift(0), _nodeShift(0), _indexIdSize(0) {} NODFile(const QString *path) : SubFile(path), _indexOffset(0), _indexSize(0), _indexFlags(0), _blockOffset(0), _blockSize(0), _indexRecordSize(0), _blockRecordSize(0), _blockShift(0), _nodeShift(0), _indexIdSize(0) {} - NODFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset), + NODFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _indexOffset(0), _indexSize(0), _indexFlags(0), _blockOffset(0), _blockSize(0), _indexRecordSize(0), _blockRecordSize(0), _blockShift(0), _nodeShift(0), _indexIdSize(0) {} diff --git a/src/map/IMG/rgnfile.h b/src/map/IMG/rgnfile.h index 051813a2..80066cd1 100644 --- a/src/map/IMG/rgnfile.h +++ b/src/map/IMG/rgnfile.h @@ -20,7 +20,7 @@ public: RoadReference = 0x10 }; - RGNFile(IMG *img) + RGNFile(const IMG *img) : SubFile(img), _huffmanTable(0), _offset(0), _size(0), _polygonsOffset(0), _polygonsSize(0), _linesOffset(0), _linesSize(0), _pointsOffset(0), _pointsSize(0) {} @@ -28,7 +28,7 @@ public: : SubFile(path), _huffmanTable(0), _offset(0), _size(0), _polygonsOffset(0), _polygonsSize(0), _linesOffset(0), _linesSize(0), _pointsOffset(0), _pointsSize(0) {} - RGNFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset), + RGNFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _huffmanTable(0), _offset(0), _size(0), _polygonsOffset(0), _polygonsSize(0), _linesOffset(0), _linesSize(0), _pointsOffset(0), _pointsSize(0) {} diff --git a/src/map/IMG/subfile.h b/src/map/IMG/subfile.h index 0b67cf88..77e2cf92 100644 --- a/src/map/IMG/subfile.h +++ b/src/map/IMG/subfile.h @@ -43,10 +43,10 @@ public: int _pos; }; - SubFile(IMG *img) + SubFile(const IMG *img) : _gmpOffset(0), _img(img), _blocks(new QVector()), _path(0) {} - SubFile(SubFile *gmp, quint32 offset) : _gmpOffset(offset), _img(gmp->_img), - _blocks(gmp->_blocks), _path(gmp->_path) {} + SubFile(const SubFile *gmp, quint32 offset) : _gmpOffset(offset), + _img(gmp->_img), _blocks(gmp->_blocks), _path(gmp->_path) {} SubFile(const QString *path) : _gmpOffset(0), _img(0), _blocks(0), _path(path) {} ~SubFile() @@ -153,7 +153,7 @@ protected: quint32 _gmpOffset; private: - IMG *_img; + const IMG *_img; QVector *_blocks; const QString *_path; }; diff --git a/src/map/IMG/trefile.h b/src/map/IMG/trefile.h index 3f17390b..0a5781db 100644 --- a/src/map/IMG/trefile.h +++ b/src/map/IMG/trefile.h @@ -13,9 +13,9 @@ class SubDiv; class TREFile : public SubFile { public: - TREFile(IMG *img) : SubFile(img) {} + TREFile(const IMG *img) : SubFile(img) {} TREFile(const QString *path) : SubFile(path) {} - TREFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset) {} + TREFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset) {} ~TREFile(); bool init();