SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLIONative.h
Go to the documentation of this file.
1 /**
2  * \file SLIONative.h
3  * \date October 2022
4  * \authors Marino von Wattenwyl
5  * \copyright http://opensource.org/licenses/GPL-3.0
6  * \remarks Please use clangformat to format the code. See more code style on
7  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8 */
9 
10 #ifndef SLPROJECT_SLIONATIVE_H
11 #define SLPROJECT_SLIONATIVE_H
12 
13 #include <SLFileStorage.h>
14 
15 #ifdef SL_STORAGE_FS
16 //! SLIOStream implementation for reading from native files
17 //-----------------------------------------------------------------------------
19 {
20 public:
21  SLIOReaderNative(std::string path);
22  size_t read(void* buffer, size_t size);
23  size_t tell();
24  bool seek(size_t offset, Origin origin);
25  size_t size();
26 
27 private:
28  std::ifstream _stream;
29 };
30 //-----------------------------------------------------------------------------
31 //! SLIOStream implementation for writing to native files
33 {
34 public:
35  SLIOWriterNative(std::string path);
36  size_t write(const void* buffer, size_t size);
37  size_t tell();
38  bool seek(size_t offset, Origin origin);
39  void flush();
40 
41 private:
42  std::ofstream _stream;
43 };
44 //-----------------------------------------------------------------------------
45 #endif
46 
47 #endif // SLPROJECT_SLIONATIVE_H
SLIOStream implementation for reading from native files.
Definition: SLIONative.h:19
SLIOReaderNative(std::string path)
Definition: SLIONative.cpp:14
bool seek(size_t offset, Origin origin)
Definition: SLIONative.cpp:31
size_t read(void *buffer, size_t size)
Definition: SLIONative.cpp:20
std::ifstream _stream
Definition: SLIONative.h:28
Interface for accessing external data using streams.
Definition: SLFileStorage.h:62
virtual size_t size()
Definition: SLFileStorage.h:76
SLIOStream implementation for writing to native files.
Definition: SLIONative.h:33
size_t write(const void *buffer, size_t size)
Definition: SLIONative.cpp:58
std::ofstream _stream
Definition: SLIONative.h:42
bool seek(size_t offset, Origin origin)
Definition: SLIONative.cpp:71
SLIOWriterNative(std::string path)
Definition: SLIONative.cpp:53