6 #ifndef LIBPKG_SPRITE_FILE
7 #define LIBPKG_SPRITE_FILE
25 typedef unsigned long uint32;
40 bool operator()(
const string& lhs,
const string& rhs)
const;
44 typedef std::map<string,sprite_info,cmp_nocase> map_type;
47 typedef map_type::const_iterator const_iterator;
53 mutable std::fstream _sfs;
65 sprite_file(
const string& pathname,
bool writable=
false);
86 {
return _directory.size(); }
92 const sprite_info&
operator[](
unsigned int index)
const;
99 const sprite_info*
find(
const string& name)
const;
153 public std::runtime_error
170 public std::runtime_error
187 public std::runtime_error
corrupt()
Construct corrupt-sprite-file error.
Definition: sprite_file.cc:251
sprite_file(const string &pathname, bool writable=false)
Construct sprite file object.
Definition: sprite_file.cc:127
const uint32 offset() const
Get file offset.
Definition: sprite_file.h:135
void copy(sprite_file &src, const string &name)
Copy sprite from another sprite file.
Definition: sprite_file.cc:156
static string make_message(const string &name)
Make error message.
Definition: sprite_file.cc:227
const uint32 size() const
Get size.
Definition: sprite_file.h:141
An interface class to represent a sprite file.
Definition: sprite_file.h:19
const sprite_info & operator[](unsigned int index) const
Get const sprite information record at index.
static string make_message(const string &name)
Make error message.
Definition: sprite_file.cc:241
const sprite_info * find(const string &name) const
Find const sprite information record for sprite name.
Definition: sprite_file.cc:150
unsigned long uint32
A type to represent an unsigned 32-bit integer.
Definition: sprite_file.h:22
An exception class for reporting corrupt-sprite-file errors.
Definition: sprite_file.h:186
An exception class for reporting already-exists errors.
Definition: sprite_file.h:169
A class to represent a sprite within a sprite file.
Definition: sprite_file.h:109
unsigned int size() const
Get number of sprites.
Definition: sprite_file.h:85
not_found(const string &name)
Construct not-found error.
Definition: sprite_file.cc:223
An exception class for reporting not-found errors.
Definition: sprite_file.h:152
sprite_info()
Construct sprite information record.
Definition: sprite_file.cc:208
already_exists(const string &name)
Construct already-exists error.
Definition: sprite_file.cc:237
~sprite_info()
Destroy sprite information record.
Definition: sprite_file.cc:220
const string & name() const
Get sprite name.
Definition: sprite_file.h:147
~sprite_file()
Destroy sprite file object.
Definition: sprite_file.cc:205