File_UNIX.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #ifndef Foundation_File_UNIX_INCLUDED
  16. #define Foundation_File_UNIX_INCLUDED
  17. #include "Poco/Foundation.h"
  18. namespace Poco {
  19. class FileImpl
  20. {
  21. protected:
  22. typedef UInt64 FileSizeImpl;
  23. FileImpl();
  24. FileImpl(const std::string& path);
  25. virtual ~FileImpl();
  26. void swapImpl(FileImpl& file);
  27. void setPathImpl(const std::string& path);
  28. const std::string& getPathImpl() const;
  29. bool existsImpl() const;
  30. bool canReadImpl() const;
  31. bool canWriteImpl() const;
  32. bool canExecuteImpl() const;
  33. bool isFileImpl() const;
  34. bool isDirectoryImpl() const;
  35. bool isLinkImpl() const;
  36. bool isDeviceImpl() const;
  37. bool isHiddenImpl() const;
  38. Timestamp createdImpl() const;
  39. Timestamp getLastModifiedImpl() const;
  40. void setLastModifiedImpl(const Timestamp& ts);
  41. FileSizeImpl getSizeImpl() const;
  42. void setSizeImpl(FileSizeImpl size);
  43. void setWriteableImpl(bool flag = true);
  44. void setExecutableImpl(bool flag = true);
  45. void copyToImpl(const std::string& path) const;
  46. void renameToImpl(const std::string& path);
  47. void linkToImpl(const std::string& path, int type) const;
  48. void removeImpl();
  49. bool createFileImpl();
  50. bool createDirectoryImpl();
  51. FileSizeImpl totalSpaceImpl() const;
  52. FileSizeImpl usableSpaceImpl() const;
  53. FileSizeImpl freeSpaceImpl() const;
  54. static void handleLastErrorImpl(const std::string& path);
  55. private:
  56. std::string _path;
  57. friend class DirectoryIteratorImpl;
  58. friend class LinuxDirectoryWatcherStrategy;
  59. friend class BSDDirectoryWatcherStrategy;
  60. };
  61. //
  62. // inlines
  63. //
  64. inline const std::string& FileImpl::getPathImpl() const
  65. {
  66. return _path;
  67. }
  68. } // namespace Poco
  69. #endif // Foundation_File_UNIX_INCLUDED