summaryrefslogtreecommitdiff
path: root/src/core/file_sys/file.h
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2014-09-12 00:42:59 +0200
committerGravatar Emmanuel Gil Peyrot2014-09-17 14:35:45 +0000
commit9251f7e2f8dbb507f0846c680c6f2af155724e7a (patch)
treea546468995e6eb11d7d569f3e7df6c3fcf148e81 /src/core/file_sys/file.h
parentCommon: Rename the File namespace to FileUtil, to match the filename and prev... (diff)
downloadyuzu-9251f7e2f8dbb507f0846c680c6f2af155724e7a.tar.gz
yuzu-9251f7e2f8dbb507f0846c680c6f2af155724e7a.tar.xz
yuzu-9251f7e2f8dbb507f0846c680c6f2af155724e7a.zip
Core: Add a new File class, obtainable from an Archive, and a stub implementation.
Diffstat (limited to 'src/core/file_sys/file.h')
-rw-r--r--src/core/file_sys/file.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/core/file_sys/file.h b/src/core/file_sys/file.h
new file mode 100644
index 000000000..f7b009f5a
--- /dev/null
+++ b/src/core/file_sys/file.h
@@ -0,0 +1,53 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9#include "core/hle/kernel/kernel.h"
10
11////////////////////////////////////////////////////////////////////////////////////////////////////
12// FileSys namespace
13
14namespace FileSys {
15
16class File : NonCopyable {
17public:
18 File() { }
19 virtual ~File() { }
20
21 /**
22 * Read data from the file
23 * @param offset Offset in bytes to start reading data from
24 * @param length Length in bytes of data to read from file
25 * @param buffer Buffer to read data into
26 * @return Number of bytes read
27 */
28 virtual size_t Read(const u64 offset, const u32 length, u8* buffer) const = 0;
29
30 /**
31 * Write data to the file
32 * @param offset Offset in bytes to start writing data to
33 * @param length Length in bytes of data to write to file
34 * @param buffer Buffer to write data from
35 * @param flush The flush parameters (0 == do not flush)
36 * @return Number of bytes written
37 */
38 virtual size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const = 0;
39
40 /**
41 * Get the size of the file in bytes
42 * @return Size of the file in bytes
43 */
44 virtual size_t GetSize() const = 0;
45
46 /**
47 * Close the file
48 * @return true if the file closed correctly
49 */
50 virtual bool Close() const = 0;
51};
52
53} // namespace FileSys