Samchon Framework for CPP  1.0.0
ProgressEvent.hpp
1 #pragma once
2 #include <samchon/library/Event.hpp>
3 
4 namespace samchon
5 {
6 namespace library
7 {
16  : public Event
17  {
18  private:
19  typedef Event super;
20 
21  enum : int
22  {
23  ACTIVATE = 1,
24  COMPLETE = 2,
25  REMOVED = -1
26  };
27 
28  protected:
32  size_t numerator;
33 
38  size_t denominator;
39 
40  public:
41  enum : int
42  {
43  PROGRESS = 11
44  };
45 
55  ProgressEvent(EventDispatcher *source, size_t numerator, size_t denominator)
56  : super(source, ProgressEvent::PROGRESS)
57  {
58  this->numerator = numerator;
59  this->denominator = denominator;
60  };
61  virtual ~ProgressEvent() = default;
62 
66  auto getNumerator() const -> size_t
67  {
68  return numerator;
69  };
70 
74  auto getDenominator() const -> size_t
75  {
76  return denominator;
77  };
78 
82  auto getPercent() const -> double
83  {
84  return numerator / (double)denominator;
85  };
86  };
87 };
88 };
auto getDenominator() const -> size_t
Get denominator, number of total progress.
auto getNumerator() const -> size_t
Get numerator, number of current progress.
size_t denominator
The number of total progress.
EventDispatcher * source
Source of the event.
Definition: Event.hpp:55
auto getPercent() const -> double
Get percentage of the progress.
Represent an event running on background.
Definition: Event.hpp:41
ProgressEvent(EventDispatcher *source, size_t numerator, size_t denominator)
Construct from source and progress.
Event representing a progress.
Abstract class for dispatching Event.
size_t numerator
The number of current progress.