Fix building with wxUSE_STL enabled in VS2019 16.6
Exporting standard C++ library types is not allowed any more, see https://developercommunity.visualstudio.com/content/problem/1042081/142628801includexhash201332-error-c2338-this-funct.html so don't use DLL export declarations for wxHash{Map,Set} classes, which derive from std::{map,set}. Since the classes are header-only, this should have no direct consequences. Only classes that extend wxHashMap or wxHashSet, like wxImageHistogram, have to be made header only as well. Remove the wxLogError message in wxImageHistogram::FindFirstUnusedColour, so log.h and translation.h do not have to be included in the header. Closes https://github.com/wxWidgets/wxWidgets/pull/2009
This commit is contained in:
committed by
Vadim Zeitlin
parent
5aa1f4e953
commit
590e32c60b
@@ -678,24 +678,27 @@ public: \
|
|||||||
|
|
||||||
// and these do exactly the same thing but should be used inside the
|
// and these do exactly the same thing but should be used inside the
|
||||||
// library
|
// library
|
||||||
|
// note: DECL is not used since the class is inline
|
||||||
#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
|
#define WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
|
||||||
_WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL )
|
_WX_DECLARE_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME, class )
|
||||||
|
|
||||||
#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \
|
#define WX_DECLARE_EXPORTED_HASH_MAP( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, CLASSNAME) \
|
||||||
WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \
|
WX_DECLARE_HASH_MAP_WITH_DECL( KEY_T, VALUE_T, HASH_T, KEY_EQ_T, \
|
||||||
CLASSNAME, class WXDLLIMPEXP_CORE )
|
CLASSNAME, class WXDLLIMPEXP_CORE )
|
||||||
|
|
||||||
|
// note: DECL is not used since the class is inline
|
||||||
#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
|
#define WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
|
||||||
_WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \
|
_WX_DECLARE_HASH_MAP( wxString, VALUE_T, wxStringHash, wxStringEqual, \
|
||||||
CLASSNAME, DECL )
|
CLASSNAME, class )
|
||||||
|
|
||||||
#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \
|
#define WX_DECLARE_EXPORTED_STRING_HASH_MAP( VALUE_T, CLASSNAME ) \
|
||||||
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
|
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
|
||||||
class WXDLLIMPEXP_CORE )
|
class WXDLLIMPEXP_CORE )
|
||||||
|
|
||||||
|
// note: DECL is not used since the class is inline
|
||||||
#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
|
#define WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, DECL ) \
|
||||||
_WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
|
_WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
|
||||||
CLASSNAME, DECL )
|
CLASSNAME, class )
|
||||||
|
|
||||||
#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \
|
#define WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP( VALUE_T, CLASSNAME ) \
|
||||||
WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
|
WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL( VALUE_T, CLASSNAME, \
|
||||||
|
@@ -159,8 +159,9 @@ public: \
|
|||||||
|
|
||||||
// and these do exactly the same thing but should be used inside the
|
// and these do exactly the same thing but should be used inside the
|
||||||
// library
|
// library
|
||||||
|
// note: DECL is not used since the class is inline
|
||||||
#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
|
#define WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
|
||||||
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, DECL )
|
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NORMAL, CLASSNAME, class )
|
||||||
|
|
||||||
#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
|
#define WX_DECLARE_EXPORTED_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
|
||||||
WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \
|
WX_DECLARE_HASH_SET_WITH_DECL( KEY_T, HASH_T, KEY_EQ_T, \
|
||||||
@@ -173,8 +174,9 @@ public: \
|
|||||||
// common compilers (notably Sun CC).
|
// common compilers (notably Sun CC).
|
||||||
#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
|
#define WX_DECLARE_HASH_SET_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME) \
|
||||||
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class )
|
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class )
|
||||||
|
// note: DECL is not used since the class is inline
|
||||||
#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
|
#define WX_DECLARE_HASH_SET_WITH_DECL_PTR( KEY_T, HASH_T, KEY_EQ_T, CLASSNAME, DECL) \
|
||||||
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, DECL )
|
_WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, wxPTROP_NOP, CLASSNAME, class )
|
||||||
|
|
||||||
// delete all hash elements
|
// delete all hash elements
|
||||||
//
|
//
|
||||||
|
@@ -190,7 +190,7 @@ WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
|
|||||||
wxIntegerHash, wxIntegerEqual,
|
wxIntegerHash, wxIntegerEqual,
|
||||||
wxImageHistogramBase);
|
wxImageHistogramBase);
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxImageHistogram : public wxImageHistogramBase
|
class wxImageHistogram : public wxImageHistogramBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxImageHistogram() : wxImageHistogramBase(256) { }
|
wxImageHistogram() : wxImageHistogramBase(256) { }
|
||||||
@@ -211,9 +211,43 @@ public:
|
|||||||
bool FindFirstUnusedColour(unsigned char *r,
|
bool FindFirstUnusedColour(unsigned char *r,
|
||||||
unsigned char *g,
|
unsigned char *g,
|
||||||
unsigned char *b,
|
unsigned char *b,
|
||||||
unsigned char startR = 1,
|
unsigned char r2 = 1,
|
||||||
unsigned char startG = 0,
|
unsigned char g2 = 0,
|
||||||
unsigned char startB = 0 ) const;
|
unsigned char b2 = 0 ) const
|
||||||
|
{
|
||||||
|
unsigned long key = MakeKey(r2, g2, b2);
|
||||||
|
|
||||||
|
while ( find(key) != end() )
|
||||||
|
{
|
||||||
|
// color already used
|
||||||
|
r2++;
|
||||||
|
if ( r2 >= 255 )
|
||||||
|
{
|
||||||
|
r2 = 0;
|
||||||
|
g2++;
|
||||||
|
if ( g2 >= 255 )
|
||||||
|
{
|
||||||
|
g2 = 0;
|
||||||
|
b2++;
|
||||||
|
if ( b2 >= 255 )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
key = MakeKey(r2, g2, b2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( r )
|
||||||
|
*r = r2;
|
||||||
|
if ( g )
|
||||||
|
*g = g2;
|
||||||
|
if ( b )
|
||||||
|
*b = b2;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -3381,49 +3381,6 @@ wxImageHandler::GetResolutionFromOptions(const wxImage& image, int *x, int *y)
|
|||||||
// image histogram stuff
|
// image histogram stuff
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool
|
|
||||||
wxImageHistogram::FindFirstUnusedColour(unsigned char *r,
|
|
||||||
unsigned char *g,
|
|
||||||
unsigned char *b,
|
|
||||||
unsigned char r2,
|
|
||||||
unsigned char g2,
|
|
||||||
unsigned char b2) const
|
|
||||||
{
|
|
||||||
unsigned long key = MakeKey(r2, g2, b2);
|
|
||||||
|
|
||||||
while ( find(key) != end() )
|
|
||||||
{
|
|
||||||
// color already used
|
|
||||||
r2++;
|
|
||||||
if ( r2 >= 255 )
|
|
||||||
{
|
|
||||||
r2 = 0;
|
|
||||||
g2++;
|
|
||||||
if ( g2 >= 255 )
|
|
||||||
{
|
|
||||||
g2 = 0;
|
|
||||||
b2++;
|
|
||||||
if ( b2 >= 255 )
|
|
||||||
{
|
|
||||||
wxLogError(_("No unused colour in image.") );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
key = MakeKey(r2, g2, b2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( r )
|
|
||||||
*r = r2;
|
|
||||||
if ( g )
|
|
||||||
*g = g2;
|
|
||||||
if ( b )
|
|
||||||
*b = b2;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
wxImage::FindFirstUnusedColour(unsigned char *r,
|
wxImage::FindFirstUnusedColour(unsigned char *r,
|
||||||
unsigned char *g,
|
unsigned char *g,
|
||||||
|
Reference in New Issue
Block a user