| 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 linkToImpl(const std::string& path, int type) const; | 
|---|
| 58 | void removeImpl(); | 
|---|
| 59 | bool createFileImpl(); | 
|---|
| 60 | bool createDirectoryImpl(); | 
|---|
| 61 | FileSizeImpl totalSpaceImpl() const; | 
|---|
| 62 | FileSizeImpl usableSpaceImpl() const; | 
|---|
| 63 | FileSizeImpl freeSpaceImpl() const; | 
|---|
| 64 | static void handleLastErrorImpl(const std::string& path); | 
|---|
| 65 |  | 
|---|
| 66 | private: | 
|---|
| 67 | std::string _path; | 
|---|
| 68 |  | 
|---|
| 69 | friend class DirectoryIteratorImpl; | 
|---|
| 70 | friend class LinuxDirectoryWatcherStrategy; | 
|---|
| 71 | friend class BSDDirectoryWatcherStrategy; | 
|---|
| 72 | }; | 
|---|
| 73 |  | 
|---|
| 74 |  | 
|---|
| 75 | // | 
|---|
| 76 | // inlines | 
|---|
| 77 | // | 
|---|
| 78 | inline const std::string& FileImpl::getPathImpl() const | 
|---|
| 79 | { | 
|---|
| 80 | return _path; | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 |  | 
|---|
| 84 | } // namespace Poco | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | #endif // Foundation_File_UNIX_INCLUDED | 
|---|
| 88 |  | 
|---|