]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCache.h
small fix with footnote, use stringstream some more
[lyx.git] / src / graphics / GraphicsCache.h
index ebb0f7bcaf3dbae8b4d911af3e56eb68f5597368..712ad8006235d4da68371639c08482427111a7ed 100644 (file)
 
 #include "LString.h"
 #include "GraphicsCacheItem.h"
-#include "support/utility.hpp"
+#include <boost/utility.hpp>
+#include <boost/smart_ptr.hpp>
 
-/** GraphicsCache is the manager of the image cache, it is responsible to
-    create the GraphicsCacheItem's and maintain them.
+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();
+       /// Get the instance of the class.
+       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);
+       /// Add a file to the cache.
+       shared_ptr_item addFile(string const & filename);
 
 private:
-    /// Remove a cache item if it's count has gone to zero.
-    void removeFile(string const & filename);
-    
-    /// 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;
-    ///
-    CacheType cache;
-
-       // We need this so that an Item can tell the cache that it should be
-       // deleted. (to call removeFile).
-       // It also helps removing a warning gcc emits.
+       /// Remove a cache item if it's count has gone to zero.
+       void removeFile(string const & filename);
+       
+       /// Private c-tor so we can control how many objects are instantiated.
+       GraphicsCache() {}
+       
+       ///
+       typedef std::map<string, shared_ptr_item> CacheType;
+       ///
+       CacheType cache;
+       
+       /** We need this so that an Item can tell the cache that it should be
+           deleted. (to call removeFile).
+           It also helps removing a warning gcc emits. */
        friend class GraphicsCacheItem;
 };
 #endif