1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #ifndef LOTRO_DAT_BINARYDATA_H
- #define LOTRO_DAT_BINARYDATA_H
- #include <cstdio>
- #include <vector>
- #include <string>
- 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);
- const unsigned char& operator[] (const unsigned int &pos) const;
- 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);
- private:
- unsigned char *data_;
- size_t size_;
- };
- } // namespace LOTRO_DAT
- #endif //LOTRO_DAT_BINARYDATA_H
|