miniupnpd 1.9 (20160113)
[tomato.git] / release / src / router / transmission / qt / speed.h
blob34d8101ed02d6902f723d21d5301b22aff089972
1 /*
2 * This file Copyright (C) 2009-2014 Mnemosyne LLC
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
7 * $Id: speed.h 14241 2014-01-21 03:10:30Z jordan $
8 */
10 #ifndef QTR_SPEED_H
11 #define QTR_SPEED_H
13 #include "formatter.h"
15 class Speed
17 private:
18 int _Bps;
19 Speed (int Bps): _Bps (Bps) {}
21 public:
22 Speed (): _Bps (0) {}
23 double KBps () const;
24 int Bps () const { return _Bps; }
25 bool isZero () const { return _Bps == 0; }
26 static Speed fromKBps (double KBps);
27 static Speed fromBps (int Bps) { return Speed (Bps); }
28 void setBps (int Bps) { _Bps = Bps; }
29 Speed& operator+= (const Speed& that) { _Bps += that._Bps; return *this; }
30 Speed operator+ (const Speed& that) const { return Speed (_Bps + that._Bps); }
31 bool operator< (const Speed& that) const { return _Bps < that._Bps; }
34 #endif