Gosu::Resource Class Reference

Base class for resources. More...

Inheritance diagram for Gosu::Resource:

Gosu::Buffer Gosu::File

List of all members.

Public Member Functions

virtual ~Resource ()
Reader frontReader () const
 Convenience: Creates a new Reader that reads from the start of the resource.
Writer backWriter ()
 Convenience: Creates a new Writer that appends data at the end of the resource.
virtual std::size_t size () const =0
virtual void resize (std::size_t newSize)=0
virtual void read (std::size_t offset, std::size_t length, void *destBuffer) const =0
virtual void write (std::size_t offset, std::size_t length, const void *sourceBuffer)=0


Detailed Description

Base class for resources.

A resource in Gosu is nothing more but a piece of binary data that can be read or written, for example files or simply areas of allocated memory. A resource always knows its size and can resize itself, thereby either truncating its content or allocating room for more data.

Definition at line 142 of file IO.hpp.


Constructor & Destructor Documentation

virtual Gosu::Resource::~Resource (  )  [virtual]

Definition at line 145 of file IO.hpp.


Member Function Documentation

Writer Gosu::Resource::backWriter (  ) 

Convenience: Creates a new Writer that appends data at the end of the resource.

Definition at line 158 of file IO.hpp.

References size().

Reader Gosu::Resource::frontReader (  )  const

Convenience: Creates a new Reader that reads from the start of the resource.

Definition at line 151 of file IO.hpp.

virtual void Gosu::Resource::read ( std::size_t  offset,
std::size_t  length,
void *  destBuffer 
) const [pure virtual]

Implemented in Gosu::Buffer, and Gosu::File.

virtual void Gosu::Resource::resize ( std::size_t  newSize  )  [pure virtual]

Implemented in Gosu::Buffer, and Gosu::File.

virtual std::size_t Gosu::Resource::size (  )  const [pure virtual]

Implemented in Gosu::Buffer, and Gosu::File.

Referenced by backWriter().

virtual void Gosu::Resource::write ( std::size_t  offset,
std::size_t  length,
const void *  sourceBuffer 
) [pure virtual]

Implemented in Gosu::Buffer, and Gosu::File.


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