1
/* ipuz-board.h
2
 *
3
 * Copyright 2022 Jonathan Blandford <jrb@gnome.org>
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
 *
19
 * SPDX-License-Identifier: (LGPL-2.1-or-later OR MIT)
20
 */
21

            
22
#pragma once
23

            
24
#include <glib-object.h>
25
#include <json-glib/json-glib.h>
26
#include <libipuz/ipuz-clue.h>
27
#include <libipuz/ipuz-cell.h>
28

            
29
G_BEGIN_DECLS
30

            
31

            
32
#define IPUZ_TYPE_BOARD (ipuz_board_get_type ())
33
40
G_DECLARE_FINAL_TYPE (IPuzBoard, ipuz_board, IPUZ, BOARD, GObject)
34

            
35
IPuzBoard *ipuz_board_new              (void);
36
void       ipuz_board_build_puzzle     (IPuzBoard     *board,
37
                                        JsonBuilder   *builder,
38
                                        const gchar   *block,
39
                                        const gchar   *empty);
40
void       ipuz_board_build_solution   (IPuzBoard     *board,
41
                                        JsonBuilder   *builder,
42
                                        const gchar   *block);
43
gboolean   ipuz_board_equal            (IPuzBoard     *a,
44
                                        IPuzBoard     *b);
45
void       ipuz_board_resize           (IPuzBoard     *board,
46
                                        guint          new_width,
47
                                        guint          new_height);
48
void       ipuz_board_parse_puzzle     (IPuzBoard     *board,
49
                                        JsonNode      *node,
50
                                        const gchar   *block,
51
                                        const gchar   *empty);
52
void       ipuz_board_parse_solution   (IPuzBoard     *board,
53
                                        JsonNode      *node,
54
                                        const gchar   *block,
55
                                        const gchar   *charset);
56

            
57
guint      ipuz_board_get_width        (IPuzBoard     *board);
58
guint      ipuz_board_get_height       (IPuzBoard     *board);
59
IPuzCell  *ipuz_board_get_cell         (IPuzBoard     *board,
60
                                        IPuzCellCoord  coord);
61
IPuzCell  *ipuz_board_get_cell_by_clue (IPuzBoard     *board,
62
                                        IPuzClue      *clue,
63
                                        IPuzCellCoord *coord);
64

            
65

            
66
G_END_DECLS