]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/ImageLoader.h
remove more forms.h cruft
[lyx.git] / src / graphics / ImageLoader.h
index 4a1a4dc3795d70cf9764a91f168d534946cdd62b..cf126b7b72a3ddb77901bf0f7aa90ac076c21ad4 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *          LyX, The Document Processor
  *          Copyright 1995 Matthias Ettrich.
- *          Copyright 1995-2000 The LyX Team.
+ *          Copyright 1995-2001 The LyX Team.
  *
  * ================================================= */
 
@@ -29,7 +29,7 @@ class LyXImage;
  *  
  *  @Author Baruch Even, <baruch.even@writeme.com>
  */
-class ImageLoader : public noncopyable {
+class ImageLoader : boost::noncopyable {
 public:
        /// Errors that can be returned from this class.
        enum Result {
@@ -50,8 +50,17 @@ public:
        /// Start loading the image file.
        ImageLoader::Result loadImage(string const & filename);
 
-       /// Get the last rendered pixmap. Returns 0 if no image is ready.
-       LyXImage * getImage() const { return image_; };
+       /** Get the last rendered pixmap. Returns 0 if no image is ready.
+        *  
+        *  It is a one time operation, that is, after you get the image
+        *  you are completely responsible to destroy it and the ImageLoader
+        *  will not know about the image.
+        *
+        *  This way we avoid deleting the image if you still use it and the 
+        *  ImageLoader is destructed, and if you don't use it we get to 
+        *  destruct the image to avoid memory leaks.
+        */
+       LyXImage * getImage();
 
        /// Return the list of loadable formats.
        virtual FormatList const loadableFormats() const;
@@ -70,7 +79,8 @@ private:
        /// Free the loaded image.
        void freeImage();
        
-       /// The loaded image.
+       /// The loaded image. An auto_ptr would be great here, but it's not
+       /// available everywhere (gcc 2.95.2 doesnt have it).
        LyXImage * image_;
 };