Files
Sourcetrail/src/lib/utility/file/FilePath.h
T
Andreas Stallinger 251eab6e9e ui: prefill headers from compilation database
dialog for selecting header paths from compilation database
2016-08-31 14:37:28 +02:00

55 lines
1.3 KiB
C++

#ifndef FILE_PATH_H
#define FILE_PATH_H
#include <string>
#include "boost/filesystem.hpp"
class FilePath
{
public:
FilePath();
FilePath(const char* filePath);
FilePath(const std::string& filePath);
FilePath(const boost::filesystem::path& filePath);
FilePath(const std::string& filePath, const std::string& base);
boost::filesystem::path path() const;
bool empty() const;
bool exists() const;
bool isDirectory() const;
bool isAbsolute() const;
FilePath parentDirectory() const;
FilePath absolute() const;
FilePath canonical() const;
FilePath relativeTo(const FilePath& other) const;
FilePath concat(const FilePath& other) const;
FilePath expandEnvironmentVariables() const;
bool contains(const FilePath& other) const;
std::string str() const;
std::string getBackslashedString() const;
std::string fileName() const;
std::string extension() const;
FilePath withoutExtension() const;
FilePath replaceExtension(const std::string& extension) const;
bool hasExtension(const std::vector<std::string>& extensions) const;
bool operator==(const FilePath& other) const;
bool operator!=(const FilePath& other) const;
bool operator<(const FilePath& other) const;
private:
boost::filesystem::path m_path;
mutable bool m_exists;
mutable bool m_checkedExists;
};
#endif // FILE_PATH_H