libSDL2pp
C++ bindings/wrapper for SDL2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL2pp::CustomRWops Class Referenceabstract

Base class for custom RWops. More...

#include <SDL2pp/RWops.hh>

Inheritance diagram for SDL2pp::CustomRWops:
SDL2pp::ContainerRWops< C > SDL2pp::StreamRWops< S >

Public Member Functions

virtual ~CustomRWops ()
 Destructor.
 
virtual Sint64 Size ()=0
 Get the size of the data stream.
 
virtual Sint64 Seek (Sint64 offset, int whence)=0
 Seek within the data stream.
 
virtual size_t Read (void *ptr, size_t size, size_t maxnum)=0
 Read from a data stream.
 
virtual size_t Write (const void *ptr, size_t size, size_t num)=0
 Write to a data stream.
 
virtual int Close ()=0
 Close data source.
 

Detailed Description

Base class for custom RWops.

Derive from this class and override 4 virtual methods used to Seek, Read, Write and Close the data stream. The derived class is expected to be moved-into RWops via RWops(C&& custom_rwops).

See also
SDL2pp::ContainerRWops, SDL2pp::StreamRWops

Constructor & Destructor Documentation

◆ ~CustomRWops()

virtual SDL2pp::CustomRWops::~CustomRWops ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Close()

virtual int SDL2pp::CustomRWops::Close ( )
pure virtual

Close data source.

Returns
0 on success or a negative error code on failure
See also
http://wiki.libsdl.org/SDL_RWclose

Implemented in SDL2pp::ContainerRWops< C >, and SDL2pp::StreamRWops< S >.

◆ Read()

virtual size_t SDL2pp::CustomRWops::Read ( void *  ptr,
size_t  size,
size_t  maxnum 
)
pure virtual

Read from a data stream.

Parameters
[in]ptrPointer to a buffer to read data into
[in]sizeSize of each object to read, in bytes
[in]maxnumMaximum number of objects to be read
Returns
Number of objects read, or 0 at error or end of file
See also
http://wiki.libsdl.org/SDL_RWread

Implemented in SDL2pp::ContainerRWops< C >, and SDL2pp::StreamRWops< S >.

◆ Seek()

virtual Sint64 SDL2pp::CustomRWops::Seek ( Sint64  offset,
int  whence 
)
pure virtual

Seek within the data stream.

Parameters
[in]offsetOffset in bytes, relative to whence location; can be negative
[in]whenceAny of RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
Returns
Final offset in the data stream after the seek or -1 on error
See also
http://wiki.libsdl.org/SDL_RWseek

Implemented in SDL2pp::ContainerRWops< C >, and SDL2pp::StreamRWops< S >.

◆ Size()

virtual Sint64 SDL2pp::CustomRWops::Size ( )
pure virtual

Get the size of the data stream.

Returns
Size of the data stream on success, -1 if unknown
See also
http://wiki.libsdl.org/SDL_RWsize

Implemented in SDL2pp::ContainerRWops< C >, and SDL2pp::StreamRWops< S >.

◆ Write()

virtual size_t SDL2pp::CustomRWops::Write ( const void *  ptr,
size_t  size,
size_t  num 
)
pure virtual

Write to a data stream.

Parameters
[in]ptrPointer to a buffer containing data to write
[in]sizeSize of each object to write, in bytes
[in]numMaximum number of objects to be write
Returns
Number of objects written, which will be less than num on error
See also
http://wiki.libsdl.org/SDL_RWwrite

Implemented in SDL2pp::ContainerRWops< C >, and SDL2pp::StreamRWops< S >.


The documentation for this class was generated from the following file: