Remove defaultValue where not needed
This commit is contained in:
Klaus Basan
2016-06-08 16:46:03 +02:00
parent d44cacd97d
commit 2a99bed0cd
8 changed files with 2 additions and 138 deletions

View File

@@ -30,14 +30,9 @@ namespace BlackCore
//! First load is synchronous //! First load is synchronous
static constexpr bool isPinned() { return true; } static constexpr bool isPinned() { return true; }
//! Default value //! Cache lifetime
static const BlackMisc::Network::CAuthenticatedUser &defaultValue() static int timeToLive() { return 18 * 60 * 60 * 1000; }
{
static const BlackMisc::Network::CAuthenticatedUser user;
return user;
}
}; };
} // ns } // ns
} // ns } // ns

View File

@@ -1,70 +0,0 @@
/* Copyright (C) 2016
* swift project community / contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "dbcaches.h"
#include <QtGlobal>
using namespace BlackMisc;
using namespace BlackMisc::Network;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Simulation;
namespace BlackCore
{
namespace Data
{
const BlackMisc::Simulation::CAircraftModelList &DbModelCache::defaultValue()
{
static const CAircraftModelList ml;
return ml;
}
const BlackMisc::Aviation::CAirlineIcaoCodeList &DbAirlineIcaoCache::defaultValue()
{
static const CAirlineIcaoCodeList al;
return al;
}
const BlackMisc::Aviation::CAircraftIcaoCodeList &DbAircraftIcaoCache::defaultValue()
{
static const CAircraftIcaoCodeList al;
return al;
}
const BlackMisc::CCountryList &DbCountryCache::defaultValue()
{
static const CCountryList cl;
return cl;
}
const BlackMisc::Aviation::CLiveryList &DbLiveryCache::defaultValue()
{
static const CLiveryList ll;
return ll;
}
const CDistributorList &DbDistributorCache::defaultValue()
{
static const CDistributorList dl;
return dl;
}
const BlackMisc::Network::CUrl &DbIcaoReaderBaseUrl::defaultValue()
{
static const CUrl url;
return url;
}
const CUrl &DbModelReaderBaseUrl::defaultValue()
{
static const CUrl url;
return url;
}
} // ns
} // ns

View File

@@ -31,9 +31,6 @@ namespace BlackCore
//! Trait for DB model cache //! Trait for DB model cache
struct DbModelCache : public BlackMisc::CDataTrait<BlackMisc::Simulation::CAircraftModelList> struct DbModelCache : public BlackMisc::CDataTrait<BlackMisc::Simulation::CAircraftModelList>
{ {
//! Default value
static const BlackMisc::Simulation::CAircraftModelList &defaultValue();
//! Defer loading //! Defer loading
static constexpr bool isDeferred() { return true; } static constexpr bool isDeferred() { return true; }
@@ -44,9 +41,6 @@ namespace BlackCore
//! Trait for DB distributor cache //! Trait for DB distributor cache
struct DbDistributorCache : public BlackMisc::CDataTrait<BlackMisc::Simulation::CDistributorList> struct DbDistributorCache : public BlackMisc::CDataTrait<BlackMisc::Simulation::CDistributorList>
{ {
//! Default value
static const BlackMisc::Simulation::CDistributorList &defaultValue();
//! Defer loading (no currently small) //! Defer loading (no currently small)
static constexpr bool isDeferred() { return false; } static constexpr bool isDeferred() { return false; }
@@ -57,9 +51,6 @@ namespace BlackCore
//! Trait for DB liveries //! Trait for DB liveries
struct DbLiveryCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CLiveryList> struct DbLiveryCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CLiveryList>
{ {
//! Default value
static const BlackMisc::Aviation::CLiveryList &defaultValue();
//! Defer loading //! Defer loading
static constexpr bool isDeferred() { return true; } static constexpr bool isDeferred() { return true; }
@@ -70,9 +61,6 @@ namespace BlackCore
//! Trait for DB airline ICAO codes //! Trait for DB airline ICAO codes
struct DbAirlineIcaoCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CAirlineIcaoCodeList> struct DbAirlineIcaoCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CAirlineIcaoCodeList>
{ {
//! Default value
static const BlackMisc::Aviation::CAirlineIcaoCodeList &defaultValue();
//! Defer loading //! Defer loading
static constexpr bool isDeferred() { return true; } static constexpr bool isDeferred() { return true; }
@@ -84,9 +72,6 @@ namespace BlackCore
//! Trait for DB aircraft ICAO codes //! Trait for DB aircraft ICAO codes
struct DbAircraftIcaoCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CAircraftIcaoCodeList> struct DbAircraftIcaoCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CAircraftIcaoCodeList>
{ {
//! Default value
static const BlackMisc::Aviation::CAircraftIcaoCodeList &defaultValue();
//! Defer loading //! Defer loading
static constexpr bool isDeferred() { return true; } static constexpr bool isDeferred() { return true; }
@@ -97,9 +82,6 @@ namespace BlackCore
//! Trait for DB countries //! Trait for DB countries
struct DbCountryCache : public BlackMisc::CDataTrait<BlackMisc::CCountryList> struct DbCountryCache : public BlackMisc::CDataTrait<BlackMisc::CCountryList>
{ {
//! Default value
static const BlackMisc::CCountryList &defaultValue();
//! Defer loading (no currently small) //! Defer loading (no currently small)
static constexpr bool isDeferred() { return false; } static constexpr bool isDeferred() { return false; }
@@ -110,9 +92,6 @@ namespace BlackCore
//! Trait for ICAO reader base URL //! Trait for ICAO reader base URL
struct DbIcaoReaderBaseUrl : public BlackMisc::CDataTrait<BlackMisc::Network::CUrl> struct DbIcaoReaderBaseUrl : public BlackMisc::CDataTrait<BlackMisc::Network::CUrl>
{ {
//! Default value
static const BlackMisc::Network::CUrl &defaultValue();
//! First load is synchronous //! First load is synchronous
static constexpr bool isPinned() { return true; } static constexpr bool isPinned() { return true; }
@@ -123,9 +102,6 @@ namespace BlackCore
//! Trait for ICAO reader base URL //! Trait for ICAO reader base URL
struct DbModelReaderBaseUrl : public BlackMisc::CDataTrait<BlackMisc::Network::CUrl> struct DbModelReaderBaseUrl : public BlackMisc::CDataTrait<BlackMisc::Network::CUrl>
{ {
//! Default value
static const BlackMisc::Network::CUrl &defaultValue();
//! First load is synchronous //! First load is synchronous
static constexpr bool isPinned() { return true; } static constexpr bool isPinned() { return true; }

View File

@@ -203,15 +203,7 @@ namespace BlackCore
//! First load is synchronous //! First load is synchronous
static constexpr bool isPinned() { return true; } static constexpr bool isPinned() { return true; }
//! Default value
static const CGlobalSetup &defaultValue()
{
static const CGlobalSetup gs;
return gs;
}
}; };
} // ns } // ns
} // ns } // ns

View File

@@ -126,13 +126,6 @@ namespace BlackCore
//! First load is synchronous //! First load is synchronous
static constexpr bool isPinned() { return true; } static constexpr bool isPinned() { return true; }
//! Default value
static const CUpdateInfo &defaultValue()
{
static const CUpdateInfo defaultValue;
return defaultValue;
}
}; };
} // ns } // ns

View File

@@ -129,15 +129,7 @@ namespace BlackCore
//! First load is synchronous //! First load is synchronous
static constexpr bool isPinned() { return true; } static constexpr bool isPinned() { return true; }
//! Default value
static const CVatsimSetup &defaultValue()
{
static const CVatsimSetup gs;
return gs;
}
}; };
} // ns } // ns
} // ns } // ns

View File

@@ -144,13 +144,6 @@ namespace BlackGui
{ {
//! Key in data cache //! Key in data cache
static const char *key() { return "guidockwidget"; } static const char *key() { return "guidockwidget"; }
//! Default value
static const CSettingsDockWidgets &defaultValue()
{
static const CSettingsDockWidgets defaultValue;
return defaultValue;
}
}; };
} // ns } // ns
} // ns } // ns

View File

@@ -32,13 +32,6 @@ namespace BlackMisc
{ {
//! Defer loading //! Defer loading
static constexpr bool isDeferred() { return true; } static constexpr bool isDeferred() { return true; }
//! Default value
static const BlackMisc::Simulation::CAircraftModelList &defaultValue()
{
static const BlackMisc::Simulation::CAircraftModelList ml;
return ml;
}
}; };
//! \name Caches for own models on disk, loaded by BlackMisc::Simulation::IAircraftModelLoader //! \name Caches for own models on disk, loaded by BlackMisc::Simulation::IAircraftModelLoader