| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# DirSearchPath.h

Go to the documentation of this file.

    00001 #ifndef JOBOPTIONS_DIRSEARCHPATH_H
    00002 #define JOBOPTIONS_DIRSEARCHPATH_H
    00003
    00008 #include <list>
    00009 #include <functional>  /* binary_function */
    00010 #include <string>
    00011 #include "boost/filesystem/path.hpp"
    00012 #include "boost/filesystem/exception.hpp" /*filesystem_error*/
    00013 #include "GaudiKernel/Kernel.h" /* GAUDI_API */
    00019 class GAUDI_API DirSearchPath {
    00020 public:
    00021   typedef boost::filesystem::path path;
    00022
    00024
    00025   DirSearchPath() { addCWD(); }
    00027 #ifdef _WIN32
    00028   DirSearchPath(const std::string& stringifiedPath, const char* separator=",;");
    00029 #else
    00030   DirSearchPath(const std::string& stringifiedPath, const char* separator=",:");
    00031 #endif
    00032
    00033
    00035
    00036   //  bool add(const std::string& dirName); ///< \throws filesystem_error
    00037   bool add(const path& dir);
    00038   bool addCWD();
    00039
    00040
    00042
    00043
    00044
    00045   bool find(const std::string& fileName, std::string& fullFileName) const;
    00047   bool find(const path& file, path& fileFound) const;
    00049   std::list<path> find_all(const path& file) const;
    00051
    00052
    00054
    00055   static bool existsDir(const std::string& dirName);
    00056   static bool existsDir(const path& dir);
    00057
    00058
    00059 private:
    00060   //
    00062   struct eqPath : public std::unary_function<const path&,bool> {
    00063     eqPath(const path& ref) : m_ref(ref) {}
    00064     bool operator() (const path& p) const {
    00065       return p.string() == m_ref.string();
    00066     }
    00067   private:
    00068     path m_ref;
    00069   };
    00070   // @class lessPath order paths by (system-independent) name
    00071   //struct lessPath : public std::binary_function<const path&,const path&,bool> {
    00072   // bool operator() (const path& lhs, const path& rhs) const {
    00073   //   return lhs.string() < rhs.string();
    00074   // }
    00075   //};
    00077
    00078   //  typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
    00079   //  PathSet m_dirs;   ///<the dir container
    00080   //
    00081   std::list<path> m_dirs;
    00082 };
    00083 #endif // JOBOPTIONS_DIRSEARCHPATH_H

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines