Update.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include "../../Netzwerk/Patcher.h"
  3. #include <Fortschritt.h>
  4. #include <Knopf.h>
  5. #include <Array.h>
  6. #include <Thread.h>
  7. using namespace Framework;
  8. class Update : public Thread
  9. {
  10. private:
  11. Patcher *p;
  12. FBalken *fb;
  13. bool updateAbbrechen;
  14. int dg;
  15. std::function< void( bool ) > after;
  16. public:
  17. // Konstruktor
  18. Update( FBalken *fb, int dg, std::function< void( bool ) > after = []( bool b ) {} );
  19. // Destruktor
  20. ~Update();
  21. // nicht constant
  22. void setPatcher( Patcher *p );
  23. void abbrechen();
  24. void herunterladen();
  25. void thread() override;
  26. void threadEnd() override;
  27. // constant
  28. int getDateiGruppe() const;
  29. };
  30. class UpdateHandler : public virtual ReferenceCounter
  31. {
  32. private:
  33. Patcher *patcher;
  34. RCArray< Update > *updates;
  35. Critical cs;
  36. // privat
  37. void lock();
  38. void unlock();
  39. public:
  40. // Konstruktor
  41. UpdateHandler();
  42. // Destruktor
  43. ~UpdateHandler();
  44. // nicht constant
  45. bool add( Update *update );
  46. void remove( int dg = 0 );
  47. bool hat( int dg = 0 );
  48. };