textsubfile.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef LOTRO_DAT_TEXTSUBFILE_H
  2. #define LOTRO_DAT_TEXTSUBFILE_H
  3. #include "subfile.h"
  4. namespace LOTRO_DAT {
  5. namespace Subfiles {
  6. struct TextFragment {
  7. long long fragment_id;
  8. std::u16string text;
  9. std::string args;
  10. friend bool operator < (const TextFragment &first, const TextFragment &second) {
  11. return first.fragment_id < second.fragment_id;
  12. }
  13. };
  14. template<> class Subfile<TEXT> {
  15. public:
  16. static BinaryData BuildForImport(const BinaryData& old_data, const SubfileData& outer_data);
  17. static SubfileData BuildForExport(const BinaryData& inner_data);
  18. private:
  19. static std::vector<std::u16string> MakePieces(const BinaryData &data, long long &offset);
  20. static std::vector<long long> MakeArgumentReferences(const BinaryData &data, long long &offset);
  21. static std::vector<std::vector<BinaryData>> MakeArgumentStrings(const BinaryData &data, long long &offset);
  22. static std::vector<TextFragment> ParsePatchFragments(const SubfileData &data);
  23. static BinaryData BuildPieces(const BinaryData &data, const TextFragment &new_data, long long &offset);
  24. static BinaryData BuildArgumentReferences(const BinaryData &data, const TextFragment &new_data, long long &offset);
  25. static BinaryData BuildArgumentStrings(const BinaryData &data, const TextFragment &new_data, long long &offset);
  26. static BinaryData GetPieceData(const BinaryData &data, long long &offset);
  27. static BinaryData GetArgumentReferenceData(const BinaryData &data, long long &offset);
  28. static BinaryData GetArgumentStringsData(const BinaryData &data, long long &offset);
  29. };
  30. }; // namespace Subfiles
  31. }; // namespace LOTRO_DAT
  32. #endif //LOTRO_DAT_TEXTSUBFILE_H