Nuspell
spellchecker
finder.hxx
Go to the documentation of this file.
1 /* Copyright 2016-2022 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_FINDER_HXX
25 #define NUSPELL_FINDER_HXX
26 
27 #include "nuspell_export.h"
28 
29 #include <filesystem>
30 #include <string>
31 #include <utility>
32 #include <vector>
33 
34 #ifdef _MSC_VER
35 #define NUSPELL_MSVC_PRAGMA_WARNING(x) __pragma(warning(x))
36 #else
37 #define NUSPELL_MSVC_PRAGMA_WARNING(x)
38 #endif
39 NUSPELL_MSVC_PRAGMA_WARNING(push)
40 NUSPELL_MSVC_PRAGMA_WARNING(disable : 4251)
41 
42 namespace nuspell {
43 inline namespace v5 {
44 
45 NUSPELL_EXPORT auto
46 append_default_dir_paths(std::vector<std::filesystem::path>& paths) -> void;
47 NUSPELL_EXPORT auto
48 append_libreoffice_dir_paths(std::vector<std::filesystem::path>& paths) -> void;
49 NUSPELL_EXPORT auto
50 search_dirs_for_one_dict(const std::vector<std::filesystem::path>& dir_paths,
51  const std::filesystem::path& dict_name_stem)
52  -> std::filesystem::path;
53 NUSPELL_EXPORT auto
54 search_dirs_for_dicts(const std::vector<std::filesystem::path>& dir_paths,
55  std::vector<std::filesystem::path>& dict_list) -> void;
56 NUSPELL_EXPORT auto search_default_dirs_for_dicts()
57  -> std::vector<std::filesystem::path>;
58 
59 NUSPELL_DEPRECATED_EXPORT
60 auto append_default_dir_paths(std::vector<std::string>& paths) -> void;
61 
62 NUSPELL_DEPRECATED_EXPORT auto
63 append_libreoffice_dir_paths(std::vector<std::string>& paths) -> void;
64 
65 NUSPELL_DEPRECATED_EXPORT auto search_dir_for_dicts(
66  const std::string& dir_path,
67  std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
68 
69 NUSPELL_DEPRECATED_EXPORT auto search_dirs_for_dicts(
70  const std::vector<std::string>& dir_paths,
71  std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
72 
73 NUSPELL_DEPRECATED_EXPORT auto search_default_dirs_for_dicts(
74  std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
75 
76 NUSPELL_DEPRECATED_EXPORT auto find_dictionary(
77  const std::vector<std::pair<std::string, std::string>>& dict_list,
78  const std::string& dict_name)
79  -> std::vector<std::pair<std::string, std::string>>::const_iterator;
80 
86 class NUSPELL_DEPRECATED_EXPORT Dict_Finder_For_CLI_Tool {
87  std::vector<std::string> dir_paths;
88  std::vector<std::pair<std::string, std::string>> dict_multimap;
89 
90  public:
92  auto& get_dir_paths() const { return dir_paths; }
93  auto& get_dictionaries() const { return dict_multimap; }
94  auto get_dictionary_path(const std::string& dict) const -> std::string;
95 };
96 
102 class NUSPELL_EXPORT Dict_Finder_For_CLI_Tool_2 {
103  using fs_path = std::filesystem::path;
104  std::vector<fs_path> dir_paths;
105 
106  public:
108  auto& get_dir_paths() const { return dir_paths; }
109  auto get_dictionary_path(const fs_path& dict) const -> fs_path;
110 };
111 
112 } // namespace v5
113 } // namespace nuspell
114 NUSPELL_MSVC_PRAGMA_WARNING(pop)
115 #endif // NUSPELL_FINDER_HXX
Don&#39;t use this except from Nuspell CLI tool.
Definition: finder.hxx:86
auto search_dirs_for_dicts(const vector< fs::path > &dir_paths, vector< fs::path > &dict_list) -> void
Search the directories for dictionaries.
Definition: finder.cxx:312
auto search_dirs_for_one_dict(const vector< fs::path > &dir_paths, const fs::path &dict_name_stem) -> fs::path
Serach the directories for only one dictionary.
Definition: finder.cxx:261
auto search_default_dirs_for_dicts() -> vector< fs::path >
Search the default directories for dictionaries.
Definition: finder.cxx:327
Library main namespace.
Definition: aff_data.cxx:33
auto append_libreoffice_dir_paths(vector< fs::path > &paths) -> void
Append the paths of the LibreOffice&#39;s directories to be searched for dictionaries.
Definition: finder.cxx:164
auto append_default_dir_paths(vector< fs::path > &paths) -> void
Append the paths of the default directories to be searched for dictionaries.
Definition: finder.cxx:63
Don&#39;t use this except from Nuspell CLI tool.
Definition: finder.hxx:102