161 static Sint64 StdSizeFuncWrapper(SDL_RWops* context);
162 static Sint64 StdSeekFuncWrapper(SDL_RWops* context, Sint64 offset,
int whence);
163 static size_t StdReadFuncWrapper(SDL_RWops* context,
void *ptr,
size_t size,
size_t maxnum);
164 static size_t StdWriteFuncWrapper(SDL_RWops* context,
const void *ptr,
size_t size,
size_t maxnum);
165 static int StdCloseFuncWrapper(SDL_RWops* context);
167 static Sint64 CustomSizeFuncWrapper(SDL_RWops* context);
168 static Sint64 CustomSeekFuncWrapper(SDL_RWops* context, Sint64 offset,
int whence);
169 static size_t CustomReadFuncWrapper(SDL_RWops* context,
void *ptr,
size_t size,
size_t maxnum);
170 static size_t CustomWriteFuncWrapper(SDL_RWops* context,
const void *ptr,
size_t size,
size_t maxnum);
171 static int CustomCloseFuncWrapper(SDL_RWops* context);
173 static RWops CheckedCreateStandardRWops(SDL_RWops* sdl_rwops,
const char* errmsg);
188 static RWops FromFP(FILE* file,
bool autoclose);
201 static RWops FromConstMem(
const void* mem,
int size);
214 static RWops FromMem(
void* mem,
int size);
227 static RWops FromFile(
const std::string& file,
const std::string& mode =
"rb");
235 explicit RWops(SDL_RWops* rwops);
283 rwops_ = SDL_AllocRW();
284 if (rwops_ ==
nullptr)
287 rwops_->size = CustomSizeFuncWrapper;
288 rwops_->seek = CustomSeekFuncWrapper;
289 rwops_->read = CustomReadFuncWrapper;
290 rwops_->write = CustomWriteFuncWrapper;
291 rwops_->close = CustomCloseFuncWrapper;
292 rwops_->type = 0x57524370;
294 rwops_->hidden.unknown.data1 =
static_cast<void*
>(
new C(std::move(custom_rwops)));
299 rwops_->hidden.unknown.data2 =
static_cast<void*
>(
this);
314 SDL_RWops* Get()
const;
338 size_t Read(
void* ptr,
size_t size,
size_t maxnum);
352 Sint64 Seek(Sint64 offset,
int whence);
366 size_t Write(
const void* ptr,
size_t size,
size_t num);
463 size_t WriteBE16(Uint16 value);
476 size_t WriteBE32(Uint32 value);
489 size_t WriteBE64(Uint64 value);
502 size_t WriteLE16(Uint16 value);
515 size_t WriteLE32(Uint32 value);
528 size_t WriteLE64(Uint64 value);