Nuspell
spell checker
Loading...
Searching...
No Matches
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
23
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
39NUSPELL_MSVC_PRAGMA_WARNING(push)
40NUSPELL_MSVC_PRAGMA_WARNING(disable : 4251)
41
42namespace nuspell {
43inline namespace v5 {
44
45NUSPELL_EXPORT auto
46append_default_dir_paths(std::vector<std::filesystem::path>& paths) -> void;
47NUSPELL_EXPORT auto
48append_libreoffice_dir_paths(std::vector<std::filesystem::path>& paths) -> void;
49NUSPELL_EXPORT auto
50search_dirs_for_one_dict(const std::vector<std::filesystem::path>& dir_paths,
51 const std::filesystem::path& dict_name_stem)
52 -> std::filesystem::path;
53NUSPELL_EXPORT auto
54search_dirs_for_dicts(const std::vector<std::filesystem::path>& dir_paths,
55 std::vector<std::filesystem::path>& dict_list) -> void;
56NUSPELL_EXPORT auto search_default_dirs_for_dicts()
57 -> std::vector<std::filesystem::path>;
58
59NUSPELL_DEPRECATED_EXPORT
60auto append_default_dir_paths(std::vector<std::string>& paths) -> void;
61
62NUSPELL_DEPRECATED_EXPORT auto
63append_libreoffice_dir_paths(std::vector<std::string>& paths) -> void;
64
65NUSPELL_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
69NUSPELL_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
73NUSPELL_DEPRECATED_EXPORT auto search_default_dirs_for_dicts(
74 std::vector<std::pair<std::string, std::string>>& dict_list) -> void;
75
76NUSPELL_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
86class 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
102class 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
114NUSPELL_MSVC_PRAGMA_WARNING(pop)
115#endif // NUSPELL_FINDER_HXX
Don't use this except from Nuspell CLI tool.
Definition finder.hxx:102
Don't use this except from Nuspell CLI tool.
Definition finder.hxx:86
Library main namespace with version number attached.
Definition aff_data.cxx:42
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:164
auto search_default_dirs_for_dicts() -> vector< fs::path >
Search the default directories for dictionaries.
Definition finder.cxx:327
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
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
Library main namespace.
Definition aff_data.cxx:33