1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 07:59:27 +02:00

Remove most uses of AUDACITY_OLD_STD

This commit is contained in:
Paul Licameli 2018-04-16 12:50:14 -04:00
parent 56c42e870e
commit 7a0475e39f
23 changed files with 12 additions and 120 deletions

View File

@ -986,11 +986,7 @@ wxT("POSSIBILITY OF SUCH DAMAGES.\n"));
void AboutDialog::AddCredit(wxString &&description, Role role)
{
#ifdef __AUDACITY_OLD_STD__
creditItems.push_back(AboutDialogCreditItem{ std::move(description), role });
#else
creditItems.emplace_back(std::move(description), role);
#endif
}
wxString AboutDialog::GetCreditsByRole(AboutDialog::Role role)

View File

@ -32,14 +32,9 @@ struct AboutDialogCreditItem {
: description(description_), role(role_)
{}
#ifdef __AUDACITY_OLD_STD__
AboutDialogCreditItem(const AboutDialogCreditItem&) = default;
AboutDialogCreditItem& operator= (const AboutDialogCreditItem&) = default;
#else
// No copy, use the move
AboutDialogCreditItem(const AboutDialogCreditItem&) PROHIBITED;
AboutDialogCreditItem& operator= (const AboutDialogCreditItem&) PROHIBITED;
#endif
// Move constructor, because wxString lacks one
AboutDialogCreditItem(AboutDialogCreditItem &&moveMe)

View File

@ -21,9 +21,7 @@
#include <wx/hashmap.h>
#include <wx/mstream.h>
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
//
// Show auto recovery dialog if there are projects to recover. Should be

View File

@ -189,14 +189,6 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
ReadLock ( const BlockFile *p, const BlockFile::ReadUnlocker &u )
: ReadLockBase { p, u } {}
public:
#ifdef __AUDACITY_OLD_STD__
ReadLock (const ReadLock &that) : ReadLockBase( that ) {}
ReadLock &operator= (const ReadLock &that)
{
*((ReadLockBase*)this) = that;
return *this;
}
#endif
ReadLock(ReadLock&&that) : ReadLockBase{ std::move(that) } {}
using Suspension = std::unique_ptr< const BlockFile, ReadLocker >;
Suspension Suspend() const

View File

@ -58,9 +58,7 @@ AliasedFile s.
#include "WaveClip.h"
#include "widgets/ErrorDialog.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
using AliasedFileHash = std::unordered_map<wxString, AliasedFile*>;

View File

@ -22,9 +22,7 @@
#include "xml/XMLTagHandler.h"
#include "wxFileNameWrapper.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
class wxHashTable;
class BlockArray;

View File

@ -42,9 +42,7 @@
#include "AudacityApp.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
using LangHash = std::unordered_map<wxString, wxString>;

View File

@ -1185,27 +1185,20 @@ make_value_transform_iterator(const Iterator &iterator, Function function)
return { iterator, NewFunction{ function } };
}
#if !wxCHECK_VERSION(3, 1, 0)
// For using std::unordered_map on wxString
namespace std
{
#ifdef __AUDACITY_OLD_STD__
namespace tr1
{
#endif
#if !wxCHECK_VERSION(3, 1, 0)
template<typename T> struct hash;
template<> struct hash< wxString > {
size_t operator () (const wxString &str) const // noexcept
{
auto stdstr = str.ToStdWstring(); // no allocations, a cheap fetch
using Hasher = hash< decltype(stdstr) >;
return Hasher{}( stdstr );
}
};
#endif
#ifdef __AUDACITY_OLD_STD__
}
#endif
template<typename T> struct hash;
template<> struct hash< wxString > {
size_t operator () (const wxString &str) const // noexcept
{
auto stdstr = str.ToStdWstring(); // no allocations, a cheap fetch
using Hasher = hash< decltype(stdstr) >;
return Hasher{}( stdstr );
}
};
}
#endif
#endif // __AUDACITY_MEMORY_X_H__

View File

@ -56,9 +56,7 @@ for shared and private configs - which need to move out.
#include "Experimental.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
using ProviderMap = std::unordered_map<wxString, wxArrayString>;

View File

@ -41,9 +41,7 @@
#include "widgets/wxPanelWrapper.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
class wxButton;
class wxChoice;

View File

@ -36,9 +36,7 @@ UndoManager
#include "UndoManager.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_set>
#endif
using ConstBlockFilePtr = const BlockFile*;
using Set = std::unordered_set<ConstBlockFilePtr>;

View File

