FileManager v1.7.0
Manage access to files with async model
Loading...
Searching...
No Matches
WriteFileHandle.h
1#pragma once
2
3#include <functional>
4
5#include "FileHandle.h"
6
7namespace file_manager
8{
9 class Cache;
10
12 class FILE_MANAGER_API WriteFileHandle : public FileHandle
13 {
14 private:
15 class CachingBuffer : public std::filebuf
16 {
17 private:
18 Cache& cache;
19 std::filesystem::path filePath;
20 std::string cacheData;
21 bool isCachingAvailable;
22
23 private:
24 bool increaseCacheData();
25
26 public:
27 CachingBuffer(class Cache& cache, const std::filesystem::path& filePath, std::ios_base::openmode mode);
28
29 int sync() override;
30
31 ~CachingBuffer();
32 };
33
34 protected:
35 WriteFileHandle(const std::filesystem::path& filePath, std::ios_base::openmode mode = std::ios_base::out);
36
37 public:
40 void write(const std::string& data);
41
44 std::ostream& getStream();
45
46 virtual ~WriteFileHandle();
47
48 friend class FileManager;
49 };
50}
Files cache.
Definition Cache.h:19
Provides files accessing from multiple threads. Singleton.
Definition FileManager.h:25
Provides writing files.