3#include "FileManager.h"
9 FileHandle::FileHandle(
const filesystem::path& filePath, ios_base::openmode mode) :
13 isNotifyOnDestruction(true)
18 FileHandle::FileHandle(FileHandle&& other)
noexcept
20 (*this) = move(other);
23 FileHandle& FileHandle::operator = (FileHandle&& other)
noexcept
25 filePath = move(other.filePath);
26 file = move(other.file);
29 isNotifyOnDestruction = other.isNotifyOnDestruction;
31 other.isNotifyOnDestruction = !other.isNotifyOnDestruction;
36 uint64_t FileHandle::getFileSize()
const
38 return filesystem::file_size(filePath);
41 const filesystem::path& FileHandle::getPathToFile()
const
46 filesystem::path FileHandle::getFileName()
const
48 return filePath.filename();
51 FileHandle::~FileHandle()
53 if (isNotifyOnDestruction)
57 FileManager::getInstance().notify(move(filePath));