From d1f5f768764d439f02520d9c6c017fcd3ae96b83 Mon Sep 17 00:00:00 2001 From: John Fultz Date: Mon, 24 Aug 2015 00:51:48 -0500 Subject: Add a new DAWG format. Make reader and writer for the new format, while maintaing compatibility with the old. Things to note of the new format... * Now has a header, with version number, MD5, and word count. * No longer has terminator bit. Nodes are terminated by a non-zero playability. * Which means letters have one more bit. So we can now support more than 32 letters. Important for Slovak alphabet. Also, various cleanups and refactorings. --- lexiconparameters.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lexiconparameters.h') diff --git a/lexiconparameters.h b/lexiconparameters.h index 4c77cd1..4b6369d 100644 --- a/lexiconparameters.h +++ b/lexiconparameters.h @@ -28,15 +28,20 @@ namespace Quackle class DawgInterpreter { public: - virtual void loadDawg(ifstream &file, unsigned char *dawg) = 0; + virtual void loadDawg(ifstream &file, LexiconParameters &lexparams) = 0; virtual void dawgAt(const unsigned char *dawg, int index, unsigned int &p, Letter &letter, bool &t, bool &lastchild, bool &british, int &playability) const = 0; virtual int versionNumber() const = 0; virtual ~DawgInterpreter() {}; }; +class V0DawgInterpreter; +class V1DawgInterpreter; class LexiconParameters { + friend class Quackle::V0DawgInterpreter; + friend class Quackle::V1DawgInterpreter; + public: LexiconParameters(); ~LexiconParameters(); @@ -75,6 +80,8 @@ protected: unsigned char *m_gaddag; string m_lexiconName; DawgInterpreter *m_interpreter; + char m_hash[16]; + int m_wordcount; }; } -- cgit v1.2.3