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