source: trunk/qt/Speed.h @ 14539

Last change on this file since 14539 was 14539, checked in by mikedld, 6 years ago

Unify/prettify Qt client headers style

  • Property svn:keywords set to Date Rev Author Id
File size: 857 bytes
Line 
1/*
2 * This file Copyright (C) 2009-2015 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: Speed.h 14539 2015-06-12 22:12:12Z mikedld $
8 */
9
10#ifndef QTR_SPEED_H
11#define QTR_SPEED_H
12
13class Speed
14{
15  public:
16    Speed (): _Bps (0) {}
17
18    double KBps () const;
19    int Bps () const { return _Bps; }
20    bool isZero () const { return _Bps == 0; }
21    static Speed fromKBps (double KBps);
22    static Speed fromBps (int Bps) { return Speed (Bps); }
23    void setBps (int Bps) { _Bps = Bps; }
24    Speed& operator+= (const Speed& that) { _Bps += that._Bps; return *this; }
25    Speed operator+ (const Speed& that) const { return Speed (_Bps + that._Bps); }
26    bool operator< (const Speed& that) const { return _Bps < that._Bps; }
27
28  private:
29    Speed (int Bps): _Bps (Bps) {}
30
31  private:
32    int _Bps;
33};
34
35#endif // QTR_SPEED_H
Note: See TracBrowser for help on using the repository browser.