From e84cda7a13e7406c41c1160db4adb5e8e2a07592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?= Date: Mon, 5 Apr 2010 00:35:16 +0200 Subject: Mark History::movesExecuted and History::movesToExecute as const --- history.cpp | 14 +++++++------- history.h | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/history.cpp b/history.cpp index 65e3a5f..56cf6c0 100644 --- a/history.cpp +++ b/history.cpp @@ -58,7 +58,7 @@ Move* History::current() return 0; } -/** Add a new move */ +/** Add a new move. */ void History::add(Move* move) { if (move) @@ -74,28 +74,28 @@ void History::add(Move* move) } } -/** Set previous move as current */ +/** Set previous move as current. */ void History::backward() { if (movesExecuted()) --executed; } -/** Set next move as current */ +/** Set next move as current. */ void History::forward() { if (movesToExecute()) ++executed; } -/** Are there executed moves in the history */ -bool History::movesExecuted() +/** Are there executed moves in the history? */ +bool History::movesExecuted() const { return executed > 0; } -/** Are there moves to execute in the history */ -bool History::movesToExecute() +/** Are there moves to execute in the history? */ +bool History::movesToExecute() const { return executed < history.size(); } diff --git a/history.h b/history.h index a2d24a8..73d831c 100644 --- a/history.h +++ b/history.h @@ -1,7 +1,7 @@ /* * Sudoku: A plug-in for the Video Disk Recorder * - * Copyright (C) 2008, Thomas Günther + * Copyright (C) 2008-2010, Thomas Günther * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,20 +54,20 @@ namespace Sudoku /** Current move in the history */ Move* current(); - /** Add a new move */ + /** Add a new move. */ void add(Move* move); - /** Set previous move as current */ + /** Set previous move as current. */ void backward(); - /** Set next move as current */ + /** Set next move as current. */ void forward(); - /** Are there executed moves in the history */ - bool movesExecuted(); + /** Are there executed moves in the history? */ + bool movesExecuted() const; - /** Are there moves to execute in the history */ - bool movesToExecute(); + /** Are there moves to execute in the history? */ + bool movesToExecute() const; }; @@ -80,7 +80,7 @@ namespace Sudoku /** Destructor */ virtual ~Move() {}; - /** Do the move */ + /** Do the move. */ virtual void execute() = 0; /** Undo the move. */ -- cgit v1.2.3