qcross/libqnono/cnonogram.h

68 lines
2.8 KiB
C++

/***************************************************************************
* Copyright (C) 2008 by Oliver Groß *
* z.o.gross@gmx.de *
* *
* 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef LIBQCROSS_CMONOPICTURE_H
#define LIBQCROSS_CMONOPICTURE_H
#include <QSize>
#include <QVector>
#include <QString>
#include "nonogramproblem.h"
#include "nonogrammarker.h"
class QImage;
namespace libqnono {
class CNonogram {
public:
typedef QVector<quint16> NumbersVector;
CNonogram();
CNonogram(const NonogramProblem & problem);
const NonogramProblem & problem() const { return m_problem; }
QString name() const { return m_problem.name(); }
quint16 timeout() const { return m_problem.timeout(); }
const NonogramImage & solution() const { return m_problem.solution(); }
const NonogramNumbers & numbers() const { return m_problem.numbers(); }
const NonogramMarker & marker() const { return m_marker; }
QSize size() const { return m_problem.size(); }
int width() const { return size().width(); }
int height() const { return size().height(); }
/* returns false if set MARKED on white solution pixel (it still sets the mark) */
bool setMark(int x, int y, NonogramMarker::Mark mark);
bool readFromStream(QDataStream & stream);
void writeToStream(QDataStream& stream) const;
protected:
NonogramProblem m_problem;
NonogramMarker m_marker;
};
QDataStream & operator<<(QDataStream & stream, const CNonogram & nonogram);
QDataStream & operator>>(QDataStream & stream, CNonogram & nonogram);
}
#endif