56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
#ifndef LIBQCROSS_CNONOGRAMSOLVER_H
|
|
#define LIBQCROSS_CNONOGRAMSOLVER_H
|
|
|
|
#include <QObject>
|
|
#include <QSize>
|
|
#include <QList>
|
|
|
|
namespace libqnono {
|
|
class CNonogramNumbers;
|
|
|
|
class CNonogramSolution {
|
|
public:
|
|
CNonogramSolution(QSize size, bool ** data)
|
|
: m_size(size), m_data(data) {
|
|
}
|
|
|
|
~CNonogramSolution() {
|
|
int cols = m_size.width();
|
|
for (int col = 0; col < cols; ++col) delete [] m_data[col];
|
|
delete[] m_data;
|
|
}
|
|
|
|
QSize size() const { return m_size; }
|
|
bool** data() { return m_data; }
|
|
|
|
private:
|
|
Q_DISABLE_COPY(CNonogramSolution)
|
|
|
|
QSize m_size;
|
|
bool ** m_data;
|
|
};
|
|
|
|
QList<CNonogramSolution*> solve(const CNonogramNumbers & numbers);
|
|
|
|
class CNonogram;
|
|
|
|
class CNonogramSolver : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
CNonogramSolver(QObject * parent = 0);
|
|
~CNonogramSolver();
|
|
|
|
void setNonogram(CNonogram * nonogram);
|
|
public slots:
|
|
bool solve();
|
|
signals:
|
|
void markRequested(int x, int y, int type);
|
|
protected:
|
|
enum MarkerType {CMT_UNMARKED = 0, CMT_MARKED = 1, CMT_CROSSED = 2, CMT_NONE = 3};
|
|
|
|
CNonogram * m_Nonogram;
|
|
};
|
|
}
|
|
|
|
#endif
|