The Gaudi Framework  v30r3 (a5ef0a68)
DirSearchPath.h
Go to the documentation of this file.
1 #ifndef JOBOPTIONS_DIRSEARCHPATH_H
2 #define JOBOPTIONS_DIRSEARCHPATH_H
3 
7 #include "GaudiKernel/Kernel.h" /* GAUDI_API */
8 #include "boost/filesystem/exception.hpp" /*filesystem_error*/
9 #include "boost/filesystem/path.hpp"
10 #include <functional> /* binary_function */
11 #include <string>
12 #include <vector>
18 {
19 public:
21 
23 
24  DirSearchPath() { addCWD(); }
26 #ifdef _WIN32
27  DirSearchPath( const std::string& stringifiedPath, const char* separator = ",;" );
28 #else
29  DirSearchPath( const std::string& stringifiedPath, const char* separator = ",:" );
30 #endif
31 
32 
34 
35  // bool add(const std::string& dirName); ///< \throws filesystem_error
36  bool add( const path& dir );
37  bool addCWD();
38 
39 
41 
42  bool find( const std::string& fileName, std::string& fullFileName ) const;
46  bool find( const path& file, path& fileFound ) const;
48  std::list<path> find_all( const path& file ) const;
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 {
61  eqPath( const path& ref ) : m_ref( ref ) {}
62  bool operator()( const path& p ) const { return p.string() == m_ref.string(); }
63 
64  private:
65  path m_ref;
66  };
67  // @class lessPath order paths by (system-independent) name
68  // struct lessPath : public std::binary_function<const path&,const path&,bool> {
69  // bool operator() (const path& lhs, const path& rhs) const {
70  // return lhs.string() < rhs.string();
71  // }
72  //};
74 
75  // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
76  // PathSet m_dirs; ///<the dir container
77  //
79 };
80 #endif // JOBOPTIONS_DIRSEARCHPATH_H
search for files in a list of directories
Definition: DirSearchPath.h:17
boost::filesystem::path path
Definition: DirSearchPath.h:20
eqPath(const path &ref)
Definition: DirSearchPath.h:61
STL class.
std::vector< path > m_dirs
the dir container
Definition: DirSearchPath.h:78
STL class.
bool operator()(const path &p) const
Definition: DirSearchPath.h:62
#define GAUDI_API
Definition: Kernel.h:104