| 1 | // |
| 2 | // File_UNIX.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Filesystem |
| 6 | // Module: File |
| 7 | // |
| 8 | // Definition of the FileImpl class for Unix. |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Foundation_File_UNIX_INCLUDED |
| 18 | #define Foundation_File_UNIX_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Foundation.h" |
| 22 | #include "Poco/Timestamp.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | |
| 27 | |
| 28 | class FileImpl |
| 29 | { |
| 30 | protected: |
| 31 | typedef UInt64 FileSizeImpl; |
| 32 | |
| 33 | FileImpl(); |
| 34 | FileImpl(const std::string& path); |
| 35 | virtual ~FileImpl(); |
| 36 | void swapImpl(FileImpl& file); |
| 37 | void setPathImpl(const std::string& path); |
| 38 | const std::string& getPathImpl() const; |
| 39 | bool existsImpl() const; |
| 40 | bool canReadImpl() const; |
| 41 | bool canWriteImpl() const; |
| 42 | bool canExecuteImpl() const; |
| 43 | bool isFileImpl() const; |
| 44 | bool isDirectoryImpl() const; |
| 45 | bool isLinkImpl() const; |
| 46 | bool isDeviceImpl() const; |
| 47 | bool isHiddenImpl() const; |
| 48 | Timestamp createdImpl() const; |
| 49 | Timestamp getLastModifiedImpl() const; |
| 50 | void setLastModifiedImpl(const Timestamp& ts); |
| 51 | FileSizeImpl getSizeImpl() const; |
| 52 | void setSizeImpl(FileSizeImpl size); |
| 53 | void setWriteableImpl(bool flag = true); |
| 54 | void setExecutableImpl(bool flag = true); |
| 55 | void copyToImpl(const std::string& path) const; |
| 56 | void renameToImpl(const std::string& path); |
| 57 | void removeImpl(); |
| 58 | bool createFileImpl(); |
| 59 | bool createDirectoryImpl(); |
| 60 | FileSizeImpl totalSpaceImpl() const; |
| 61 | FileSizeImpl usableSpaceImpl() const; |
| 62 | FileSizeImpl freeSpaceImpl() const; |
| 63 | static void handleLastErrorImpl(const std::string& path); |
| 64 | |
| 65 | private: |
| 66 | std::string _path; |
| 67 | |
| 68 | friend class DirectoryIteratorImpl; |
| 69 | friend class LinuxDirectoryWatcherStrategy; |
| 70 | friend class BSDDirectoryWatcherStrategy; |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | // |
| 75 | // inlines |
| 76 | // |
| 77 | inline const std::string& FileImpl::getPathImpl() const |
| 78 | { |
| 79 | return _path; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | } // namespace Poco |
| 84 | |
| 85 | |
| 86 | #endif // Foundation_File_UNIX_INCLUDED |
| 87 | |