]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCache.h
remove more forms.h cruft
[lyx.git] / src / graphics / GraphicsCache.h
index b0c7e4f6e66f10453e3deeb2fba4a322daa2405d..9272e58e490cd09b2033d359e8132afdb4da4244 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.
  *
  *          This file Copyright 2000 Baruch Even
  * ================================================= */
@@ -21,6 +21,9 @@
 #include "LString.h"
 #include "GraphicsCacheItem.h"
 #include <boost/utility.hpp>
+#include <boost/smart_ptr.hpp>
+
+class GraphicsCacheItem;
 
 /** GraphicsCache is the manager of the image cache.
     It is responsible of create the GraphicsCacheItem's and maintain them.
     GraphicsCache is a singleton class, there should be only one instance of
     it at any moment.
 */
-class GraphicsCache : public noncopyable {
+class GraphicsCache : boost::noncopyable {
 public:
        /// Get the instance of the class.
-       static GraphicsCache * getInstance();
+       static GraphicsCache & getInstance();
+       /// Public destructor due to compiler warnings.
+       ~GraphicsCache();
+
+       typedef boost::shared_ptr<GraphicsCacheItem> shared_ptr_item;
 
        /// Add a file to the cache.
-       GraphicsCacheItem * addFile(string const & filename);
+       shared_ptr_item addFile(string const & filename);
 
 private:
        /// Remove a cache item if it's count has gone to zero.
@@ -43,13 +50,8 @@ private:
        /// Private c-tor so we can control how many objects are instantiated.
        GraphicsCache() {}
        
-       /// Private d-tor so that no-one will destroy us.
-       ~GraphicsCache();
-       
-       /// Holder of the single instance of the class.
-       static GraphicsCache * singleton;
        ///
-       typedef std::map<string, GraphicsCacheItem *> CacheType;
+       typedef std::map<string, shared_ptr_item> CacheType;
        ///
        CacheType cache;