YAPOG  0.0.1
Yet Another Pokemon Online Game
Time.cpp
Go to the documentation of this file.
2 
3 namespace yap
4 {
6  : value_ ()
7  {
8  }
9 
10  Time::Time (float seconds)
11  : value_ (sf::seconds (seconds))
12  {
13  }
14 
15  Time::Time (const sf::Time& copy)
16  : value_ (copy)
17  {
18  }
19 
20  Time::Time (const Time& copy)
21  : value_ (copy.value_)
22  {
23  }
24 
25  Time& Time::operator= (const Time& copy)
26  {
27  if (this == &copy)
28  return *this;
29 
30  value_ = copy.value_;
31 
32  return *this;
33  }
34 
36  {
37  return Time (value_ + rhs.value_);
38  }
39 
41  {
42  return operator+ (Time (rhs));
43  }
44 
46  {
47  return Time (value_ - rhs.value_);
48  }
49 
51  {
52  return operator- (Time (rhs));
53  }
54 
56  {
57  value_ += rhs.value_;
58 
59  return *this;
60  }
61 
62  Time& Time::operator+= (float rhs)
63  {
64  return operator+= (Time (rhs));
65  }
66 
68  {
69  value_ -= rhs.value_;
70 
71  return *this;
72  }
73 
74  Time& Time::operator-= (float rhs)
75  {
76  return operator-= (Time (rhs));
77  }
78 
79  float Time::GetValue () const
80  {
81  return value_.asSeconds ();
82  }
83 } // namespace yap