LibPkg
Classes | Public Types | Public Member Functions | List of all members
pkg::sprite_file Class Reference

An interface class to represent a sprite file. More...

#include <sprite_file.h>

Classes

class  already_exists
 An exception class for reporting already-exists errors. More...
 
class  corrupt
 An exception class for reporting corrupt-sprite-file errors. More...
 
class  not_found
 An exception class for reporting not-found errors. More...
 
class  sprite_info
 A class to represent a sprite within a sprite file. More...
 

Public Types

typedef unsigned long uint32
 A type to represent an unsigned 32-bit integer. More...
 

Public Member Functions

 sprite_file (const string &pathname, bool writable=false)
 Construct sprite file object. More...
 
 ~sprite_file ()
 Destroy sprite file object. More...
 
unsigned int size () const
 Get number of sprites. More...
 
const sprite_infooperator[] (unsigned int index) const
 Get const sprite information record at index. More...
 
const sprite_infofind (const string &name) const
 Find const sprite information record for sprite name. More...
 
void copy (sprite_file &src, const string &name)
 Copy sprite from another sprite file. More...
 

Detailed Description

An interface class to represent a sprite file.

Member Typedef Documentation

typedef unsigned long pkg::sprite_file::uint32

A type to represent an unsigned 32-bit integer.

Constructor & Destructor Documentation

pkg::sprite_file::sprite_file ( const string &  pathname,
bool  writable = false 
)

Construct sprite file object.

Parameters
pathnamethe pathname of the sprite file
writabletrue to open read-write, false to open read-only

References find(), and pkg::sprite_file::sprite_info::name().

pkg::sprite_file::~sprite_file ( )

Destroy sprite file object.

Member Function Documentation

unsigned int pkg::sprite_file::size ( ) const
inline

Get number of sprites.

Returns
the number of sprites
const sprite_info& pkg::sprite_file::operator[] ( unsigned int  index) const

Get const sprite information record at index.

Parameters
indexthe index
Returns
a const reference to the sprite information record
const sprite_file::sprite_info * pkg::sprite_file::find ( const string &  name) const

Find const sprite information record for sprite name.

Parameters
namethe sprite name
Returns
a const pointer to the sprite information record, or 0 if not found

Referenced by copy(), and sprite_file().

void pkg::sprite_file::copy ( sprite_file src,
const string &  name 
)

Copy sprite from another sprite file.

Parameters
srcthe sprite file containing the source
namethe sprite name

References find(), pkg::sprite_file::sprite_info::name(), pkg::sprite_file::sprite_info::offset(), and pkg::sprite_file::sprite_info::size().


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

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)