File_WIN32.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // File_WIN32.h
  3. //
  4. // $Id: //poco/svn/Foundation/include/Poco/File_WIN32.h#3 $
  5. //
  6. // Library: Foundation
  7. // Package: Filesystem
  8. // Module: File
  9. //
  10. // Definition of the FileImpl class for WIN32.
  11. //
  12. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
  13. // and Contributors.
  14. //
  15. // Permission is hereby granted, free of charge, to any person or organization
  16. // obtaining a copy of the software and accompanying documentation covered by
  17. // this license (the "Software") to use, reproduce, display, distribute,
  18. // execute, and transmit the Software, and to prepare derivative works of the
  19. // Software, and to permit third-parties to whom the Software is furnished to
  20. // do so, all subject to the following:
  21. //
  22. // The copyright notices in the Software and this entire statement, including
  23. // the above license grant, this restriction and the following disclaimer,
  24. // must be included in all copies of the Software, in whole or in part, and
  25. // all derivative works of the Software, unless such copies or derivative
  26. // works are solely in the form of machine-executable object code generated by
  27. // a source language processor.
  28. //
  29. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  30. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  31. // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  32. // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  33. // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  34. // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  35. // DEALINGS IN THE SOFTWARE.
  36. //
  37. #ifndef Foundation_File_WIN32_INCLUDED
  38. #define Foundation_File_WIN32_INCLUDED
  39. #include "Poco/Foundation.h"
  40. #include "Poco/Timestamp.h"
  41. namespace Poco {
  42. class Foundation_API FileImpl
  43. {
  44. protected:
  45. typedef UInt64 FileSizeImpl;
  46. FileImpl();
  47. FileImpl(const std::string& path);
  48. virtual ~FileImpl();
  49. void swapImpl(FileImpl& file);
  50. void setPathImpl(const std::string& path);
  51. const std::string& getPathImpl() const;
  52. bool existsImpl() const;
  53. bool canReadImpl() const;
  54. bool canWriteImpl() const;
  55. bool canExecuteImpl() const;
  56. bool isFileImpl() const;
  57. bool isDirectoryImpl() const;
  58. bool isLinkImpl() const;
  59. bool isHiddenImpl() const;
  60. Timestamp createdImpl() const;
  61. Timestamp getLastModifiedImpl() const;
  62. void setLastModifiedImpl(const Timestamp& ts);
  63. FileSizeImpl getSizeImpl() const;
  64. void setSizeImpl(FileSizeImpl size);
  65. void setWriteableImpl(bool flag = true);
  66. void setExecutableImpl(bool flag = true);
  67. void copyToImpl(const std::string& path) const;
  68. void renameToImpl(const std::string& path);
  69. void removeImpl();
  70. bool createFileImpl();
  71. bool createDirectoryImpl();
  72. static void handleLastErrorImpl(const std::string& path);
  73. private:
  74. std::string _path;
  75. friend class FileHandle;
  76. friend class DirectoryIteratorImpl;
  77. };
  78. //
  79. // inlines
  80. //
  81. inline const std::string& FileImpl::getPathImpl() const
  82. {
  83. return _path;
  84. }
  85. } // namespace Poco
  86. #endif // Foundation_File_WIN32_INCLUDED