2012-04-29 20:52:25 +02:00
|
|
|
//
|
|
|
|
// File_WIN32U.h
|
|
|
|
//
|
|
|
|
// Library: Foundation
|
|
|
|
// Package: Filesystem
|
|
|
|
// Module: File
|
|
|
|
//
|
|
|
|
// Definition of the Unicode FileImpl class for WIN32.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
|
|
// and Contributors.
|
|
|
|
//
|
2014-05-04 21:02:42 +02:00
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2012-04-29 20:52:25 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef Foundation_File_WIN32U_INCLUDED
|
|
|
|
#define Foundation_File_WIN32U_INCLUDED
|
|
|
|
|
|
|
|
|
|
|
|
#include "Poco/Foundation.h"
|
|
|
|
#include "Poco/Timestamp.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Poco {
|
|
|
|
|
|
|
|
|
|
|
|
class Foundation_API FileImpl
|
|
|
|
{
|
|
|
|
protected:
|
2022-07-07 11:18:20 +02:00
|
|
|
enum Options
|
2020-01-09 10:08:09 +01:00
|
|
|
{
|
2019-11-27 14:44:55 +01:00
|
|
|
OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
|
|
|
|
};
|
|
|
|
|
2024-07-29 20:16:18 +02:00
|
|
|
using FileSizeImpl = UInt64;
|
2012-04-29 20:52:25 +02:00
|
|
|
|
|
|
|
FileImpl();
|
|
|
|
FileImpl(const std::string& path);
|
|
|
|
virtual ~FileImpl();
|
|
|
|
void swapImpl(FileImpl& file);
|
|
|
|
void setPathImpl(const std::string& path);
|
|
|
|
const std::string& getPathImpl() const;
|
2024-07-29 20:16:18 +02:00
|
|
|
std::string getExecutablePathImpl() const;
|
2012-04-29 20:52:25 +02:00
|
|
|
bool existsImpl() const;
|
|
|
|
bool canReadImpl() const;
|
|
|
|
bool canWriteImpl() const;
|
2024-07-29 20:16:18 +02:00
|
|
|
bool canExecuteImpl(const std::string& absolutePath) const;
|
2012-04-29 20:52:25 +02:00
|
|
|
bool isFileImpl() const;
|
|
|
|
bool isDirectoryImpl() const;
|
|
|
|
bool isLinkImpl() const;
|
|
|
|
bool isDeviceImpl() const;
|
|
|
|
bool isHiddenImpl() const;
|
|
|
|
Timestamp createdImpl() const;
|
|
|
|
Timestamp getLastModifiedImpl() const;
|
|
|
|
void setLastModifiedImpl(const Timestamp& ts);
|
|
|
|
FileSizeImpl getSizeImpl() const;
|
|
|
|
void setSizeImpl(FileSizeImpl size);
|
2017-12-14 10:35:07 +01:00
|
|
|
void setWriteableImpl(bool flag = true);
|
|
|
|
void setExecutableImpl(bool flag = true);
|
2019-11-26 13:03:43 +01:00
|
|
|
void copyToImpl(const std::string& path, int options = 0) const;
|
|
|
|
void renameToImpl(const std::string& path, int options = 0);
|
2017-12-14 10:35:07 +01:00
|
|
|
void linkToImpl(const std::string& path, int type) const;
|
2012-04-29 20:52:25 +02:00
|
|
|
void removeImpl();
|
|
|
|
bool createFileImpl();
|
|
|
|
bool createDirectoryImpl();
|
2018-03-06 18:46:48 +01:00
|
|
|
FileSizeImpl totalSpaceImpl() const;
|
|
|
|
FileSizeImpl usableSpaceImpl() const;
|
|
|
|
FileSizeImpl freeSpaceImpl() const;
|
2012-04-29 20:52:25 +02:00
|
|
|
static void handleLastErrorImpl(const std::string& path);
|
2017-02-02 20:54:59 +01:00
|
|
|
static void convertPath(const std::string& utf8Path, std::wstring& utf16Path);
|
2017-12-14 10:35:07 +01:00
|
|
|
|
2012-04-29 20:52:25 +02:00
|
|
|
private:
|
|
|
|
std::string _path;
|
|
|
|
std::wstring _upath;
|
2017-12-14 10:35:07 +01:00
|
|
|
|
2012-04-29 20:52:25 +02:00
|
|
|
friend class FileHandle;
|
|
|
|
friend class DirectoryIteratorImpl;
|
2012-08-26 05:40:12 +02:00
|
|
|
friend class WindowsDirectoryWatcherStrategy;
|
2017-02-02 20:54:59 +01:00
|
|
|
friend class FileStreamBuf;
|
|
|
|
friend class LogFileImpl;
|
2012-04-29 20:52:25 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// inlines
|
|
|
|
//
|
|
|
|
inline const std::string& FileImpl::getPathImpl() const
|
|
|
|
{
|
|
|
|
return _path;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Poco
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Foundation_File_WIN32U_INCLUDED
|