serialize_document.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "data/data_document.h"
  9. namespace Serialize {
  10. class Document {
  11. public:
  12. struct StickerSetInfo {
  13. StickerSetInfo(uint64 setId, uint64 accessHash, QString shortName)
  14. : setId(setId)
  15. , accessHash(accessHash)
  16. , shortName(shortName) {
  17. }
  18. uint64 setId;
  19. uint64 accessHash;
  20. QString shortName;
  21. };
  22. static void writeToStream(QDataStream &stream, DocumentData *document);
  23. static DocumentData *readStickerFromStream(
  24. not_null<Main::Session*> session,
  25. int streamAppVersion,
  26. QDataStream &stream,
  27. const StickerSetInfo &info);
  28. static DocumentData *readFromStream(
  29. not_null<Main::Session*> session,
  30. int streamAppVersion,
  31. QDataStream &stream);
  32. static int sizeInStream(DocumentData *document);
  33. private:
  34. static DocumentData *readFromStreamHelper(
  35. not_null<Main::Session*> session,
  36. int streamAppVersion,
  37. QDataStream &stream,
  38. const StickerSetInfo *info);
  39. };
  40. } // namespace Serialize