ChessClock class
[chessclock] / classes / turninformation.h
1  /**************************************************************************
2
3     Chess Clock
4
5     Copyright (c) Arto Hyvättinen 2010
6
7     This file is part of Chess Clock software.
8
9     Chess Clock is free software: you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation, either version 3 of the License, or
12     (at your option) any later version.
13
14     Chess Clock is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18
19
20 **************************************************************************/
21
22 #ifndef TURNINFORMATION_H
23 #define TURNINFORMATION_H
24
25 /*! Turn information class
26
27   @author Arto Hyvättinen
28   @date 2010-08-13
29
30   Store information about one turn of player
31
32   */
33
34 class TurnInformation
35 {
36 public:
37     /*! Turn information object
38
39       @param turnId Id of turn of player
40       @param white true if turn on white, false id black */
41     TurnInformation(int turnId, bool white);
42
43     int getTurnId() const { return turnId_; }
44
45     /*! Duration of turn
46       @return Duration of turn in msecs */
47     int getDuration() const { return duration_; }
48
49     /*! Duration of pauses during this turn
50       @return Duration of pauses in msecs */
51     int getPaused() const { return paused_; }
52
53     /*! Time available for this player after this turn
54       @return Time available in msecs */
55     int getTimeAfter() const;
56     bool isWhiteTurn() const { return white_; }
57
58     void addTime( int msecs );
59     void addPause( int msecs );
60
61     /*! Mark turn ready
62
63       Turn will be locked to chances.
64
65       @param msecs Time available after this turn in msecs
66       */
67     void turnReady( int msecs );
68
69
70 protected:
71     int turnId_; /*! id of turn */
72     int duration_; /*! duration of turn in msecs */
73     int paused_; /*! duration of pauses in msecs */
74     int timeAfter_; /*! time available after this turn in msecs */
75     bool turnReady_; /*! turn is ready and locked */
76     bool white_; /*! turn of white player? */
77 };
78
79 #endif // TURNINFORMATION_H