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"
62 bool read(const zstring &filename, const
core::timeout &time = -1,
bool assumePresorted = false);
70 void write(const zstring &filename);
81 bool isWord(const zstring &word) const noexcept;
92 void addWord(const zstring &word) noexcept;
191#if __has_include(<cereal/cereal.hpp>)
196 template <
typename archive>
197 void save(archive &ar)
const {
198 ar((CEREAL_SIZE_TYPE)
length());
199 for (
int i = 0; i <
length(); i++) {
208 template <
class archive>
209 void load(archive &ar) {
215 for (CEREAL_SIZE_TYPE i = 0; i < sz; i++) {
216 zstring *data =
new zstring;
void increase(int newSize) noexcept
Definition array.hpp:155
array()
Definition array.hpp:112
int length() const noexcept override
Definition array.hpp:1111
zstring *& at(int)
Definition array.hpp:1128
void append(const zstring *&)
Definition array.hpp:1031
An extension of the core::sortedArray class, specialized for pointers.
Definition sortedRefArray.hpp:26
A class to allow efficient, custom dictionary search functions.
Definition dictRange.hpp:13
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 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.
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.
Section containing core functions and classes.
Section containing utility classes.