123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // 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);
- BinaryData(BinaryData&& other) noexcept;
- 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
|