From 9306cb60c32082c5403931de0823a9fd5daa196c Mon Sep 17 00:00:00 2001 From: Jason Katz-Brown Date: Sun, 25 Aug 2013 02:17:13 -0700 Subject: Initial git commit. --- quacker/graphicalreporter.h | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 quacker/graphicalreporter.h (limited to 'quacker/graphicalreporter.h') diff --git a/quacker/graphicalreporter.h b/quacker/graphicalreporter.h new file mode 100644 index 0000000..720de1a --- /dev/null +++ b/quacker/graphicalreporter.h @@ -0,0 +1,65 @@ +/* + * Quackle -- Crossword game artificial intelligence and analysis tool + * Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin. + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef QUACKER_GRAPHICAL_REPORTER_H +#define QUACKER_GRAPHICAL_REPORTER_H + +#include +#include + +namespace Quackle +{ + class ComputerPlayer; + class GamePosition; + class Game; +} + +class GraphicalReporter +{ +public: + // If generateImages is true, output must be an existing directory. + // If false, output is an HTML file. + GraphicalReporter(const QString &output, bool generateImages); + + // makes header and report for all positions + void reportGame(const Quackle::Game &game, Quackle::ComputerPlayer *computerPlayer); + + // makes header and puts into the index file + void reportHeader(const Quackle::Game &game); + + // makes graphical displays of top n plays of position, dumps to images + // and puts links to them in the index file. + void reportPosition(const Quackle::GamePosition &position, Quackle::ComputerPlayer *computerPlayer); + +protected: + QString makeFilename(const QString &filename) const; + + // opens the index file (m_output/index.html or m_output if it's a file) + // if it is not already open + void openIndex(); + + QString m_output; + QFile m_indexFile; + QTextStream m_indexStream; + + bool m_generateImages; +}; + +#endif -- cgit v1.2.3