2000-07-31 12:30:10 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* =================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
* Copyright 1995 Matthias Ettrich.
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* This file Copyright 2000 Baruch Even
|
|
|
|
* ================================================= */
|
|
|
|
|
2000-07-31 16:39:50 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "GraphicsCache.h"
|
|
|
|
|
2000-07-31 16:39:50 +00:00
|
|
|
|
|
|
|
GraphicsCache * GraphicsCache::singleton = 0;
|
|
|
|
|
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
GraphicsCache *
|
|
|
|
GraphicsCache::getInstance()
|
|
|
|
{
|
|
|
|
if (! singleton) {
|
|
|
|
singleton = new GraphicsCache;
|
|
|
|
}
|
|
|
|
|
|
|
|
return singleton;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-31 16:39:50 +00:00
|
|
|
GraphicsCache::~GraphicsCache()
|
|
|
|
{
|
|
|
|
delete singleton;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
GraphicsCacheItem *
|
2000-07-31 16:39:50 +00:00
|
|
|
GraphicsCache::addFile(string const & filename)
|
2000-07-31 12:30:10 +00:00
|
|
|
{
|
|
|
|
CacheType::const_iterator it = cache.find(filename);
|
|
|
|
|
|
|
|
if (it != cache.end()) {
|
|
|
|
return (*it).second;
|
|
|
|
}
|
|
|
|
// INCOMPLETE!
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-07-31 16:39:50 +00:00
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
void
|
2000-07-31 16:39:50 +00:00
|
|
|
GraphicsCache::removeFile(string const & filename)
|
2000-07-31 12:30:10 +00:00
|
|
|
{
|
|
|
|
CacheType::const_iterator it = cache.find(filename);
|
|
|
|
|
|
|
|
if (it != cache.end()) {
|
|
|
|
// INCOMPLETE!
|
|
|
|
// cache.erase(it);
|
|
|
|
}
|
|
|
|
}
|