Use std::unordered_map<> in wxLogRecordInfo
Use the standard containers directly instead of using wx synonyms. Keep including wx/wxcrt.h from wx/log.h for compatibility as existing code may inadvertently rely on it being included from here, so allow such code using various wxStdFunctions() to keep compiling.
This commit is contained in:
parent
65bf966e3c
commit
5794296975
1 changed files with 13 additions and 5 deletions
|
|
@ -27,6 +27,13 @@ typedef unsigned long wxLogLevel;
|
|||
|
||||
#include "wx/string.h"
|
||||
|
||||
// This is a hack, but this header used to include wx/hashmap.h which, in turn,
|
||||
// included wx/wxcrt.h and it turns out quite some existing code relied on it
|
||||
// by using the CRT wrapper functions declared there without explicitly
|
||||
// including that header, so keep including it from here to let it continue to
|
||||
// compile.
|
||||
#include "wx/wxcrt.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -44,7 +51,6 @@ class WXDLLIMPEXP_FWD_BASE wxObject;
|
|||
#include <time.h> // for time_t
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/msgout.h"
|
||||
#include "wx/time.h"
|
||||
|
||||
|
|
@ -52,6 +58,8 @@ class WXDLLIMPEXP_FWD_BASE wxObject;
|
|||
#include "wx/thread.h"
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
// wxUSE_LOG_DEBUG enables the debug log messages
|
||||
#ifndef wxUSE_LOG_DEBUG
|
||||
#if wxDEBUG_LEVEL
|
||||
|
|
@ -236,7 +244,7 @@ public:
|
|||
if ( !m_data )
|
||||
return false;
|
||||
|
||||
const wxStringToNumHashMap::const_iterator it = m_data->numValues.find(key);
|
||||
const auto it = m_data->numValues.find(key);
|
||||
if ( it == m_data->numValues.end() )
|
||||
return false;
|
||||
|
||||
|
|
@ -250,7 +258,7 @@ public:
|
|||
if ( !m_data )
|
||||
return false;
|
||||
|
||||
const wxStringToStringHashMap::const_iterator it = m_data->strValues.find(key);
|
||||
const auto it = m_data->strValues.find(key);
|
||||
if ( it == m_data->strValues.end() )
|
||||
return false;
|
||||
|
||||
|
|
@ -272,8 +280,8 @@ private:
|
|||
// sink (e.g. wxLogSysError() uses this to pass the error code)
|
||||
struct ExtraData
|
||||
{
|
||||
wxStringToNumHashMap numValues;
|
||||
wxStringToStringHashMap strValues;
|
||||
std::unordered_map<wxString, wxUIntPtr> numValues;
|
||||
std::unordered_map<wxString, wxString> strValues;
|
||||
};
|
||||
|
||||
// nullptr if not used
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue