]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/imageloader.h
Add some state checking to ImageLoader
[libs/gui.git] / source / graphics / imageloader.h
index 9dc17269ef7d8054224492ad792795f0ad133afd..cb3f54ac204f303afe23e5bfc30b111ece28f33a 100644 (file)
@@ -23,6 +23,13 @@ public:
 
 class ImageLoader
 {
+public:
+       enum State
+       {
+               INITIAL,
+               FINISHED
+       };
+
 protected:
        class RegisterBase
        {
@@ -56,6 +63,7 @@ protected:
 
 private:
        IO::Base *source;
+       State state;
 
 protected:
        ImageLoader();
@@ -65,7 +73,12 @@ public:
        static ImageLoader *open_file(const std::string &);
        static ImageLoader *open_io(IO::Seekable &);
 
-       virtual void load(Image::Data &) = 0;
+       virtual void load(Image::Data &);
+protected:
+       virtual void load_(Image::Data &) = 0;
+
+public:
+       State get_state() const { return state; }
 
        template<typename T>
        static void register_loader();