X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fimageloader.h;h=c06a7592fcf75bc1cf9ea918ceae470424ad785d;hb=21b0c47700f1b570b6129384ce0b96a0c6b48ffd;hp=f953990c696458dffb587d0a3fd3889fe10b9975;hpb=0466fc5fe92ae03189f45f8872fb070ef7022290;p=libs%2Fgui.git diff --git a/source/graphics/imageloader.h b/source/graphics/imageloader.h index f953990..c06a759 100644 --- a/source/graphics/imageloader.h +++ b/source/graphics/imageloader.h @@ -24,9 +24,36 @@ public: class ImageLoader { private: - IO::Base *source; + class RegisterBase + { + protected: + RegisterBase(); + public: + virtual ~RegisterBase() { } + + virtual unsigned get_signature_size() const = 0; + virtual bool detect(const std::string &) const = 0; + virtual ImageLoader *create(IO::Seekable &) const = 0; + }; + protected: + template + class Register: 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 T *create(IO::Seekable &io) const { return new T(io); } + }; + +private: + IO::Base *source; + static std::list &get_registered_loaders(); + static bool registered_loaders_changed; + static bool signature_size_compare(RegisterBase *, RegisterBase *); + +protected: ImageLoader(); public: virtual ~ImageLoader();