more of it

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21496 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-07 21:25:22 +00:00
parent 5253f5f17d
commit a1eb7cac0e
2 changed files with 30 additions and 22 deletions

View File

@ -213,6 +213,26 @@ CacheItem * ConverterCache::Impl::find(FileName const & from,
}
/////////////////////////////////////////////////////////////////////
//
// ConverterCache
//
/////////////////////////////////////////////////////////////////////
ConverterCache::ConverterCache()
: pimpl_(new Impl)
{}
ConverterCache::~ConverterCache()
{
if (!lyxrc.use_converter_cache)
return;
pimpl_->writeIndex();
delete pimpl_;
}
ConverterCache & ConverterCache::get()
{
// Now return the cache
@ -238,19 +258,6 @@ void ConverterCache::init()
}
ConverterCache::ConverterCache()
: pimpl_(new Impl)
{}
ConverterCache::~ConverterCache()
{
if (!lyxrc.use_converter_cache)
return;
pimpl_->writeIndex();
}
void ConverterCache::add(FileName const & orig_from, string const & to_format,
FileName const & converted_file) const
{

View File

@ -10,21 +10,18 @@
*
* Full author contact details are available in file CREDITS.
*
* lyx::ConverterCache is the manager of the file cache.
* It is responsible for creating the lyx::ConverterCacheItem's
* ConverterCache is the manager of the file cache.
* It is responsible for creating the ConverterCacheItem's
* and maintaining them.
*
* lyx::ConverterCache is a singleton class. It is possible to have
* ConverterCache is a singleton class. It is possible to have
* only one instance of it at any moment.
*/
#ifndef CONVERTERCACHE_H
#define CONVERTERCACHE_H
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
#include <string>
#include "support/strfwd.h"
namespace lyx {
@ -49,7 +46,7 @@ namespace support { class FileName; }
*
* There is no cache maintenance yet (max size, max age etc.)
*/
class ConverterCache : boost::noncopyable {
class ConverterCache {
public:
/// This is a singleton class. Get the instance.
@ -89,6 +86,10 @@ public:
support::FileName const & dest) const;
private:
/// noncopyable
ConverterCache(ConverterCache const &);
void operator=(ConverterCache const &);
/** Make the c-tor, d-tor private so we can control how many objects
* are instantiated.
*/
@ -99,7 +100,7 @@ private:
/// Use the Pimpl idiom to hide the internals.
class Impl;
/// The pointer never changes although *pimpl_'s contents may.
boost::scoped_ptr<Impl> const pimpl_;
Impl * const pimpl_;
};
} // namespace lyx