3#include "../core/sortedRefArray.hpp"
4#include "../core/string.hpp"
5#include "../core/timeout.hpp"
7#include "../core/sortedRefArray.hpp"
8#include "dictionary/dictRange.hpp"
191#if __has_include(<cereal/cereal.hpp>)
196 template <
typename archive>
208 template <
class archive>
void increase(int newSize) noexcept
Increase the space allocated for this array.
Definition array.hpp:189
array()
Default constructor.
Definition array.hpp:146
int length() const noexcept override
Get the length of the array.
Definition array.hpp:1011
T & at(int)
Function to get the object at the given index.
Definition array.hpp:1028
void append(const T &)
Append an object to the end of the array.
Definition array.hpp:931
An extension of the core::sortedArray class, specialized for pointers.
Definition sortedRefArray.hpp:26
A template class for character strings.
Definition string.hpp:62
A class to allow efficient, custom dictionary search functions.
Definition dictRange.hpp:13
A class for performing searches on a dictionary of words.
Definition dictionary.hpp:15
z::core::array< zstring > findPermutations(const zstring &scrambled) const noexcept
Find all permutations of a given scrambled word that are valid words in the dictionary.
int maxWordLength() const noexcept
Get the length of the longest word in the dictionary.
bool isWord(const zstring &word) const noexcept
Check if the given string is a valid word in the dictionary (case is ignored).
void load(archive &ar)
Serialization input.
Definition dictionary.hpp:209
void clear() noexcept
Empty the word list.
void setCaseSensitive(bool caseSensitive) noexcept
Set the case sensitivity of this dictionary.
dictionary filter(std::function< bool(const zstring &)> lambda) const
Filters the dictionary based on a predicate and returns a new dictionary containing the words that sa...
dictRange range() const noexcept
Create a new range of words encompassing the whole dictionary.
void write(const zstring &filename)
Write this dictionary's word list to a file.
void save(archive &ar) const
Serialization output.
Definition dictionary.hpp:197
bool narrow(dictRange *wordRange, uint32_t nextChar) const noexcept
Narrow the results of a range given the next character.
void addWord(const zstring &word) noexcept
Add a word to the dictionary.
bool isCaseSensitive() const noexcept
Check whether this dictionary is case sensitive.
bool read(const zstring &filename, const core::timeout &time=-1, bool assumePresorted=false)
Read this dictionary's word list as text from a file.
dictionary(bool caseSensitive=false) noexcept
Constructor.