From 3001ca1f447f93773a0ee999f626848a5bd99262 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Sat, 19 Mar 2016 23:35:01 +0000 Subject: [PATCH] refs #624 Use std::make_unique instead of BlackMisc::make_unique. --- src/blackcore/voicevatlib.cpp | 7 ++--- src/blackmisc/makeunique.h | 28 ----------------- .../simulation/aircraftmodelloader.cpp | 3 +- .../simulation/fscommon/aircraftcfgparser.cpp | 7 ++--- src/blackmisc/weather/metardecoder.cpp | 31 +++++++++---------- .../simulator/fscommon/simulatorfscommon.cpp | 4 +-- .../simulator/xplane/simulatorxplane.cpp | 3 +- src/xbus/menus.cpp | 3 +- 8 files changed, 25 insertions(+), 61 deletions(-) delete mode 100644 src/blackmisc/makeunique.h diff --git a/src/blackcore/voicevatlib.cpp b/src/blackcore/voicevatlib.cpp index 38f1a7456..5da063b6a 100644 --- a/src/blackcore/voicevatlib.cpp +++ b/src/blackcore/voicevatlib.cpp @@ -12,7 +12,6 @@ #include "audiodevicevatlib.h" #include "audiomixervatlib.h" #include "blackmisc/logmessage.h" -#include "blackmisc/makeunique.h" #include #include #include @@ -44,17 +43,17 @@ namespace BlackCore std::unique_ptr CVoiceVatlib::createInputDevice() { - return make_unique(m_audioService.data(), this); + return std::make_unique(m_audioService.data(), this); } std::unique_ptr CVoiceVatlib::createOutputDevice() { - return make_unique(m_audioService.data(), this); + return std::make_unique(m_audioService.data(), this); } std::unique_ptr CVoiceVatlib::createAudioMixer() { - return make_unique(this); + return std::make_unique(this); } void CVoiceVatlib::connectVoice(IAudioInputDevice *device, IAudioMixer *mixer, IAudioMixer::InputPort inputPort) diff --git a/src/blackmisc/makeunique.h b/src/blackmisc/makeunique.h deleted file mode 100644 index 85a133b24..000000000 --- a/src/blackmisc/makeunique.h +++ /dev/null @@ -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 -#include - -namespace BlackMisc -{ - //! Own implementation of std::make_unique, a C++14 feature not provided by GCC in C++11 mode - template - std::unique_ptr make_unique(Args &&... args) - { - return std::unique_ptr(new T(std::forward(args)...)); - } -} - -#endif // guard diff --git a/src/blackmisc/simulation/aircraftmodelloader.cpp b/src/blackmisc/simulation/aircraftmodelloader.cpp index 41a122ec4..b5235cf5a 100644 --- a/src/blackmisc/simulation/aircraftmodelloader.cpp +++ b/src/blackmisc/simulation/aircraftmodelloader.cpp @@ -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( + return std::make_unique( CSimulatorInfo(CSimulatorInfo::XPLANE), CXPlaneUtil::xplaneRootDir()); } diff --git a/src/blackmisc/simulation/fscommon/aircraftcfgparser.cpp b/src/blackmisc/simulation/fscommon/aircraftcfgparser.cpp index 6fdb9c49d..515aafe18 100644 --- a/src/blackmisc/simulation/fscommon/aircraftcfgparser.cpp +++ b/src/blackmisc/simulation/fscommon/aircraftcfgparser.cpp @@ -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( + return std::make_unique( CSimulatorInfo(CSimulatorInfo::FSX), CFsCommonUtil::fsxSimObjectsDir(), CFsCommonUtil::fsxSimObjectsExcludeDirectories()); } else if (simInfo.fs9()) { - return make_unique( + return std::make_unique( CSimulatorInfo(CSimulatorInfo::FS9), CFsCommonUtil::fs9AircraftDir(), CFsCommonUtil::fs9AircraftObjectsExcludeDirectories()); } else if (simInfo.p3d()) { - return make_unique( + return std::make_unique( CSimulatorInfo(CSimulatorInfo::P3D), CFsCommonUtil::p3dSimObjectsDir(), CFsCommonUtil::p3dSimObjectsExcludeDirectories()); diff --git a/src/blackmisc/weather/metardecoder.cpp b/src/blackmisc/weather/metardecoder.cpp index cf262267a..58992ca22 100644 --- a/src/blackmisc/weather/metardecoder.cpp +++ b/src/blackmisc/weather/metardecoder.cpp @@ -12,7 +12,6 @@ #include "metardecoder.h" #include "blackmisc/logmessage.h" #include "blackmisc/weather/presentweather.h" -#include "blackmisc/makeunique.h" #include #include @@ -835,21 +834,21 @@ namespace BlackMisc void CMetarDecoder::allocateDecoders() { m_decoders.clear(); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); - m_decoders.push_back(make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); + m_decoders.push_back(std::make_unique()); } } // namespace diff --git a/src/plugins/simulator/fscommon/simulatorfscommon.cpp b/src/plugins/simulator/fscommon/simulatorfscommon.cpp index 9da39908d..5fe032ae0 100644 --- a/src/plugins/simulator/fscommon/simulatorfscommon.cpp +++ b/src/plugins/simulator/fscommon/simulatorfscommon.cpp @@ -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 { BlackMisc::make_unique(true) }; + auto modelMappingsProvider = std::unique_ptr { std::make_unique(true) }; m_modelMatcher.setModelMappingProvider(std::move(modelMappingsProvider)); bool c = connect(m_aircraftCfgParser.get(), &CAircraftCfgParser::loadingFinished, this, &CSimulatorFsCommon::ps_aircraftCfgParsingFinished); diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index 522bc228b..8f3e27484 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -15,7 +15,6 @@ #include "blackmisc/logmessage.h" #include "blackmisc/simulation/modelmappingsprovider.h" #include "blackmisc/geo/coordinategeodetic.h" -#include "blackmisc/makeunique.h" #include #include #include @@ -64,7 +63,7 @@ namespace BlackSimPlugin m_fastTimer->start(100); m_slowTimer->start(1000); - m_modelMatcher.setModelMappingProvider(BlackMisc::make_unique()); + m_modelMatcher.setModelMappingProvider(std::make_unique()); m_modelMatcher.setDefaultModel(CAircraftModel( "__XPFW_Jets/A320_a/A320_a_Austrian_Airlines.obj __XPFW_Jets/A320_a/A320_a_Austrian_Airlines.png", CAircraftModel::TypeModelMatchingDefaultModel, diff --git a/src/xbus/menus.cpp b/src/xbus/menus.cpp index d439585b6..e11b4d85c 100644 --- a/src/xbus/menus.cpp +++ b/src/xbus/menus.cpp @@ -10,7 +10,6 @@ //! \cond PRIVATE #include "menus.h" -#include "blackmisc/makeunique.h" #include #include #include @@ -78,7 +77,7 @@ namespace XBus CMenu CMenu::subMenu(std::string name) { assert(! name.empty()); - auto items = BlackMisc::make_unique(); + auto items = std::make_unique(); auto itemsVoidPtr = static_cast(&*items); return { XPLMCreateMenu(name.c_str(), m_data->id, XPLMAppendMenuItem(m_data->id, name.c_str(), nullptr, false), handler, itemsVoidPtr), false, std::move(items) }; }