12 #include <unordered_map> 25 typedef std::unordered_map<std::string, BppImageSptr>
ImageMap;
43 static std::shared_ptr<BppImageArchive>
make() {
44 return std::make_shared<BppImageArchive>();
56 static std::shared_ptr<BppImageArchive>
make(
const std::string &path) {
57 return std::make_shared<BppImageArchive>(path);
69 static std::shared_ptr<BppImageArchive>
make(std::istream &is) {
70 return std::make_shared<BppImageArchive>(is);
89 void load(
const std::string &path);
106 void load(std::istream &is);
148 ImageMap::const_iterator
begin()
const {
155 ImageMap::const_iterator
end()
const {
ImageMap::const_iterator begin() const
Returns a begining iterator to inspect the images within the archive.
static std::shared_ptr< BppImageArchive > make()
Returns a new empty BppImageArchive object in a shared pointer.
void add(const std::string &name, const BppImageSptr &img)
Adds an image to the archive.
void load(const std::string &path)
Loads images from an image archive in the specified file.
duds::general::Spinlock block
Used for thread safety.
static std::shared_ptr< BppImageArchive > make(const std::string &path)
Returns a new BppImageArchive object in a shared pointer, and calls load(const std::string &)...
BppImageArchive(std::istream &is)
Loads images from the given input stream.
std::shared_ptr< BppImage > BppImageSptr
An archive of BppImage objects keyed by a string name.
std::weak_ptr< BppImageArchive > BppImageArchiveWptr
ImageMap::const_iterator end() const
Returns an end iterator to inspect the images within the archive.
static std::shared_ptr< BppImageArchive > make(std::istream &is)
Returns a new BppImageArchive object in a shared pointer, and calls load(std::istream &)...
std::unordered_map< std::string, BppImageSptr > ImageMap
BppImageArchive(const std::string &path)
Loads images from an image archive in the specified file.
A simple spinlock following the lockable and timed lockable concepts so that it can be used with std:...
BppImageArchive()=default
Makes an empty image archive.
ImageMap arc
The images keyed by name.
General graphics related code.
std::shared_ptr< BppImageArchive > BppImageArchiveSptr
BppImageSptr tryGet(const std::string &name) const
Returns the image with the given name.