qcross/libqnono/cnonogram.h

68 lines
2.8 KiB
C
Raw Normal View History

2010-06-16 12:53:56 +00:00
/***************************************************************************
* Copyright (C) 2008 by Oliver Groß *
* z.o.gross@gmx.de *
2010-06-16 12:53:56 +00:00
* *
* 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"
2010-06-16 12:53:56 +00:00
class QImage;
namespace libqnono {
2010-06-16 12:53:56 +00:00
class CNonogram {
public:
typedef QVector<quint16> NumbersVector;
CNonogram();
CNonogram(const NonogramProblem & problem);
2010-06-16 12:53:56 +00:00
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(); }
2010-06-16 12:53:56 +00:00
const NonogramMarker & marker() const { return m_marker; }
2010-06-16 12:53:56 +00:00
QSize size() const { return m_problem.size(); }
int width() const { return size().width(); }
int height() const { return size().height(); }
2010-06-16 12:53:56 +00:00
/* returns false if set MARKED on white solution pixel (it still sets the mark) */
bool setMark(int x, int y, NonogramMarker::Mark mark);
2010-06-16 12:53:56 +00:00
bool readFromStream(QDataStream & stream);
void writeToStream(QDataStream& stream) const;
2010-06-16 12:53:56 +00:00
protected:
NonogramProblem m_problem;
NonogramMarker m_marker;
2010-06-16 12:53:56 +00:00
};
QDataStream & operator<<(QDataStream & stream, const CNonogram & nonogram);
QDataStream & operator>>(QDataStream & stream, CNonogram & nonogram);
2010-06-16 12:53:56 +00:00
}
#endif