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 */
20 public:
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  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:
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
search for files in a list of directories
Definition: DirSearchPath.h:19
std::list< path > m_dirs
the dir container
Definition: DirSearchPath.h:81
boost::filesystem::path path
Definition: DirSearchPath.h:21
eqPath(const path &ref)
Definition: DirSearchPath.h:63
list file
Definition: ana.py:160
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
#define GAUDI_API
Definition: Kernel.h:108