1 #if !defined(_BTK_RWOPS_HPP_) 2 #define _BTK_RWOPS_HPP_ 7 #include <SDL2/SDL_rwops.h> 12 RWops(SDL_RWops *r):fptr(r){};
19 SDL_RWops *
get()
const noexcept{
29 size_t write(
const void *buf,
size_t size,
size_t n){
30 return SDL_RWwrite(fptr,buf,size,n);
32 size_t read(
void *buf,
size_t size,
size_t n){
33 return SDL_RWread(fptr,buf,size,n);
36 return SDL_RWtell(fptr);
39 return SDL_RWsize(fptr);
41 size_t seek(Sint64 offset,
int whence){
42 return SDL_RWseek(fptr,offset,whence);
45 static RWops FromStdIstream(std::istream &);
46 static RWops FromStdOstream(std::ostream &);
47 static RWops FromStdFstream(std::fstream &);
48 static RWops FromFile(
const char *fname,
const char *modes);
49 static RWops FromFD(
int fd,
const char *modes);
62 Sint64 tellp()
const noexcept;
64 Sint64 seek(int64_t offset,
int whence);
66 size_t write(
const void *buf,
size_t num,
size_t n);
67 size_t read(
void *buf,
size_t num,
size_t n);
69 size_t size()
const noexcept{
70 return buf_ptr - buf_base;
72 size_t capcitity()
const noexcept{
73 return buf_end - buf_base;
91 #endif // _BTK_RWOPS_HPP_ This header include many useful containers.
Definition: async.hpp:7
BTKAPI void CreatePipe(RWops &r, RWops &w)
Create a two binary pipes.
Definition: rwops.cpp:365
PStream & operator<<(PStream &stream, std::string_view data)
Definition: popen.hpp:174