Coverage Report

Created: 2026-10-28 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poco/Foundation/include/Poco/File_UNIX.h
Line
Count
Source
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
  enum Options
32
  {
33
    OPT_FAIL_ON_OVERWRITE_IMPL = 0x01
34
  };
35
36
  using FileSizeImpl = UInt64;
37
38
  FileImpl();
39
  FileImpl(const std::string& path);
40
  virtual ~FileImpl();
41
  void swapImpl(FileImpl& file);
42
  void setPathImpl(const std::string& path);
43
  [[nodiscard]] const std::string& getPathImpl() const;
44
  [[nodiscard]] std::string getExecutablePathImpl() const;
45
  [[nodiscard]] bool existsImpl() const;
46
  [[nodiscard]] bool canReadImpl() const;
47
  [[nodiscard]] bool canWriteImpl() const;
48
  [[nodiscard]] bool canExecuteImpl(const std::string& absolutePath) const;
49
  [[nodiscard]] bool isFileImpl() const;
50
  [[nodiscard]] bool isDirectoryImpl() const;
51
  [[nodiscard]] bool isLinkImpl() const;
52
  [[nodiscard]] bool isDeviceImpl() const;
53
  [[nodiscard]] bool isHiddenImpl() const;
54
  [[nodiscard]] Timestamp createdImpl() const;
55
  [[nodiscard]] Timestamp getLastModifiedImpl() const;
56
  void setLastModifiedImpl(const Timestamp& ts);
57
  [[nodiscard]] FileSizeImpl getSizeImpl() const;
58
  void setSizeImpl(FileSizeImpl size);
59
  void setWriteableImpl(bool flag = true);
60
  void setExecutableImpl(bool flag = true);
61
  void copyToImpl(const std::string& path, int options = 0) const;
62
  void renameToImpl(const std::string& path, int options = 0);
63
  void linkToImpl(const std::string& path, int type) const;
64
  void removeImpl();
65
  bool createFileImpl(bool createDirectories = false);
66
  bool createDirectoryImpl();
67
  [[nodiscard]] FileSizeImpl totalSpaceImpl() const;
68
  [[nodiscard]] FileSizeImpl usableSpaceImpl() const;
69
  [[nodiscard]] FileSizeImpl freeSpaceImpl() const;
70
  [[noreturn]] static void handleLastErrorImpl(int err, const std::string& path);
71
  [[noreturn]] static void handleLastErrorImpl(const std::string& path);
72
73
private:
74
  std::string _path;
75
76
  friend class DirectoryIteratorImpl;
77
  friend class LinuxDirectoryWatcherStrategy;
78
  friend class BSDDirectoryWatcherStrategy;
79
};
80
81
82
//
83
// inlines
84
//
85
inline const std::string& FileImpl::getPathImpl() const
86
102k
{
87
102k
  return _path;
88
102k
}
89
90
91
} // namespace Poco
92
93
94
#endif // Foundation_File_UNIX_INCLUDED