X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fimageloader.h;h=345068cdc34a36bf41795f7a88059facd6c40516;hb=d7686e3867e3c68cec0d3767a21f9d2408383085;hp=1ad6cc8c895aad812264df8663920cd6a56f6528;hpb=054fca09f0bbd64fdbd6406a0643de938a9cd4fb;p=libs%2Fgui.git diff --git a/source/graphics/imageloader.h b/source/graphics/imageloader.h index 1ad6cc8..345068c 100644 --- a/source/graphics/imageloader.h +++ b/source/graphics/imageloader.h @@ -2,26 +2,25 @@ #define MSP_GRAPHICS_IMAGELOADER_H_ #include "image.h" +#include "mspgui_api.h" namespace Msp { namespace Graphics { -class unsupported_image_format: public std::runtime_error +class MSPGUI_API unsupported_image_format: public std::runtime_error { public: unsupported_image_format(const std::string &w): std::runtime_error(w) { } - virtual ~unsupported_image_format() throw() { } }; -class bad_image_data: public std::runtime_error +class MSPGUI_API bad_image_data: public std::runtime_error { public: bad_image_data(const std::string &w): std::runtime_error(w) { } - virtual ~bad_image_data() throw() { } }; -class ImageLoader +class MSPGUI_API ImageLoader { public: enum State @@ -48,29 +47,29 @@ protected: class RegisteredLoader: public RegisterBase { public: - virtual unsigned get_signature_size() const { return T::get_signature_size(); } - virtual bool detect(const std::string &s) const { return T::detect(s); } - virtual ImageLoader *create(IO::Seekable &io) const { return new T(io); } + unsigned get_signature_size() const override { return T::get_signature_size(); } + bool detect(const std::string &s) const override { return T::detect(s); } + ImageLoader *create(IO::Seekable &io) const override { return new T(io); } }; struct Registry { - std::list loaders; - bool changed; + std::vector loaders; + bool changed = false; - Registry(); ~Registry(); }; private: - IO::Base *source; - State state; + IO::Base *source = nullptr; + State state = INITIAL; protected: - ImageLoader(); + ImageLoader() = default; public: virtual ~ImageLoader(); + static bool detect_signature(const std::string &); static ImageLoader *open_file(const std::string &); static ImageLoader *open_io(IO::Seekable &); @@ -87,8 +86,6 @@ public: static void register_loader(); private: static Registry &get_registry(); - - static bool signature_size_compare(RegisterBase *, RegisterBase *); }; template