summaryrefslogtreecommitdiff
path: root/src/core/file_sys/file.h
diff options
context:
space:
mode:
authorGravatar bunnei2014-09-18 22:27:06 -0400
committerGravatar bunnei2014-09-18 22:27:06 -0400
commita9630a9d2b432bea7bdfef4aa462035b98b34517 (patch)
tree258010943e989fc61a2a439ff15ead7ed3d11a6f /src/core/file_sys/file.h
parentMerge pull request #107 from lioncash/sprintf (diff)
parentKernel: Implement the Close command for Archive, File and Directory. (diff)
downloadyuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.gz
yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.xz
yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.zip
Merge pull request #70 from linkmauve/master
Implement filesystem services, and the required kernel objects.
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