Nuspell
spell checker
dictionary.hxx
Go to the documentation of this file.
1 /* Copyright 2016-2023 Dimitrij Mijoski
2  *
3  * This file is part of Nuspell.
4  *
5  * Nuspell is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * Nuspell is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with Nuspell. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
24 #ifndef NUSPELL_DICTIONARY_HXX
25 #define NUSPELL_DICTIONARY_HXX
26 
27 #include "suggester.hxx"
28 
29 #include <filesystem>
30 
31 namespace nuspell {
32 NUSPELL_BEGIN_INLINE_NAMESPACE
33 
37 class Dictionary_Loading_Error : public std::runtime_error {
38  public:
39  using std::runtime_error::runtime_error;
40 };
41 
45 class NUSPELL_EXPORT Dictionary : private Suggester {
46  [[deprecated]] Dictionary(std::istream& aff, std::istream& dic);
47 
48  public:
49  Dictionary();
50  auto load_aff_dic(std::istream& aff, std::istream& dic) -> void;
51  auto load_aff_dic(const std::filesystem::path& aff_path) -> void;
52 
57  auto load_aff_dic_internal(const std::filesystem::path& aff_path,
58  std::ostream& err_msg) -> void;
59 
60  [[deprecated]] auto static load_from_aff_dic(std::istream& aff,
61  std::istream& dic)
62  -> Dictionary;
63  [[deprecated]] auto static load_from_path(
64  const std::string& file_path_without_extension) -> Dictionary;
65  auto spell(std::string_view word) const -> bool;
66  auto suggest(std::string_view word, std::vector<std::string>& out) const
67  -> void;
68 };
69 
70 NUSPELL_END_INLINE_NAMESPACE
71 } // namespace nuspell
72 #endif // NUSPELL_DICTIONARY_HXX
The only important public exception.
Definition: dictionary.hxx:37
The only important public class.
Definition: dictionary.hxx:45
Library main namespace.
Definition: aff_data.cxx:33
Definition: suggester.hxx:27