summaryrefslogtreecommitdiff
path: root/src/search.h
blob: 1841978e8a5b268b40f5381a4f03d5bbd5441a12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- c++ -*-
// Distributed under the BSD 2-Clause License.
// See accompanying file LICENSE for details.
#pragma once

#include <filesystem>
#include <string>
#include <vector>

struct Settings;

//! Locate file (needle) in the provided search path list (haystack)
//! The provided settings is used to control verbosity during the search.
//! \returns a std::filesystem::path pointing to path in which file was found
//! - empty if not found.
std::filesystem::path findFile(const Settings& settings,
                               const std::string& needle,
                               const std::vector<std::string>& haystack);

//! Locate header (needle) in the provided search path list (haystack)
//! The provided settings is used to control verbosity during the search as well
//! as providing the search paths defaults for headers.
//! The argument provided haystack is prepended to the one supplied by settings.
//! \returns a std::filesystem::path pointing to path where the file was found
//! - empty if not found.
std::filesystem::path findHeader(const Settings& settings,
                                 const std::string& needle,
                                 const std::vector<std::string>& haystack);


std::vector<std::filesystem::path> findBasename(const Settings& settings,
                                                const std::string& needle,
                                                const std::vector<std::string>& haystack);

std::vector<std::filesystem::path> findLibrary(const Settings& settings,
                                               const std::string& needle,
                                               const std::vector<std::string>& haystack);