Cookie.h 813 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "mupdf/fitz.h"
  2. #include "mupdf/pdf.h"
  3. #include "MuPDF.h"
  4. #ifndef __COOKIE
  5. #define __COOKIE
  6. #pragma once
  7. namespace MuPDF {
  8. public ref class Cookie : IEquatable<Cookie^> {
  9. public:
  10. Cookie() {
  11. _cookie = new fz_cookie();
  12. }
  13. property bool IsCancellationPending {
  14. bool get() { return _cookie->abort; }
  15. }
  16. property int Progress {
  17. int get() { return _cookie->progress; }
  18. }
  19. property int ProgressMax {
  20. int get() { return _cookie->progress_max; }
  21. }
  22. property int Errors {
  23. int get() { return _cookie->errors; }
  24. }
  25. void Cancel() {
  26. _cookie->abort = 1;
  27. }
  28. ~Cookie() {
  29. delete _cookie;
  30. }
  31. Equatable(Cookie, _cookie)
  32. internal:
  33. Cookie(fz_cookie* cookie) {
  34. _cookie = cookie;
  35. };
  36. property fz_cookie* Ptr {
  37. fz_cookie* get() { return _cookie; }
  38. }
  39. private:
  40. fz_cookie* _cookie;
  41. };
  42. };
  43. #endif