refs #624 Use std::make_unique instead of BlackMisc::make_unique.

This commit is contained in:
Mathew Sutcliffe
2016-03-19 23:35:01 +00:00
parent bb7cf80a20
commit 3001ca1f44
8 changed files with 25 additions and 61 deletions

View File

@@ -12,7 +12,6 @@
#include "audiodevicevatlib.h"
#include "audiomixervatlib.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/makeunique.h"
#include <QDebug>
#include <QTimer>
#include <memory>
@@ -44,17 +43,17 @@ namespace BlackCore
std::unique_ptr<IAudioInputDevice> CVoiceVatlib::createInputDevice()
{
return make_unique<CAudioInputDeviceVatlib>(m_audioService.data(), this);
return std::make_unique<CAudioInputDeviceVatlib>(m_audioService.data(), this);
}
std::unique_ptr<IAudioOutputDevice> CVoiceVatlib::createOutputDevice()
{
return make_unique<CAudioOutputDeviceVatlib>(m_audioService.data(), this);
return std::make_unique<CAudioOutputDeviceVatlib>(m_audioService.data(), this);
}
std::unique_ptr<IAudioMixer> CVoiceVatlib::createAudioMixer()
{
return make_unique<CAudioMixerVatlib>(this);
return std::make_unique<CAudioMixerVatlib>(this);
}
void CVoiceVatlib::connectVoice(IAudioInputDevice *device, IAudioMixer *mixer, IAudioMixer::InputPort inputPort)

View File

@@ -1,28 +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.
*/
//! \file
#ifndef BLACKMISC_MAKEUNIQUE_H
#define BLACKMISC_MAKEUNIQUE_H
#include <memory>
#include <utility>
namespace BlackMisc
{
//! Own implementation of std::make_unique, a C++14 feature not provided by GCC in C++11 mode
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args &&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
}
#endif // guard

View File

