-
Notifications
You must be signed in to change notification settings - Fork 130
/
FileStream.h
65 lines (52 loc) · 1.9 KB
/
FileStream.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "trio/Defs.h"
#include "trio/Stream.h"
namespace trio {
/**
@brief Standard file stream.
*/
class TRIOAPI FileStream : public BoundedIOStream {
public:
/**
@brief Factory method for creation of a FileStream instance.
@param path
UTF-8 encoded path to file to be opened.
@param accessMode
Control whether the file is opened for reading or writing.
@param openMode
Control whether the file is opened in binary or textual mode.
@param memRes
The memory resource to be used for the allocation of the FileStream instance.
@note
If a custom memory resource is not given, a default allocation mechanism will be used.
@warning
User is responsible for releasing the returned pointer by calling destroy.
@see destroy
*/
static FileStream* create(const char* path, AccessMode accessMode, OpenMode openMode, MemoryResource* memRes = nullptr);
/**
@brief Method for freeing a FileStream instance.
@param instance
Instance of FileStream to be freed.
@see create
*/
static void destroy(FileStream* instance);
FileStream() = default;
~FileStream() override;
FileStream(const FileStream&) = delete;
FileStream& operator=(const FileStream&) = delete;
FileStream(FileStream&&) = default;
FileStream& operator=(FileStream&&) = default;
};
} // namespace trio
namespace pma {
template<>
struct DefaultInstanceCreator<trio::FileStream> {
using type = FactoryCreate<trio::FileStream>;
};
template<>
struct DefaultInstanceDestroyer<trio::FileStream> {
using type = FactoryDestroy<trio::FileStream>;
};
} // namespace pma