mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-17 16:50:26 +02:00
Use std::[tr1::]unordered_(set|map), not the wxWidgets container macros
This commit is contained in:
parent
cd8ec5e6a8
commit
cb403954fa
@ -22,6 +22,10 @@
|
|||||||
#include <wx/hashmap.h>
|
#include <wx/hashmap.h>
|
||||||
#include <wx/mstream.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
|
// Show auto recovery dialog if there are projects to recover. Should be
|
||||||
// called once at Audacity startup.
|
// called once at Audacity startup.
|
||||||
@ -68,8 +72,8 @@ private:
|
|||||||
// Should be plain ASCII
|
// Should be plain ASCII
|
||||||
#define AutoSaveIdent "<?xml autosave>"
|
#define AutoSaveIdent "<?xml autosave>"
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(short, NameMap, class AUDACITY_DLL_API);
|
using NameMap = std::unordered_map<wxString, short>;
|
||||||
WX_DECLARE_HASH_MAP_WITH_DECL(short, wxString, wxIntegerHash, wxIntegerEqual, IdMap, class AUDACITY_DLL_API);
|
using IdMap = std::unordered_map<short, wxString>;
|
||||||
WX_DECLARE_OBJARRAY_WITH_DECL(IdMap, IdMapArray, class AUDACITY_DLL_API);
|
WX_DECLARE_OBJARRAY_WITH_DECL(IdMap, IdMapArray, class AUDACITY_DLL_API);
|
||||||
|
|
||||||
// This class's overrides do NOT throw AudacityException.
|
// This class's overrides do NOT throw AudacityException.
|
||||||
|
@ -56,15 +56,16 @@ AliasedFile s.
|
|||||||
#include "WaveClip.h"
|
#include "WaveClip.h"
|
||||||
#include "widgets/ErrorDialog.h"
|
#include "widgets/ErrorDialog.h"
|
||||||
|
|
||||||
WX_DECLARE_HASH_MAP(wxString, AliasedFile *,
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
wxStringHash, wxStringEqual, AliasedFileHash);
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using AliasedFileHash = std::unordered_map<wxString, AliasedFile*>;
|
||||||
|
|
||||||
// These two hash types are used only inside short scopes
|
// These two hash types are used only inside short scopes
|
||||||
// so it is safe to key them by plain pointers.
|
// so it is safe to key them by plain pointers.
|
||||||
WX_DECLARE_HASH_MAP(BlockFile *, BlockFilePtr,
|
using ReplacedBlockFileHash = std::unordered_map<BlockFile *, BlockFilePtr>;
|
||||||
wxPointerHash, wxPointerEqual, ReplacedBlockFileHash);
|
using BoolBlockFileHash = std::unordered_map<BlockFile *, bool>;
|
||||||
WX_DECLARE_HASH_MAP(BlockFile *, bool,
|
|
||||||
wxPointerHash, wxPointerEqual, BoolBlockFileHash);
|
|
||||||
|
|
||||||
// Given a project, returns a single array of all SeqBlocks
|
// Given a project, returns a single array of all SeqBlocks
|
||||||
// in the current set of tracks. Enumerating that array allows
|
// in the current set of tracks. Enumerating that array allows
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
#include "xml/XMLTagHandler.h"
|
#include "xml/XMLTagHandler.h"
|
||||||
#include "wxFileNameWrapper.h"
|
#include "wxFileNameWrapper.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
class wxHashTable;
|
class wxHashTable;
|
||||||
class BlockArray;
|
class BlockArray;
|
||||||
class BlockFile;
|
class BlockFile;
|
||||||
@ -31,13 +35,12 @@ class SequenceTest;
|
|||||||
#define FSCKstatus_CHANGED 0x2
|
#define FSCKstatus_CHANGED 0x2
|
||||||
#define FSCKstatus_SAVE_AUP 0x4 // used in combination with FSCKstatus_CHANGED
|
#define FSCKstatus_SAVE_AUP 0x4 // used in combination with FSCKstatus_CHANGED
|
||||||
|
|
||||||
WX_DECLARE_HASH_MAP(int, int, wxIntegerHash, wxIntegerEqual, DirHash);
|
using DirHash = std::unordered_map<int, int>;
|
||||||
|
|
||||||
class BlockFile;
|
class BlockFile;
|
||||||
using BlockFilePtr = std::shared_ptr<BlockFile>;
|
using BlockFilePtr = std::shared_ptr<BlockFile>;
|
||||||
|
|
||||||
WX_DECLARE_HASH_MAP(wxString, std::weak_ptr<BlockFile>, wxStringHash,
|
using BlockHash = std::unordered_map< wxString, std::weak_ptr<BlockFile> >;
|
||||||
wxStringEqual, BlockHash);
|
|
||||||
|
|
||||||
wxMemorySize GetFreeMemory();
|
wxMemorySize GetFreeMemory();
|
||||||
|
|
||||||
|
@ -42,7 +42,11 @@
|
|||||||
|
|
||||||
#include "AudacityApp.h"
|
#include "AudacityApp.h"
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP(wxString, LangHash);
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using LangHash = std::unordered_map<wxString, wxString>;
|
||||||
|
|
||||||
static bool TranslationExists(wxArrayString &audacityPathList, wxString code)
|
static bool TranslationExists(wxArrayString &audacityPathList, wxString code)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,16 @@ using std::isinf;
|
|||||||
// To define function
|
// To define function
|
||||||
#include <tr1/functional>
|
#include <tr1/functional>
|
||||||
|
|
||||||
|
// To define unordered_set
|
||||||
|
#include <tr1/unordered_set>
|
||||||
|
|
||||||
|
// To define unordered_map and hash
|
||||||
|
#include <tr1/unordered_map>
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
using std::tr1::unordered_set;
|
||||||
|
using std::tr1::hash;
|
||||||
|
using std::tr1::unordered_map;
|
||||||
using std::tr1::function;
|
using std::tr1::function;
|
||||||
using std::tr1::shared_ptr;
|
using std::tr1::shared_ptr;
|
||||||
using std::tr1::weak_ptr;
|
using std::tr1::weak_ptr;
|
||||||
@ -1139,4 +1148,21 @@ make_value_transform_iterator(const Iterator &iterator, Function function)
|
|||||||
return { iterator, NewFunction{ function } };
|
return { iterator, NewFunction{ function } };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For using std::unordered_map on wxString
|
||||||
|
namespace std
|
||||||
|
#ifdef __AUDACITY_OLD_STD__
|
||||||
|
::tr1
|
||||||
|
#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 // __AUDACITY_MEMORY_X_H__
|
#endif // __AUDACITY_MEMORY_X_H__
|
||||||
|
@ -50,7 +50,11 @@
|
|||||||
|
|
||||||
#include "Experimental.h"
|
#include "Experimental.h"
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP(wxArrayString, ProviderMap);
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using ProviderMap = std::unordered_map<wxString, wxArrayString>;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
@ -390,7 +394,7 @@ struct ItemData
|
|||||||
int stateWidth;
|
int stateWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP(ItemData, ItemDataMap);
|
using ItemDataMap = std::unordered_map<wxString, ItemData>;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,6 @@ typedef std::map<PluginID, PluginDescriptor> PluginMap;
|
|||||||
|
|
||||||
typedef wxArrayString PluginIDList;
|
typedef wxArrayString PluginIDList;
|
||||||
|
|
||||||
class ProviderMap;
|
|
||||||
class PluginRegistrationDialog;
|
class PluginRegistrationDialog;
|
||||||
|
|
||||||
class PluginManager final : public PluginManagerInterface
|
class PluginManager final : public PluginManagerInterface
|
||||||
|
14
src/Tags.h
14
src/Tags.h
@ -41,6 +41,10 @@
|
|||||||
|
|
||||||
#include "widgets/wxPanelWrapper.h"
|
#include "widgets/wxPanelWrapper.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
class wxButton;
|
class wxButton;
|
||||||
class wxChoice;
|
class wxChoice;
|
||||||
class wxComboBox;
|
class wxComboBox;
|
||||||
@ -53,15 +57,7 @@ class ShuttleGui;
|
|||||||
class TagsEditor;
|
class TagsEditor;
|
||||||
class ComboEditor;
|
class ComboEditor;
|
||||||
|
|
||||||
// We want a macro call like this:
|
using TagMap = std::unordered_map< wxString, wxString >;
|
||||||
// WX_DECLARE_USER_EXPORTED_STRING_HASH_MAP(wxString, TagMap, AUDACITY_DLL_API);
|
|
||||||
// Which wxWidgets does not supply!
|
|
||||||
// So use this undocumented variant:
|
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxString, TagMap,class AUDACITY_DLL_API );
|
|
||||||
// Doing this means we can export class Tags without any worry,
|
|
||||||
// as every class it uses, including TagMap, is then exported.
|
|
||||||
// It's better than using #pragma warning(disable: 4251)
|
|
||||||
// and relying on the relevant parts of class Tags being private.
|
|
||||||
|
|
||||||
#define TAG_TITLE wxT("TITLE")
|
#define TAG_TITLE wxT("TITLE")
|
||||||
#define TAG_ARTIST wxT("ARTIST")
|
#define TAG_ARTIST wxT("ARTIST")
|
||||||
|
@ -36,8 +36,12 @@ UndoManager
|
|||||||
|
|
||||||
#include "UndoManager.h"
|
#include "UndoManager.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_set>
|
||||||
|
#endif
|
||||||
|
|
||||||
using ConstBlockFilePtr = const BlockFile*;
|
using ConstBlockFilePtr = const BlockFile*;
|
||||||
WX_DECLARE_HASH_SET(ConstBlockFilePtr, wxPointerHash, wxPointerEqual, Set );
|
using Set = std::unordered_set<ConstBlockFilePtr>;
|
||||||
|
|
||||||
struct UndoStackElem {
|
struct UndoStackElem {
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#include "audacity/Types.h"
|
#include "audacity/Types.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct MenuBarListEntry
|
struct MenuBarListEntry
|
||||||
{
|
{
|
||||||
MenuBarListEntry(const wxString &name_, wxMenuBar *menubar_)
|
MenuBarListEntry(const wxString &name_, wxMenuBar *menubar_)
|
||||||
@ -88,8 +92,8 @@ using SubMenuList = std::vector < movable_ptr<SubMenuListEntry> >;
|
|||||||
// so we don't want the structures to relocate with vector operations.
|
// so we don't want the structures to relocate with vector operations.
|
||||||
using CommandList = std::vector<movable_ptr<CommandListEntry>>;
|
using CommandList = std::vector<movable_ptr<CommandListEntry>>;
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(CommandListEntry *, CommandNameHash, class AUDACITY_DLL_API);
|
using CommandNameHash = std::unordered_map<wxString, CommandListEntry*>;
|
||||||
WX_DECLARE_HASH_MAP_WITH_DECL(int, CommandListEntry *, wxIntegerHash, wxIntegerEqual, CommandIDHash, class AUDACITY_DLL_API);
|
using CommandIDHash = std::unordered_map<int, CommandListEntry*>;
|
||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
|
|
||||||
|
@ -64,6 +64,10 @@ greater use in future.
|
|||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
#include "../commands/ScreenshotCommand.h"
|
#include "../commands/ScreenshotCommand.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
static const int kDummyID = 20000;
|
static const int kDummyID = 20000;
|
||||||
static const int kSaveAsID = 20001;
|
static const int kSaveAsID = 20001;
|
||||||
static const int kImportID = 20002;
|
static const int kImportID = 20002;
|
||||||
@ -88,7 +92,7 @@ const wxString Effect::kFactoryPresetIdent = wxT("Factory Preset:");
|
|||||||
const wxString Effect::kCurrentSettingsIdent = wxT("<Current Settings>");
|
const wxString Effect::kCurrentSettingsIdent = wxT("<Current Settings>");
|
||||||
const wxString Effect::kFactoryDefaultsIdent = wxT("<Factory Defaults>");
|
const wxString Effect::kFactoryDefaultsIdent = wxT("<Factory Defaults>");
|
||||||
|
|
||||||
WX_DECLARE_VOIDPTR_HASH_MAP( bool, t2bHash );
|
using t2bHash = std::unordered_map< void*, bool >;
|
||||||
|
|
||||||
Effect::Effect()
|
Effect::Effect()
|
||||||
{
|
{
|
||||||
|
@ -34,9 +34,13 @@ effects.
|
|||||||
#include "../PluginManager.h"
|
#include "../PluginManager.h"
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
using EffectArray = std::vector <Effect*> ;
|
using EffectArray = std::vector <Effect*> ;
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(Effect *, EffectMap, class AUDACITY_DLL_API);
|
using EffectMap = std::unordered_map<wxString, Effect *>;
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(std::shared_ptr<Effect>, EffectOwnerMap, class AUDACITY_DLL_API);
|
using EffectOwnerMap = std::unordered_map< wxString, std::shared_ptr<Effect> >;
|
||||||
|
|
||||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||||
class EffectRack;
|
class EffectRack;
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
|
|
||||||
#include "LoadLV2.h"
|
#include "LoadLV2.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LV2EFFECTS_VERSION wxT("1.0.0.0")
|
#define LV2EFFECTS_VERSION wxT("1.0.0.0")
|
||||||
#define LV2EFFECTS_FAMILY wxT("LV2")
|
#define LV2EFFECTS_FAMILY wxT("LV2")
|
||||||
|
|
||||||
@ -89,7 +93,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
WX_DECLARE_OBJARRAY(LV2Port, LV2PortArray);
|
WX_DECLARE_OBJARRAY(LV2Port, LV2PortArray);
|
||||||
WX_DECLARE_STRING_HASH_MAP(wxArrayInt, LV2GroupMap);
|
using LV2GroupMap = std::unordered_map<wxString, wxArrayInt>;
|
||||||
WX_DEFINE_ARRAY_PTR(LilvInstance *, LV2SlaveArray);
|
WX_DEFINE_ARRAY_PTR(LilvInstance *, LV2SlaveArray);
|
||||||
|
|
||||||
class LV2EffectSettingsDialog;
|
class LV2EffectSettingsDialog;
|
||||||
|
@ -43,6 +43,10 @@ Functions that find and load all LV2 plugins on the system.
|
|||||||
|
|
||||||
#include "LoadLV2.h"
|
#include "LoadLV2.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Module registration entry point
|
// Module registration entry point
|
||||||
//
|
//
|
||||||
@ -69,7 +73,7 @@ DECLARE_BUILTIN_MODULE(LV2sEffectBuiltin);
|
|||||||
// LV2EffectsModule
|
// LV2EffectsModule
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
WX_DECLARE_STRING_HASH_MAP(LilvNode *, UriHash);
|
using UriHash = std::unordered_map<wxString, LilvNode*>;
|
||||||
|
|
||||||
LilvWorld *gWorld = NULL;
|
LilvWorld *gWorld = NULL;
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ LRN
|
|||||||
#include "../FileNames.h"
|
#include "../FileNames.h"
|
||||||
#include "../widgets/wxPanelWrapper.h"
|
#include "../widgets/wxPanelWrapper.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// Identifiers for pre-set export types.
|
/// Identifiers for pre-set export types.
|
||||||
enum FFmpegExposedFormat
|
enum FFmpegExposedFormat
|
||||||
@ -316,7 +320,7 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
WX_DECLARE_STRING_HASH_MAP(FFmpegPreset, FFmpegPresetMap);
|
using FFmpegPresetMap = std::unordered_map<wxString, FFmpegPreset>;
|
||||||
|
|
||||||
class FFmpegPresets : XMLTagHandler
|
class FFmpegPresets : XMLTagHandler
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
#include "ImageRoll.h"
|
#include "ImageRoll.h"
|
||||||
#include "wxPanelWrapper.h"
|
#include "wxPanelWrapper.h"
|
||||||
|
|
||||||
|
#ifndef __AUDACITY_OLD_STD__
|
||||||
|
#include <unordered_map>
|
||||||
|
#endif
|
||||||
|
|
||||||
class wxDragImage;
|
class wxDragImage;
|
||||||
|
|
||||||
class AButton;
|
class AButton;
|
||||||
@ -36,7 +40,7 @@ class ToolBarGrabber;
|
|||||||
|
|
||||||
class ToolBarArrangement;
|
class ToolBarArrangement;
|
||||||
|
|
||||||
WX_DECLARE_VOIDPTR_HASH_MAP(int, WindowHash);
|
using WindowHash = std::unordered_map<void*, int>;
|
||||||
WX_DEFINE_ARRAY(ExpandingToolBar *, ExpandingToolBarArray);
|
WX_DEFINE_ARRAY(ExpandingToolBar *, ExpandingToolBarArray);
|
||||||
WX_DECLARE_OBJARRAY(wxRect, wxArrayRect);
|
WX_DECLARE_OBJARRAY(wxRect, wxArrayRect);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user