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