| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- File List
- File Members

# 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*/
    00018 class DirSearchPath {
    00019 public:
    00020   typedef boost::filesystem::path path;
    00021
    00023
    00024   DirSearchPath() { addCWD(); }
    00026 #ifdef _WIN32
    00027   DirSearchPath(const std::string& stringifiedPath, const char* separator=",;");
    00028 #else
    00029   DirSearchPath(const std::string& stringifiedPath, const char* separator=",:");
    00030 #endif
    00031
    00032
    00034
    00035   //  bool add(const std::string& dirName); ///< \throws filesystem_error
    00036   bool add(const path& dir);
    00037   bool addCWD();
    00038
    00039
    00041
    00042
    00043
    00044   bool find(const std::string& fileName, std::string& fullFileName) const;
    00046   bool find(const path& file, path& fileFound) const;
    00048   std::list<path> find_all(const path& file) const;
    00050
    00051
    00053
    00054   static bool existsDir(const std::string& dirName);
    00055   static bool existsDir(const path& dir);
    00056
    00057
    00058 private:
    00059   //
    00061   struct eqPath : public std::unary_function<const path&,bool> {
    00062     eqPath(const path& ref) : m_ref(ref) {}
    00063     bool operator() (const path& p) const {
    00064       return p.string() == m_ref.string();
    00065     }
    00066   private:
    00067     path m_ref;
    00068   };
    00069   // @class lessPath order paths by (system-independent) name
    00070   //struct lessPath : public std::binary_function<const path&,const path&,bool> {
    00071   // bool operator() (const path& lhs, const path& rhs) const {
    00072   //   return lhs.string() < rhs.string();
    00073   // }
    00074   //};
    00076
    00077   //  typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
    00078   //  PathSet m_dirs;   ///<the dir container
    00079   //
    00080   std::list<path> m_dirs;
    00081 };
    00082 #endif // JOBOPTIONS_DIRSEARCHPATH_H