18#include <system_error>
22using namespace std::filesystem;
30#define WPI_kInvalidFile reinterpret_cast<fs::file_t>(-1)
33#define WPI_kInvalidFile -1
89 return OpenFlags(
unsigned(A) |
unsigned(B));
145 unsigned Mode = 0666) {
168 unsigned Mode = 0666) {
Definition MemoryBuffer.hpp:30
file_t OpenFileForReadWrite(const path &Path, std::error_code &EC, CreationDisposition Disp, OpenFlags Flags, unsigned Mode=0666)
Opens the file with the given name in a write-only or read-write mode, returning its open file descri...
Definition fs.hpp:166
std::fstream fstream
Definition fs.hpp:25
OpenFlags
Definition fs.hpp:63
@ F_Append
Definition fs.hpp:74
@ OF_Append
The file should be opened in append mode.
Definition fs.hpp:73
@ OF_ChildInherit
When a child process is launched, this file should remain open in the child process.
Definition fs.hpp:81
@ OF_None
Definition fs.hpp:64
@ OF_Text
The file should be opened in text mode on platforms that make this distinction.
Definition fs.hpp:69
@ F_Text
Definition fs.hpp:70
@ OF_Delete
Delete the file on close. Only makes a difference on windows.
Definition fs.hpp:77
@ F_None
Definition fs.hpp:65
@ OF_UpdateAtime
Force files Atime to be updated on access.
Definition fs.hpp:85
FileAccess
Definition fs.hpp:58
@ FA_Write
Definition fs.hpp:60
@ FA_Read
Definition fs.hpp:59
int FileToFd(file_t &F, std::error_code &EC, OpenFlags Flags)
Converts a file object to a file descriptor.
file_t OpenFileForWrite(const path &Path, std::error_code &EC, CreationDisposition Disp, OpenFlags Flags, unsigned Mode=0666)
Opens the file with the given name in a write-only or read-write mode, returning its open file descri...
Definition fs.hpp:143
CreationDisposition
Definition fs.hpp:36
@ CD_OpenExisting
CD_OpenExisting - When opening a file:
Definition fs.hpp:50
@ CD_CreateNew
CD_CreateNew - When opening a file:
Definition fs.hpp:45
@ CD_OpenAlways
CD_OpenAlways - When opening a file:
Definition fs.hpp:55
@ CD_CreateAlways
CD_CreateAlways - When opening a file:
Definition fs.hpp:40
int file_t
Definition MemoryBuffer.hpp:35
void CloseFile(file_t &F)
Closes the file object.
file_t OpenFileForRead(const path &Path, std::error_code &EC, OpenFlags Flags=OF_None)
Opens the file with the given name in a read-only mode, returning its open file descriptor.
std::ifstream ifstream
Definition fs.hpp:23
std::ofstream ofstream
Definition fs.hpp:24
OpenFlags operator|(OpenFlags A, OpenFlags B)
Definition fs.hpp:88
file_t OpenFile(const path &Path, std::error_code &EC, CreationDisposition Disp, FileAccess Access, OpenFlags Flags, unsigned Mode=0666)
Opens a file with the specified creation disposition, access mode, and flags and returns a platform-s...
OpenFlags & operator|=(OpenFlags &A, OpenFlags B)
Definition fs.hpp:92