Elements  6.2
A C++ base framework for the Euclid Software.
PathSearch.h
Go to the documentation of this file.
1 
26 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_PATHSEARCH_H_
27 #define ELEMENTSKERNEL_ELEMENTSKERNEL_PATHSEARCH_H_
28 
29 #include <string>
30 #include <vector>
31 
32 #include "ElementsKernel/Export.h" // ELEMENTS_API
33 #include "ElementsKernel/Path.h" // for Path::Item
34 
35 namespace Elements {
36 inline namespace Kernel {
37 
38 enum class SearchType { Local, Recursive };
39 
58 template <typename T>
59 ELEMENTS_API std::vector<T> pathSearch(const std::string& searched_name, T directory, SearchType search_type);
60 
61 // template instantiations of the most common types
62 extern template ELEMENTS_API std::vector<Path::Item> pathSearch(const std::string& searched_name, Path::Item directory,
63  SearchType search_type);
64 extern template ELEMENTS_API std::vector<std::string> pathSearch(const std::string& searched_name,
65  std::string directory, SearchType search_type);
66 
85 std::vector<Path::Item> pathSearchInEnvVariable(const std::string& file_name, const std::string& path_like_env_variable,
86  SearchType search_type = SearchType::Recursive);
87 } // namespace Kernel
88 } // namespace Elements
89 
90 #define ELEMENTSKERNEL_ELEMENTSKERNEL_PATHSEARCH_IMPL_
92 #undef ELEMENTSKERNEL_ELEMENTSKERNEL_PATHSEARCH_IMPL_
93 
94 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_PATHSEARCH_H_
95 
Elements::Kernel::Path::Item
boost::filesystem::path Item
Definition: Path.h:56
Export.h
defines the macros to be used for explicit export of the symbols
std::string
STL class.
Elements::Kernel::SearchType
SearchType
Definition: PathSearch.h:38
Path.h
provide functions to retrieve resources pointed by environment variables
std::vector
STL class.
Elements::Kernel::SearchType::Local
@ Local
Elements::Kernel::pathSearchInEnvVariable
ELEMENTS_API std::vector< Path::Item > pathSearchInEnvVariable(const std::string &file_name, const std::string &path_like_env_variable, SearchType search_type=SearchType::Recursive)
Searches for a file or a directory in a path pointed by an environment variable. It can contains coll...
Definition: PathSearch.cpp:68
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
Elements::Kernel::SearchType::Recursive
@ Recursive
PathSearch.tpp
Elements::Kernel::pathSearch
ELEMENTS_API std::vector< T > pathSearch(const std::string &searched_name, T directory, SearchType search_type)
Searches for a file or a directory in a directory. The search can be recursive (SearchType....
Elements
Definition: callBackExample.h:35