BinaryData.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // Created by Иван_Архипов on 31.10.2017.
  3. //
  4. #ifndef LOTRO_DAT_PATCHER_BINARYDATA_H
  5. #define LOTRO_DAT_PATCHER_BINARYDATA_H
  6. #include <cstdio>
  7. #include <string>
  8. extern "C++"
  9. {
  10. namespace LOTRO_DAT
  11. {
  12. class BinaryData
  13. {
  14. public:
  15. BinaryData();
  16. BinaryData(const BinaryData &d);
  17. explicit BinaryData(unsigned int size);
  18. ~BinaryData();
  19. unsigned char& operator[] (const unsigned int &pos);
  20. template <int T>
  21. long long ToNumber(const long long &pos) const;
  22. template <int T>
  23. long long ToNumberRAW(const long long &pos) const;
  24. template <int T>
  25. void FromNumber(const long long &number);
  26. template <int T>
  27. void FromNumberRAW(const long long &number);
  28. size_t size() const;
  29. unsigned char* data() const;
  30. BinaryData& operator=(const BinaryData& data);
  31. bool WriteToFile(const char *filename) const;
  32. bool WriteToFile(const std::string &filename) const;
  33. bool CheckCompression() const;
  34. void DecompressData(unsigned int offset = 0);
  35. private:
  36. unsigned char *data_;
  37. size_t size_;
  38. };
  39. }
  40. }
  41. #endif //LOTRO_DAT_PATCHER_BINARYDATA_H