| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DirSearchPath.h
Go to the documentation of this file.
1 #ifndef JOBOPTIONS_DIRSEARCHPATH_H
2 #define JOBOPTIONS_DIRSEARCHPATH_H
3
8 #include <list>
9 #include <functional> /* binary_function */
10 #include <string>
11 #include "boost/filesystem/path.hpp"
12 #include "boost/filesystem/exception.hpp" /*filesystem_error*/
13 #include "GaudiKernel/Kernel.h" /* GAUDI_API */
19 class GAUDI_API DirSearchPath {
20 public:
21 typedef boost::filesystem::path path;
22
24
25 DirSearchPath() { addCWD(); }
27 #ifdef _WIN32
28 DirSearchPath(const std::string& stringifiedPath, const char* separator=",;");
29 #else
30 DirSearchPath(const std::string& stringifiedPath, const char* separator=",:");
31 #endif
32
33
35
36 // bool add(const std::string& dirName); ///< \throws filesystem_error
37 bool add(const path& dir);
38 bool addCWD();
39
40
42
43
44
45 bool find(const std::string& fileName, std::string& fullFileName) const;
47 bool find(const path& file, path& fileFound) const;
49 std::list<path> find_all(const path& file) const;
51
52
54
55 static bool existsDir(const std::string& dirName);
56 static bool existsDir(const path& dir);
57
58
59 private:
60 //
62 struct eqPath : public std::unary_function<const path&,bool> {
63 eqPath(const path& ref) : m_ref(ref) {}
64 bool operator() (const path& p) const {
65 return p.string() == m_ref.string();
66 }
67 private:
68 path m_ref;
69 };
70 // @class lessPath order paths by (system-independent) name
71 //struct lessPath : public std::binary_function<const path&,const path&,bool> {
72 // bool operator() (const path& lhs, const path& rhs) const {
73 // return lhs.string() < rhs.string();
74 // }
75 //};
77
78 // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
79 // PathSet m_dirs; ///<the dir container
80 //
81 std::list<path> m_dirs;
82 };
83 #endif // JOBOPTIONS_DIRSEARCHPATH_H