Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DirSearchPath.h
Go to the documentation of this file.
1 #ifndef JOBOPTIONS_DIRSEARCHPATH_H
2 #define JOBOPTIONS_DIRSEARCHPATH_H
3 
7 #include <vector>
8 #include <functional> /* binary_function */
9 #include <string>
10 #include "boost/filesystem/path.hpp"
11 #include "boost/filesystem/exception.hpp" /*filesystem_error*/
12 #include "GaudiKernel/Kernel.h" /* GAUDI_API */
18 public:
20 
22 
23  DirSearchPath() { addCWD(); }
25 #ifdef _WIN32
26  DirSearchPath(const std::string& stringifiedPath, const char* separator=",;");
27 #else
28  DirSearchPath(const std::string& stringifiedPath, const char* separator=",:");
29 #endif
30 
31 
33 
34  // bool add(const std::string& dirName); ///< \throws filesystem_error
35  bool add(const path& dir);
36  bool addCWD();
37 
38 
40 
41  bool find(const std::string& fileName, std::string& fullFileName) const;
45  bool find(const path& file, path& fileFound) const;
47  std::list<path> find_all(const path& file) const;
49 
50 
52 
53  static bool existsDir(const std::string& dirName);
54  static bool existsDir(const path& dir);
55 
56 
57 private:
58  //
60  struct eqPath : public std::unary_function<const path&,bool> {
61  eqPath(const path& ref) : m_ref(ref) {}
62  bool operator() (const path& p) const {
63  return p.string() == m_ref.string();
64  }
65  private:
66  path m_ref;
67  };
68  // @class lessPath order paths by (system-independent) name
69  //struct lessPath : public std::binary_function<const path&,const path&,bool> {
70  // bool operator() (const path& lhs, const path& rhs) const {
71  // return lhs.string() < rhs.string();
72  // }
73  //};
75 
76  // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
77  // PathSet m_dirs; ///<the dir container
78  //
80 };
81 #endif // JOBOPTIONS_DIRSEARCHPATH_H
search for files in a list of directories
Definition: DirSearchPath.h:17
boost::filesystem::path path
Definition: DirSearchPath.h:19
eqPath(const path &ref)
Definition: DirSearchPath.h:61
STL class.
std::vector< path > m_dirs
the dir container
Definition: DirSearchPath.h:79
STL class.
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
#define GAUDI_API
Definition: Kernel.h:107