mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #559, moved cache/settings to blackmisc
This commit is contained in:
@@ -13,13 +13,10 @@
|
||||
#include <QStandardPaths>
|
||||
#include <QLockFile>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackCore
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
CDataCache::CDataCache() :
|
||||
CValueCache(CValueCache::LocalOnly)
|
||||
CValueCache(CValueCache::LocalOnly) // for signal loopback
|
||||
{
|
||||
if (! QDir::root().mkpath(persistentStore()))
|
||||
{
|
||||
@@ -170,5 +167,4 @@ namespace BlackCore
|
||||
m_deferredChanges.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,25 +9,24 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_DATACACHE_H
|
||||
#define BLACKCORE_DATACACHE_H
|
||||
#ifndef BLACKMISC_DATACACHE_H
|
||||
#define BLACKMISC_DATACACHE_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/valuecache.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include <QUuid>
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
namespace BlackCore
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
class CDataCache;
|
||||
|
||||
/*!
|
||||
* Worker which performs (de)serialization on behalf of CDataCache, in a separate thread
|
||||
* so that the main thread is not blocked by (de)serialization of large objects.
|
||||
*/
|
||||
class BLACKCORE_EXPORT CDataCacheSerializer : public BlackMisc::CContinuousWorker
|
||||
class BLACKMISC_EXPORT CDataCacheSerializer : public BlackMisc::CContinuousWorker
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -63,7 +62,7 @@ namespace BlackCore
|
||||
*
|
||||
* File-based distribution between processes is built-in to the class.
|
||||
*/
|
||||
class BLACKCORE_EXPORT CDataCache : public BlackMisc::CValueCache
|
||||
class BLACKMISC_EXPORT CDataCache : public BlackMisc::CValueCache
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -95,7 +94,7 @@ namespace BlackCore
|
||||
|
||||
/*!
|
||||
* Class template for accessing a specific value in the CDataCache.
|
||||
* \tparam Trait A subclass of BlackCore::CDataTrait that identifies the value's key and other metadata.
|
||||
* \tparam Trait A subclass of BlackMisc::CDataTrait that identifies the value's key and other metadata.
|
||||
*/
|
||||
template <typename Trait>
|
||||
class CData : public BlackMisc::CCached<typename Trait::type>
|
||||
@@ -122,7 +121,7 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
/*!
|
||||
* Base class for traits to be used as template argument to BlackCore::CData.
|
||||
* Base class for traits to be used as template argument to BlackMisc::CData.
|
||||
*/
|
||||
template <typename T>
|
||||
struct CDataTrait
|
||||
@@ -150,7 +149,6 @@ namespace BlackCore
|
||||
//! Deleted copy assignment operator.
|
||||
CDataTrait &operator =(const CDataTrait &) = delete;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -10,9 +10,8 @@
|
||||
#include "settingscache.h"
|
||||
#include <QStandardPaths>
|
||||
|
||||
namespace BlackCore
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
CSettingsCache::CSettingsCache() :
|
||||
CValueCache(CValueCache::Distributed)
|
||||
{}
|
||||
@@ -48,5 +47,4 @@ namespace BlackCore
|
||||
{
|
||||
return enumerateFiles(persistentStore());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,19 +9,18 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_SETTINGSCACHE_H
|
||||
#define BLACKCORE_SETTINGSCACHE_H
|
||||
#ifndef BLACKMISC_SETTINGSCACHE_H
|
||||
#define BLACKMISC_SETTINGSCACHE_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/valuecache.h"
|
||||
|
||||
namespace BlackCore
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
/*!
|
||||
* Singleton derived class of CValueCache, for core settings.
|
||||
*/
|
||||
class BLACKCORE_EXPORT CSettingsCache : public BlackMisc::CValueCache
|
||||
class BLACKMISC_EXPORT CSettingsCache : public BlackMisc::CValueCache
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -50,7 +49,7 @@ namespace BlackCore
|
||||
|
||||
/*!
|
||||
* Class template for accessing a specific value in the CSettingsCache.
|
||||
* \tparam Trait A subclass of BlackCore::CSettingTrait that identifies the value's key and other metadata.
|
||||
* \tparam Trait A subclass of BlackMisc::CSettingTrait that identifies the value's key and other metadata.
|
||||
*/
|
||||
template <typename Trait>
|
||||
class CSetting : public BlackMisc::CCached<typename Trait::type>
|
||||
@@ -77,7 +76,7 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
/*!
|
||||
* Base class for traits to be used as template argument to BlackCore::CSetting.
|
||||
* Base class for traits to be used as template argument to BlackMisc::CSetting.
|
||||
*/
|
||||
template <typename T>
|
||||
struct CSettingTrait
|
||||
@@ -105,7 +104,6 @@ namespace BlackCore
|
||||
//! Deleted copy assignment operator.
|
||||
CSettingTrait &operator =(const CSettingTrait &) = delete;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user