Revert "transmission: update from 2.13 to 2.22"
[tomato.git] / release / src / router / transmission / qt / speed.h
blob9cf0b8738c81c8deaa2721f0137be312e93a8f11
1 /*
2 * This file Copyright (C) Mnemosyne LLC
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10 * $Id: speed.h 11092 2010-08-01 20:36:13Z charles $
13 #ifndef QTR_SPEED_H
14 #define QTR_SPEED_H
16 #include "formatter.h"
18 class Speed
20 private:
21 int _Bps;
22 Speed( int Bps ): _Bps(Bps) { }
23 public:
24 Speed( ): _Bps(0) { }
25 double KBps( ) const;
26 int Bps( ) const { return _Bps; }
27 bool isZero( ) const { return _Bps == 0; }
28 static Speed fromKBps( double KBps );
29 static Speed fromBps( int Bps ) { return Speed( Bps ); }
30 void setBps( int Bps ) { _Bps = Bps; }
31 Speed& operator+=( const Speed& that ) { _Bps += that._Bps; return *this; }
32 Speed operator+( const Speed& that ) const { return Speed( _Bps + that._Bps ); }
33 bool operator<( const Speed& that ) const { return _Bps < that._Bps; }
36 #endif