mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 04:17:55 +01:00
added Poco::File::linkTo()
This commit is contained in:
@@ -63,6 +63,13 @@ class Foundation_API File: private FileImpl
|
||||
public:
|
||||
typedef FileSizeImpl FileSize;
|
||||
|
||||
enum LinkType
|
||||
/// Type of link for linkTo().
|
||||
{
|
||||
LINK_HARD = 0, /// hard link
|
||||
LINK_SYMBOLIC = 1 /// symbolic link
|
||||
};
|
||||
|
||||
File();
|
||||
/// Creates the file.
|
||||
|
||||
@@ -189,6 +196,14 @@ public:
|
||||
void renameTo(const std::string& path);
|
||||
/// Renames the file to the new name.
|
||||
|
||||
void linkTo(const std::string& path, LinkType type = LINK_SYMBOLIC) const;
|
||||
/// Creates a link (symbolic or hard, depending on type argument)
|
||||
/// at the given path to the file or directory.
|
||||
///
|
||||
/// May not be supported on all platforms.
|
||||
/// Furthermore, some operating systems do not allow creating
|
||||
/// hard links to directories.
|
||||
|
||||
void remove(bool recursive = false);
|
||||
/// Deletes the file. If recursive is true and the
|
||||
/// file is a directory, recursively deletes all
|
||||
|
||||
@@ -49,18 +49,19 @@ protected:
|
||||
void setLastModifiedImpl(const Timestamp& ts);
|
||||
FileSizeImpl getSizeImpl() const;
|
||||
void setSizeImpl(FileSizeImpl size);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void copyToImpl(const std::string& path) const;
|
||||
void renameToImpl(const std::string& path);
|
||||
void linkToImpl(const std::string& path, int type) const;
|
||||
void removeImpl();
|
||||
bool createFileImpl();
|
||||
bool createDirectoryImpl();
|
||||
static void handleLastErrorImpl(const std::string& path);
|
||||
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
|
||||
|
||||
friend class DirectoryIteratorImpl;
|
||||
friend class LinuxDirectoryWatcherStrategy;
|
||||
friend class BSDDirectoryWatcherStrategy;
|
||||
|
||||
@@ -49,18 +49,19 @@ protected:
|
||||
void setLastModifiedImpl(const Timestamp& ts);
|
||||
FileSizeImpl getSizeImpl() const;
|
||||
void setSizeImpl(FileSizeImpl size);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void copyToImpl(const std::string& path) const;
|
||||
void renameToImpl(const std::string& path);
|
||||
void linkToImpl(const std::string& path, int type) const;
|
||||
void removeImpl();
|
||||
bool createFileImpl();
|
||||
bool createDirectoryImpl();
|
||||
static void handleLastErrorImpl(const std::string& path);
|
||||
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
|
||||
|
||||
friend class DirectoryIteratorImpl;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,18 +50,19 @@ protected:
|
||||
void setLastModifiedImpl(const Timestamp& ts);
|
||||
FileSizeImpl getSizeImpl() const;
|
||||
void setSizeImpl(FileSizeImpl size);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void copyToImpl(const std::string& path) const;
|
||||
void renameToImpl(const std::string& path);
|
||||
void linkToImpl(const std::string& path, int type) const;
|
||||
void removeImpl();
|
||||
bool createFileImpl();
|
||||
bool createDirectoryImpl();
|
||||
static void handleLastErrorImpl(const std::string& path);
|
||||
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
|
||||
|
||||
friend class FileHandle;
|
||||
friend class DirectoryIteratorImpl;
|
||||
friend class WindowsDirectoryWatcherStrategy;
|
||||
|
||||
@@ -50,20 +50,21 @@ protected:
|
||||
void setLastModifiedImpl(const Timestamp& ts);
|
||||
FileSizeImpl getSizeImpl() const;
|
||||
void setSizeImpl(FileSizeImpl size);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void copyToImpl(const std::string& path) const;
|
||||
void renameToImpl(const std::string& path);
|
||||
void linkToImpl(const std::string& path, int type) const;
|
||||
void removeImpl();
|
||||
bool createFileImpl();
|
||||
bool createDirectoryImpl();
|
||||
static void handleLastErrorImpl(const std::string& path);
|
||||
static void convertPath(const std::string& utf8Path, std::wstring& utf16Path);
|
||||
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
std::wstring _upath;
|
||||
|
||||
|
||||
friend class FileHandle;
|
||||
friend class DirectoryIteratorImpl;
|
||||
friend class WindowsDirectoryWatcherStrategy;
|
||||
|
||||
@@ -50,20 +50,21 @@ protected:
|
||||
void setLastModifiedImpl(const Timestamp& ts);
|
||||
FileSizeImpl getSizeImpl() const;
|
||||
void setSizeImpl(FileSizeImpl size);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void setWriteableImpl(bool flag = true);
|
||||
void setExecutableImpl(bool flag = true);
|
||||
void copyToImpl(const std::string& path) const;
|
||||
void renameToImpl(const std::string& path);
|
||||
void linkToImpl(const std::string& path, int type) const;
|
||||
void removeImpl();
|
||||
bool createFileImpl();
|
||||
bool createDirectoryImpl();
|
||||
static void handleLastErrorImpl(const std::string& path);
|
||||
static void convertPath(const std::string& utf8Path, std::wstring& utf16Path);
|
||||
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
std::wstring _upath;
|
||||
|
||||
|
||||
friend class FileHandle;
|
||||
friend class DirectoryIteratorImpl;
|
||||
friend class FileStreamBuf;
|
||||
|
||||
Reference in New Issue
Block a user