]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/imageloader.h
Remove destructor declarations from exception classes
[libs/gui.git] / source / graphics / imageloader.h
index f0b8d52c36412ec6cf3e9901d5b2a43c51aefdd6..9a69aca8da3058f3a903e30e92575a9dec21d346 100644 (file)
@@ -10,19 +10,25 @@ class 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
 {
 public:
        bad_image_data(const std::string &w): std::runtime_error(w) { }
-       virtual ~bad_image_data() throw() { }
 };
 
 
 class ImageLoader
 {
+public:
+       enum State
+       {
+               INITIAL,
+               HEADERS_LOADED,
+               FINISHED
+       };
+
 protected:
        class RegisterBase
        {
@@ -56,18 +62,25 @@ protected:
 
 private:
        IO::Base *source;
+       State state;
 
 protected:
        ImageLoader();
 public:
        virtual ~ImageLoader();
 
+       static bool detect_signature(const std::string &);
        static ImageLoader *open_file(const std::string &);
        static ImageLoader *open_io(IO::Seekable &);
 
        virtual void load(Image::Data &);
-       virtual void load_headers(Image::Data &) { }
-       virtual void load_data(Image::Data &) { }
+       virtual void load_headers(Image::Data &);
+protected:
+       virtual void load_headers_(Image::Data &) = 0;
+       virtual void load_pixels_(Image::Data &) = 0;
+
+public:
+       State get_state() const { return state; }
 
        template<typename T>
        static void register_loader();