+/// A PersonalWordState holds a list of words to include (i.e. marked as spelt correctly), and a list of words to exclude (i.e. marked as spelled incorrectly)
+class PersonalWordList {
+public:
+ /// the word list has an associated language
+ PersonalWordList(std::string lang) : includes_(lang, true), excludes_(lang, false) {}
+
+ /// first item in includes word list
+ docstring_list::const_iterator includes_begin() const { return includes_.begin(); }
+ /// end of includes word list
+ docstring_list::const_iterator includes_end() const { return includes_.end(); }
+ /// first item in excludes word list
+ docstring_list::const_iterator excludes_begin() const { return excludes_.begin(); }
+ /// end of excludes word list
+ docstring_list::const_iterator excludes_end() const { return excludes_.end(); }
+ /// (re)load both word lists from file
+ void load() { includes_.load(); excludes_.load(); }
+ /// save both word lists to file
+ void save() { includes_.save(); excludes_.save(); }
+ /// is the given word excluded? (i.e. we previously called remove)
+ bool excluded(docstring const & word) const { return excludes_.exists(word); }
+ /// is the given word included? (i.e. we previously called insert)
+ bool included(docstring const & word) const { return includes_.exists(word); }
+ /// insert a given word to the set of valid words
+ void insert(docstring const & word) { excludes_.remove(word); includes_.insert(word); }
+ /// remove given word from the set of valid words
+ void remove(docstring const & word) { includes_.remove(word); excludes_.insert(word); }
+
+private:
+ /// The list of words to include
+ PersonalWordListPart includes_;
+ /// The list of words to exclude
+ PersonalWordListPart excludes_;
+};
+