BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
PathResolver.h
Go to the documentation of this file.
1#ifndef __PathResolver_h__
2#define __PathResolver_h__
3
4#include <string>
5
7{
8public:
9 typedef enum
10 {
15
16 typedef enum
17 {
21
22 /**
23
24 @arg @c logical_file_name the name of the file to locate in the search path
25 @arg @c search_path the name of a path-like environment variable
26 @arg @c search_type characterizes the type of search. Can be either @c LocalSearch or @c RecursiveSearch
27
28 @return the physical name of the located file or empty string if not found
29
30 */
31 static std::string find_file (const std::string& logical_file_name,
32 const std::string& search_path,
33 SearchType search_type = LocalSearch);
34
35 /**
36
37 @arg @c logical_file_name the name of the file to locate in the search path
38 @arg @c search_list the prioritized list of possible locations separated by the usual path separator
39 @arg @c search_type characterizes the type of search. Can be either @c LocalSearch or @c RecursiveSearch
40
41 @return the physical name of the located file or empty string if not found
42
43 */
44 static std::string find_file_from_list (const std::string& logical_file_name,
45 const std::string& search_list,
46 SearchType search_type = LocalSearch);
47
48 /**
49
50 @arg @c logical_file_name the name of the directory to locate in the search path
51 @arg @c search_path the name of a path-like environment variable
52 @arg @c search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
53
54 @return the physical name of the located directory or empty string if not found
55
56 */
57 static std::string find_directory (const std::string& logical_file_name,
58 const std::string& search_path,
59 SearchType search_type = LocalSearch);
60
61 /**
62
63 @arg @c logical_file_name the name of the directory to locate in the search path
64 @arg @c search_list the prioritized list of possible locations separated by the usual path separator
65 @arg @c search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
66
67 @return the physical name of the located directory or empty string if not found
68
69 */
70 static std::string find_directory_from_list (const std::string& logical_file_name,
71 const std::string& search_list,
72 SearchType search_type = LocalSearch);
73
74 /**
75
76 @arg @c search_path the name of a path-like environment variable
77
78 @return the result of the verification. Can be one of @c Ok, @c EnvironmentVariableUndefined, @c UnknownDirectory
79
80 */
81 static SearchPathStatus check_search_path (const std::string& search_path);
82};
83
84extern "C"
85{
86 PathResolver::SearchPathStatus PathResolverCheckSearchPath (const std::string& search_path);
87 std::string PathResolverFindDirectory (const std::string& logical_file_name,
88 const std::string& search_path);
89 std::string PathResolverFindDirectoryFromList (const std::string& logical_file_name,
90 const std::string& search_list);
91 std::string PathResolverFindFile (const std::string& logical_file_name,
92 const std::string& search_path);
93 std::string PathResolverFindFileFromList (const std::string& logical_file_name,
94 const std::string& search_list);
95 std::string PathResolverFindXMLFile (const std::string& logical_file_name);
96 std::string PathResolverFindDataFile (const std::string& logical_file_name);
97}
98
99#endif
std::string PathResolverFindDirectory(const std::string &logical_file_name, const std::string &search_path)
std::string PathResolverFindFile(const std::string &logical_file_name, const std::string &search_path)
std::string PathResolverFindDirectoryFromList(const std::string &logical_file_name, const std::string &search_list)
std::string PathResolverFindXMLFile(const std::string &logical_file_name)
std::string PathResolverFindFileFromList(const std::string &logical_file_name, const std::string &search_list)
std::string PathResolverFindDataFile(const std::string &logical_file_name)
PathResolver::SearchPathStatus PathResolverCheckSearchPath(const std::string &search_path)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
static std::string find_directory(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
static std::string find_directory_from_list(const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
@ EnvironmentVariableUndefined
Definition: PathResolver.h:12
static std::string find_file_from_list(const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
static SearchPathStatus check_search_path(const std::string &search_path)