@ -59,9 +59,7 @@ ShuttleGui.
#include "../Experimental.h"
#include "../commands/ScreenshotCommand.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
#include "../commands/CommandContext.h"
AudacityCommand::AudacityCommand()

View File

@ -566,11 +566,7 @@ std::unique_ptr<wxMenuBar> CommandManager::AddMenuBar(const wxString & sMenu)
}
auto result = std::make_unique<wxMenuBar>();
#ifdef __AUDACITY_OLD_STD__
mMenuBarList.push_back(MenuBarListEntry{sMenu, result.get()});
#else
mMenuBarList.emplace_back(sMenu, result.get());
#endif
return result;
}

View File

@ -28,9 +28,7 @@
#include "audacity/Types.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
using CommandParameter = wxString;
class TranslatedInternalString;
@ -100,21 +98,6 @@ using CommandList = std::vector<movable_ptr<CommandListEntry>>;
namespace std
{
#ifdef __AUDACITY_OLD_STD__
namespace tr1
{
template<typename T> struct hash;
template<> struct hash< NormalizedKeyString > {
size_t operator () (const NormalizedKeyString &str) const // noexcept
{
auto &stdstr = str.Raw(); // no allocations, a cheap fetch
using Hasher = hash< wxString >;
return Hasher{}( stdstr );
}
};
}
#else
// in std, not in tr1.
template<> struct hash< NormalizedKeyString > {
size_t operator () (const NormalizedKeyString &str) const // noexcept
{
@ -123,7 +106,6 @@ namespace std
return Hasher{}( stdstr );
}
};
#endif
}
using CommandKeyHash = std::unordered_map<NormalizedKeyString, CommandListEntry*>;

View File

@ -68,9 +68,7 @@ greater use in future.
#include "../Experimental.h"
#include "../commands/ScreenshotCommand.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
static const int kDummyID = 20000;
static const int kSaveAsID = 20001;
@ -2127,12 +2125,7 @@ Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack
// So it's okay that we cast it back to const
mpOrigTrack =
pEffect->mTracks->Replace(const_cast<LabelTrack*>(pOrigTrack),
#ifdef __AUDACITY_OLD_STD__
std::shared_ptr<Track>(newTrack.release())
#else
std::move(newTrack)
#endif
);
std::move(newTrack) );
}
Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack(ModifiedAnalysisTrack &&that)

View File

@ -25,9 +25,7 @@
#include "../PluginManager.h"
#include "Effect.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
class AudacityCommand;
class CommandContext;

View File

@ -38,9 +38,7 @@
#include "LoadLV2.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
#define LV2EFFECTS_VERSION wxT("1.0.0.0")
/* i18n-hint: abbreviates

View File

@ -43,9 +43,7 @@ Functions that find and load all LV2 plugins on the system.
#include "LoadLV2.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
// ============================================================================
// Module registration entry point

View File

@ -43,10 +43,6 @@
#include "../../LabelTrack.h"
#include "../../WaveTrack.h"
#ifdef __AUDACITY_OLD_STD__
#include <list>
#endif
enum
{
ID_Program = 10000,

View File

@ -22,9 +22,7 @@ LRN
#include "../FileNames.h"
#include "../widgets/wxPanelWrapper.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
/// Identifiers for pre-set export types.

View File

@ -124,13 +124,8 @@ void Importer::GetSupportedImportFormats(FormatList *formatList)
{
for(const auto &importPlugin : mImportPluginList)
{
#ifdef __AUDACITY_OLD_STD__
formatList->push_back(Format{importPlugin->GetPluginFormatDescription(),
importPlugin->GetSupportedExtensions()});
#else
formatList->emplace_back(importPlugin->GetPluginFormatDescription(),
importPlugin->GetSupportedExtensions());
#endif
}
}

View File

@ -21,28 +21,8 @@ class wxWindow;
#include <vector>
#ifdef __AUDACITY_OLD_STD__
class TrackHolder : public std::shared_ptr < WaveTrack >
{
public:
// shared_ptr can construct from unique_ptr&& in newer std, but not older,
// so define it here
TrackHolder &operator=(std::unique_ptr<WaveTrack> &&that)
{
reset(that.release());
return *this;
}
};
using TrackHolders = std::vector<TrackHolder>;
#else
using TrackHolders = std::vector<std::unique_ptr<WaveTrack>>;
#endif
void ImportRaw(wxWindow *parent, const wxString &fileName,
TrackFactory *trackFactory, TrackHolders &outTracks);

View File

@ -23,9 +23,7 @@
#include "ImageRoll.h"
#include "wxPanelWrapper.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
class wxDragImage;