nuspell 5.1.7 Nuspell spellchecking library

Loading...
Searching...
No Matches
finder.hxx
Go to the documentation of this file.
1/* Copyright 2016-2024 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
23
24#ifndef NUSPELL_FINDER_HXX
25#define NUSPELL_FINDER_HXX
26
27#include "defines.hxx"
28#include "nuspell_export.h"
29
30#include <filesystem>
31#include <string>
32#include <utility>
33#include <vector>
34
35#ifdef _MSC_VER
36#define NUSPELL_MSVC_PRAGMA_WARNING(x) __pragma(warning(x))
37#else
38#define NUSPELL_MSVC_PRAGMA_WARNING(x)
39#endif
40NUSPELL_MSVC_PRAGMA_WARNING(push)
41NUSPELL_MSVC_PRAGMA_WARNING(disable : 4251)
42
43 namespace nuspell {
44NUSPELL_BEGIN_INLINE_NAMESPACE
45
46NUSPELL_EXPORT auto
47 append_default_dir_paths(std::vector<std::filesystem::path>& paths) -> void;
48NUSPELL_EXPORT auto
49 append_libreoffice_dir_paths(std::vector<std::filesystem::path>& paths) -> void;
50NUSPELL_EXPORT auto
51 search_dirs_for_one_dict(const std::vector<std::filesystem::path>& dir_paths,
52 const std::filesystem::path& dict_name_stem)
53 -> std::filesystem::path;
54NUSPELL_EXPORT auto
55 search_dirs_for_dicts(const std::vector<std::filesystem::path>& dir_paths,
56 std::vector<std::filesystem::path>& dict_list) -> void;
57NUSPELL_EXPORT auto search_default_dirs_for_dicts()
58 -> std::vector<std::filesystem::path>;
59
60NUSPELL_DEPRECATED_EXPORT
61 auto append_default_dir_paths(std::vector<std::string>& paths) -> void;
62
63NUSPELL_DEPRECATED_EXPORT auto
64 append_libreoffice_dir_paths(std::vector<std::string>& paths) -> void;
65
66NUSPELL_DEPRECATED_EXPORT auto search_dir_for_dicts(
67 const std::string& dir_path,
68 std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
69
70NUSPELL_DEPRECATED_EXPORT auto search_dirs_for_dicts(
71 const std::vector<std::string>& dir_paths,
72 std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
73
74NUSPELL_DEPRECATED_EXPORT auto search_default_dirs_for_dicts(
75 std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
76
77NUSPELL_DEPRECATED_EXPORT auto find_dictionary(
78 const std::vector<std::pair<std::string, std::string>>& dict_list,
79 const std::string& dict_name)
80 -> std::vector<std::pair<std::string, std::string>>::const_iterator;
81
88 class NUSPELL_DEPRECATED_EXPORT Dict_Finder_For_CLI_Tool {
89 std::vector<std::string> dir_paths;
90 std::vector<std::pair<std::string, std::string>> dict_multimap;
91
92 public:
93 Dict_Finder_For_CLI_Tool();
94 auto& get_dir_paths() const { return dir_paths; }
95 auto& get_dictionaries() const { return dict_multimap; }
96 auto get_dictionary_path(const std::string& dict) const -> std::string;
97};
98
105 class NUSPELL_EXPORT Dict_Finder_For_CLI_Tool_2 {
106 std::vector<std::filesystem::path> dir_paths;
107
108 public:
109 Dict_Finder_For_CLI_Tool_2();
110 auto& get_dir_paths() const { return dir_paths; }
111 auto get_dictionary_path(const std::filesystem::path& dict) const
112 -> std::filesystem::path;
113};
114
115NUSPELL_END_INLINE_NAMESPACE
116} // namespace nuspell
117NUSPELL_MSVC_PRAGMA_WARNING(pop)
118#endif // NUSPELL_FINDER_HXX
nuspell
Library main namespace.
Definition aff_data.cxx:33
nuspell::search_dirs_for_one_dict
auto search_dirs_for_one_dict(const vector< fs_path > &dir_paths, const fs_path &dict_name_stem) -> fs_path
Search the directories for only one dictionary.
Definition finder.cxx:264
nuspell::append_libreoffice_dir_paths
auto append_libreoffice_dir_paths(vector< fs_path > &paths) -> void
Append the paths of the LibreOffice's directories to be searched for dictionaries.
Definition finder.cxx:167
nuspell::search_dirs_for_dicts
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:316
nuspell::append_default_dir_paths
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:66
nuspell::search_default_dirs_for_dicts
auto search_default_dirs_for_dicts() -> vector< fs_path >
Search the default directories for dictionaries.
Definition finder.cxx:331