source: trunk/qt/speed.h @ 11054

Last change on this file since 11054 was 11054, checked in by charles, 12 years ago

(trunk qt) silence a few compiler warnings

  • Property svn:keywords set to Date Rev Author Id
File size: 1.1 KB
Line 
1/*
2 * This file Copyright (C) 2009-2010 Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: speed.h 11054 2010-07-25 20:36:33Z charles $
11 */
12
13#ifndef QTR_SPEED_H
14#define QTR_SPEED_H
15
16#include "formatter.h"
17
18class Speed
19{
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; }
34};
35
36#endif
Note: See TracBrowser for help on using the repository browser.