Trie and hyphenator RAII.

This commit is contained in:
2025-08-11 03:47:43 -04:00
parent 91da2ff34b
commit 521b60d5da
2 changed files with 8 additions and 16 deletions

View File

@ -80,13 +80,13 @@ class TrieBuilder {
~TrieBuilder ();
void insert (const char *key, const char *value);
Trie *createTrie();
std::unique_ptr< Trie > createTrie();
};
class Hyphenator: public lout::object::Object
{
static std::map< std::string, std::unique_ptr< Hyphenator > > hyphenators;
Trie *trie;
std::unique_ptr< Trie > trie;
// Only instantiated when needed.
std::optional< std::map< std::string, std::vector< int > > > exceptions;
@ -101,7 +101,6 @@ class Hyphenator: public lout::object::Object
public:
Hyphenator (const char *patFile, const char *excFile, int pack = 256);
~Hyphenator();
static Hyphenator *getHyphenator (const char *language);
static bool isHyphenationCandidate (const char *word);