Struct
IpuzCell
Description [src]
struct IpuzCell {
/* No available fields */
}
An opaque data type containing the information for an individual
IpuzGrid
cell.
Cells are always created by a IpuzGrid
and aren’t meant to
exist independently.
Representation
Cells are found in three fundamental types as defined by
IpuzCellType
:
IPUZ_CELL_NULL
— An omitted cellIPUZ_CELL_NORMAL
— A regular light cellIPUZ_CELL_BLOCK
— A block
Cells also have a number of fields associated with them. They are:
number
: The number associated with the celllabel
: An alternative to number, in string formsolution
: The target answer for the puzzleinitial val
: A string representing a pre-filled value.
The inline images above indicate how a cell could be rendered for crossword-style puzzles. However, Each puzzle kind defines how the types fields are interpreted. Not every puzzle kind uses every value. Please see the Representation section located in each class’s documentation for more information.
As an example of how things can vary, for IpuzCrossword
the number
field refers to the clue number associated with that
cell (as shown above). For sudoku puzzles, it’s the number solution
in the grid. It is never used with IpuzAcrostic
or
IpuzNonogram
puzzles.
Info
Since cells are semantically undefined, the IpuzCell
setters don’t do any type of validation. It is very possible to
get a cell into a state that is undefined for a given puzzle
kind. As an example, setting the label
on a cell with a
cell_type
of IPUZ_CELL_NULL
is undefined in all
known puzzle kinds.
Links to other structs
Cells keep a reference to the styles and clues associated to
them. It’s possible to look these up by calling
ipuz_cell_get_clue()
and ipuz_cell_get_style()
respectively.
Warning
Cells don’t automatically maintain the styles or clues
associated with them. When modifying a puzzle, care must be
taken to keep these in sync with the rest of the puzzle. The
_fix()
functions generally do this.
Instance methods
ipuz_cell_set_style
Sets the style for a given cell. As a convenience, it’s possible to set the style_name at the same time.