Mercurial > dedupe
diff BitDecoder.hpp @ 49:f8d0ea827db3
Use BitArray.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 10 Sep 2012 23:59:46 +0200 |
| parents | 41cc0d8ac77f |
| children | b9515dc35fe4 |
line wrap: on
line diff
--- a/BitDecoder.hpp Mon Sep 10 23:59:25 2012 +0200 +++ b/BitDecoder.hpp Mon Sep 10 23:59:46 2012 +0200 @@ -1,10 +1,12 @@ #ifndef BITDECODER_HPP #define BITDECODER_HPP -#include <QtCore/QBitArray> +//#include <QtCore/QBitArray> #include <QtCore/QMap> #include <QtCore/QString> +#include "BitArray.hpp" + class BitDecoder { BitDecoder* low; BitDecoder* high; @@ -13,7 +15,7 @@ private: BitDecoder(BitDecoder* low_in, BitDecoder* high_in); - uint decode(QString& resString, const QBitArray& bits, uint offset) const + uint decode(QString& resString, const BitArray& bits, uint offset) const { //Data is always stored in a leaf node. if (high) { @@ -30,7 +32,7 @@ ~BitDecoder(); const QString& data() const; - QString decode(const QBitArray& bits) const + QString decode(const BitArray& bits) const { QString combined; uint n = bits.size(); @@ -43,13 +45,13 @@ QString decode(const QString& bits) const; static BitDecoder* merge(BitDecoder* low, BitDecoder* high); - static QBitArray bitsFromString(const QString& str); + static BitArray bitsFromString(const QString& str); - static QBitArray unite(const QBitArray& first, const QBitArray& second) + static BitArray unite(const BitArray& first, const BitArray& second) { int n = first.size(); int n2 = second.size(); - QBitArray result(n + n2); + BitArray result(n + n2); for (int i = 0; i < n; ++i) { result.setBit(i, first.testBit(i)); } @@ -60,7 +62,7 @@ } - QMap<QString, QBitArray> createEncoder() const; + QMap<QString, BitArray> createEncoder() const; }; #endif //BITDECODER_HPP
