Commit | Line | Data |
---|---|---|
bae7f79e ILT |
1 | // dirsearch.h -- directory searching for gold -*- C++ -*- |
2 | ||
3 | #ifndef GOLD_DIRSEARCH_H | |
4 | #define GOLD_DIRSEARCH_H | |
5 | ||
6 | #include <string> | |
7 | #include <list> | |
8 | ||
9 | #include "options.h" | |
10 | #include "workqueue.h" | |
11 | ||
12 | namespace gold | |
13 | { | |
14 | ||
15 | // A simple interface to manage directories to be searched for | |
16 | // libraries. | |
17 | ||
18 | class Dirsearch | |
19 | { | |
20 | public: | |
21 | Dirsearch(); | |
22 | ||
23 | // Add a directory to the search path. | |
24 | void | |
25 | add(Workqueue*, const char*); | |
26 | ||
27 | // Add a list of directories to the search path. | |
28 | void | |
29 | add(Workqueue*, const General_options::Dir_list&); | |
30 | ||
31 | // Search for a file, giving one or two names to search for (the | |
32 | // second one may be empty). Return a full path name for the file, | |
33 | // or the empty string if it could not be found. This may only be | |
34 | // called if the token is not blocked. | |
35 | std::string | |
36 | find(const std::string&, const std::string& n2 = std::string()) const; | |
37 | ||
38 | // Return a reference to the blocker token which controls access. | |
39 | const Task_token& | |
40 | token() const | |
41 | { return this->token_; } | |
42 | ||
43 | private: | |
44 | // We can not copy this class. | |
45 | Dirsearch(const Dirsearch&); | |
46 | Dirsearch& operator=(const Dirsearch&); | |
47 | ||
48 | // Directories to search. | |
49 | std::list<const char*> directories_; | |
50 | // Blocker token to control access from tasks. | |
51 | Task_token token_; | |
52 | }; | |
53 | ||
54 | } // End namespace gold. | |
55 | ||
56 | #endif // !defined(GOLD_DIRSEARCH_H) |