@@ -11,7 +11,6 @@
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
#include "blackmisc/simulation/xplane/aircraftmodelloaderxplane.h"
#include "blackmisc/simulation/xplane/xplaneutil.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc::Simulation::FsCommon;
using namespace BlackMisc::Simulation::XPlane;
@@ -58,7 +57,7 @@ namespace BlackMisc
{
if (simInfo.xplane())
{
return make_unique<CAircraftModelLoaderXPlane>(
return std::make_unique<CAircraftModelLoaderXPlane>(
CSimulatorInfo(CSimulatorInfo::XPLANE),
CXPlaneUtil::xplaneRootDir());
}

View File

@@ -11,7 +11,6 @@
#include "blackmisc/simulation/fscommon/fscommonutil.h"
#include "blackmisc/predicates.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc;
using namespace BlackMisc::Simulation;
@@ -36,21 +35,21 @@ namespace BlackMisc
{
if (simInfo.fsx())
{
return make_unique<CAircraftCfgParser>(
return std::make_unique<CAircraftCfgParser>(
CSimulatorInfo(CSimulatorInfo::FSX),
CFsCommonUtil::fsxSimObjectsDir(),
CFsCommonUtil::fsxSimObjectsExcludeDirectories());
}
else if (simInfo.fs9())
{
return make_unique<CAircraftCfgParser>(
return std::make_unique<CAircraftCfgParser>(
CSimulatorInfo(CSimulatorInfo::FS9),
CFsCommonUtil::fs9AircraftDir(),
CFsCommonUtil::fs9AircraftObjectsExcludeDirectories());
}
else if (simInfo.p3d())
{
return make_unique<CAircraftCfgParser>(
return std::make_unique<CAircraftCfgParser>(
CSimulatorInfo(CSimulatorInfo::P3D),
CFsCommonUtil::p3dSimObjectsDir(),
CFsCommonUtil::p3dSimObjectsExcludeDirectories());

View File

@@ -12,7 +12,6 @@
#include "metardecoder.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/weather/presentweather.h"
#include "blackmisc/makeunique.h"
#include <QRegularExpression>
#include <QDebug>
@@ -835,21 +834,21 @@ namespace BlackMisc
void CMetarDecoder::allocateDecoders()
{
m_decoders.clear();
m_decoders.push_back(make_unique<CMetarDecoderReportType>());
m_decoders.push_back(make_unique<CMetarDecoderAirport>());
m_decoders.push_back(make_unique<CMetarDecoderDayTime>());
m_decoders.push_back(make_unique<CMetarDecoderStatus>());
m_decoders.push_back(make_unique<CMetarDecoderWind>());
m_decoders.push_back(make_unique<CMetarDecoderVariationsWindDirection>());
m_decoders.push_back(make_unique<CMetarDecoderVisibility>());
m_decoders.push_back(make_unique<CMetarDecoderRunwayVisualRange>());
m_decoders.push_back(make_unique<CMetarDecoderPresentWeather>());
m_decoders.push_back(make_unique<CMetarDecoderCloud>());
m_decoders.push_back(make_unique<CMetarDecoderVerticalVisibility>());
m_decoders.push_back(make_unique<CMetarDecoderTemperature>());
m_decoders.push_back(make_unique<CMetarDecoderPressure>());
m_decoders.push_back(make_unique<CMetarDecoderRecentWeather>());
m_decoders.push_back(make_unique<CMetarDecoderWindShear>());
m_decoders.push_back(std::make_unique<CMetarDecoderReportType>());
m_decoders.push_back(std::make_unique<CMetarDecoderAirport>());
m_decoders.push_back(std::make_unique<CMetarDecoderDayTime>());
m_decoders.push_back(std::make_unique<CMetarDecoderStatus>());
m_decoders.push_back(std::make_unique<CMetarDecoderWind>());
m_decoders.push_back(std::make_unique<CMetarDecoderVariationsWindDirection>());
m_decoders.push_back(std::make_unique<CMetarDecoderVisibility>());
m_decoders.push_back(std::make_unique<CMetarDecoderRunwayVisualRange>());
m_decoders.push_back(std::make_unique<CMetarDecoderPresentWeather>());
m_decoders.push_back(std::make_unique<CMetarDecoderCloud>());
m_decoders.push_back(std::make_unique<CMetarDecoderVerticalVisibility>());
m_decoders.push_back(std::make_unique<CMetarDecoderTemperature>());
m_decoders.push_back(std::make_unique<CMetarDecoderPressure>());
m_decoders.push_back(std::make_unique<CMetarDecoderRecentWeather>());
m_decoders.push_back(std::make_unique<CMetarDecoderWindShear>());
}
} // namespace

View File

@@ -9,9 +9,7 @@
#include "simulatorfscommon.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/makeunique.h"
#include "blackmisc/simulation/fscommon/modelmappingsprovidervpilot.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Simulation;
@@ -39,7 +37,7 @@ namespace BlackSimPlugin
{
// hack to init mapper
connect(&m_modelMatcher, &CAircraftMatcher::initializationFinished, this, &CSimulatorFsCommon::ps_mapperInitialized);
auto modelMappingsProvider = std::unique_ptr<IModelMappingsProvider> { BlackMisc::make_unique<CModelMappingsProviderVPilot>(true) };
auto modelMappingsProvider = std::unique_ptr<IModelMappingsProvider> { std::make_unique<CModelMappingsProviderVPilot>(true) };
m_modelMatcher.setModelMappingProvider(std::move(modelMappingsProvider));
bool c = connect(m_aircraftCfgParser.get(), &CAircraftCfgParser::loadingFinished, this, &CSimulatorFsCommon::ps_aircraftCfgParsingFinished);

View File

@@ -15,7 +15,6 @@
#include "blackmisc/logmessage.h"
#include "blackmisc/simulation/modelmappingsprovider.h"
#include "blackmisc/geo/coordinategeodetic.h"
#include "blackmisc/makeunique.h"
#include <QDBusServiceWatcher>
#include <QTimer>
#include <QString>
@@ -64,7 +63,7 @@ namespace BlackSimPlugin
m_fastTimer->start(100);
m_slowTimer->start(1000);
m_modelMatcher.setModelMappingProvider(BlackMisc::make_unique<CModelMappingsProviderDummy>());
m_modelMatcher.setModelMappingProvider(std::make_unique<CModelMappingsProviderDummy>());
m_modelMatcher.setDefaultModel(CAircraftModel(
"__XPFW_Jets/A320_a/A320_a_Austrian_Airlines.obj __XPFW_Jets/A320_a/A320_a_Austrian_Airlines.png",
CAircraftModel::TypeModelMatchingDefaultModel,

View File

@@ -10,7 +10,6 @@
//! \cond PRIVATE
#include "menus.h"
#include "blackmisc/makeunique.h"
#include <type_traits>
#include <cassert>
#include <string>
@@ -78,7 +77,7 @@ namespace XBus
CMenu CMenu::subMenu(std::string name)
{
assert(! name.empty());
auto items = BlackMisc::make_unique<ItemList>();
auto items = std::make_unique<ItemList>();
auto itemsVoidPtr = static_cast<void *>(&*items);
return { XPLMCreateMenu(name.c_str(), m_data->id, XPLMAppendMenuItem(m_data->id, name.c_str(), nullptr, false), handler, itemsVoidPtr), false, std::move(items) };
}