1 #ifndef IOUTILITIES_NATIVE_FILE_STREAM
2 #define IOUTILITIES_NATIVE_FILE_STREAM
6 #ifdef CPP_UTILITIES_USE_NATIVE_FILE_BUFFER
16 #ifdef CPP_UTILITIES_USE_NATIVE_FILE_BUFFER
20 #ifdef PLATFORM_WINDOWS
21 using Handle =
void *;
24 FileBuffer(std::basic_streambuf<char> *buffer);
25 FileBuffer(
const std::string &path, ios_base::openmode openMode);
26 FileBuffer(
int fileDescriptor, ios_base::openmode openMode);
28 std::unique_ptr<std::basic_streambuf<char>> buffer;
29 #ifdef PLATFORM_WINDOWS
30 Handle handle =
nullptr;
43 void open(
const std::string &path, std::ios_base::openmode openMode);
44 void open(
int fileDescriptor, std::ios_base::openmode openMode);
47 #ifdef PLATFORM_WINDOWS
49 static std::unique_ptr<wchar_t[]> makeWidePath(
const std::string &path);
53 void setData(FileBuffer data, std::ios_base::openmode openMode);
56 std::ios_base::openmode m_openMode;
74 open(fileDescriptor, openMode);
81 inline int NativeFileStream::fileDescriptor()
83 return m_data.descriptor;
86 #ifdef PLATFORM_WINDOWS
91 inline NativeFileStream::Handle NativeFileStream::fileHandle()
101 inline bool NativeFileStream::is_open()
const
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
Contains all utilities provides by the c++utilities library.
std::fstream NativeFileStream