BinaryData.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 Database;
  13. class BinaryData
  14. {
  15. public:
  16. BinaryData();
  17. BinaryData(const BinaryData &d);
  18. explicit BinaryData(unsigned int size);
  19. ~BinaryData();
  20. unsigned char& operator[] (const unsigned int &pos);
  21. template <int T>
  22. long long ToNumber(const long long &pos) const;
  23. template <int T>
  24. long long ToNumberRAW(const long long &pos) const;
  25. template <int T>
  26. void FromNumber(const long long &number);
  27. template <int T>
  28. void FromNumberRAW(const long long &number);
  29. size_t size() const;
  30. unsigned char* data() const;
  31. BinaryData& operator=(const BinaryData& data);
  32. BinaryData CutData(long long first = 0, long long last = -1);
  33. bool WriteToFile(const char *filename) const;
  34. bool WriteToFile(const std::string &filename) const;
  35. bool CheckCompression() const;
  36. void DecompressData(unsigned int offset = 0);
  37. private:
  38. unsigned char *data_;
  39. size_t size_;
  40. };
  41. }
  42. }
  43. #endif //LOTRO_DAT_PATCHER_BINARYDATA_H