Gosu
Public Member Functions | List of all members
Gosu::Resource Class Referenceabstract

Base class for resources. More...

+ Inheritance diagram for Gosu::Resource:

Public Member Functions

 Resource ()
 
virtual ~Resource ()
 
Reader front_reader () const
 Convenience: Creates a new Reader that reads from the start of the resource. More...
 
Writer back_writer ()
 Convenience: Creates a new Writer that appends data at the end of the resource. More...
 
virtual std::size_t size () const =0
 
virtual void resize (std::size_t new_size)=0
 
virtual void read (std::size_t offset, std::size_t length, void *dest_buffer) const =0
 
virtual void write (std::size_t offset, std::size_t length, const void *source_buffer)=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 140 of file IO.hpp.

Constructor & Destructor Documentation

◆ Resource()

Gosu::Resource::Resource ( )

Definition at line 149 of file IO.hpp.

◆ ~Resource()

virtual Gosu::Resource::~Resource ( )
virtual

Definition at line 153 of file IO.hpp.

Member Function Documentation

◆ back_writer()

Writer Gosu::Resource::back_writer ( )

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

Definition at line 166 of file IO.hpp.

References Gosu::Reader::read().

◆ front_reader()

Reader Gosu::Resource::front_reader ( ) const

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

Definition at line 159 of file IO.hpp.

References Gosu::Reader::Reader().

◆ read()

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

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

◆ resize()

virtual void Gosu::Resource::resize ( std::size_t  new_size)
pure virtual

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

◆ size()

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

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

◆ write()

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

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


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