1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // Created by Иван_Архипов on 31.10.2017.
- //
- #include <vector>
- #ifndef LOTRO_DAT_PATCHER_BINARYDATA_H
- #define LOTRO_DAT_PATCHER_BINARYDATA_H
- #include <cstdio>
- #include <string>
- extern "C++"
- {
- namespace LOTRO_DAT
- {
- class Database;
- class BinaryData
- {
- public:
- BinaryData();
- BinaryData(const BinaryData &d);
- explicit BinaryData(const char* data, unsigned int size);
- explicit BinaryData(unsigned int size);
- ~BinaryData();
- unsigned char& operator[] (const unsigned int &pos);
- BinaryData operator +(const BinaryData &b);
- bool operator == (const BinaryData &b) const;
- bool operator != (const BinaryData &b) const;
- bool Empty() const;
- void Append(const BinaryData &b, size_t offset = 0);
- template <unsigned int T>
- long long ToNumber(const long long &pos) const;
- template <unsigned int T>
- long long ToNumberRAW(const long long &pos) const;
- template <unsigned int T>
- static BinaryData FromNumber(const long long &number);
- template <unsigned int T>
- static BinaryData FromNumberRAW(const long long &number);
- size_t size() const;
- unsigned char* data() const;
- BinaryData& operator=(const BinaryData& data);
- BinaryData CutData(long long first = 0, long long last = -1) const;
- bool WriteToFile(const char *filename) const;
- bool WriteToFile(const std::string &filename) const;
- void ReadFromFile(const char *filename);
- void ReadFromFile(const std::string &filename);
- bool CheckCompression() const;
- BinaryData DecompressData(unsigned int offset = 0) const;
- BinaryData CompressData(unsigned int offset = 0) const;
- private:
- unsigned char *data_;
- size_t size_;
- };
- }
- }
- #endif //LOTRO_DAT_PATCHER_BINARYDATA_H
|