Use macros to define default copy constructor and assignment operator
This commit is contained in:
@@ -172,8 +172,7 @@ Currently the following symbols exist:
|
|||||||
@itemdef{wxHAS_CONFIG_TEMPLATE_RW, Defined if the currently used compiler
|
@itemdef{wxHAS_CONFIG_TEMPLATE_RW, Defined if the currently used compiler
|
||||||
supports template Read() and Write() methods in wxConfig.}
|
supports template Read() and Write() methods in wxConfig.}
|
||||||
@itemdef{wxHAS_MEMBER_DEFAULT, Defined if the currently used compiler supports
|
@itemdef{wxHAS_MEMBER_DEFAULT, Defined if the currently used compiler supports
|
||||||
C++11 @c =default. @c wxMEMBER_DEFAULT is defined as this keyword in this
|
C++11 @c =default.}
|
||||||
case, and as nothing otherwise.}
|
|
||||||
@itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in
|
@itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in
|
||||||
size (notice that you must include @c wx/filefn.h before testing for this
|
size (notice that you must include @c wx/filefn.h before testing for this
|
||||||
symbol).}
|
symbol).}
|
||||||
|
@@ -38,10 +38,7 @@ public:
|
|||||||
wxAnimation();
|
wxAnimation();
|
||||||
explicit wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
explicit wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY);
|
||||||
|
|
||||||
#ifdef wxHAS_MEMBER_DEFAULT
|
wxDECLARE_DEFAULT_COPY_CLASS(wxAnimation);
|
||||||
wxAnimation(const wxAnimation&) wxMEMBER_DEFAULT;
|
|
||||||
wxAnimation& operator=(const wxAnimation&) wxMEMBER_DEFAULT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool IsOk() const;
|
bool IsOk() const;
|
||||||
bool IsCompatibleWith(wxClassInfo* ci) const;
|
bool IsCompatibleWith(wxClassInfo* ci) const;
|
||||||
|
@@ -290,13 +290,10 @@ typedef short int WXTYPE;
|
|||||||
still requires handling MSVS specially, unfortunately) */
|
still requires handling MSVS specially, unfortunately) */
|
||||||
#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14)
|
#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14)
|
||||||
#define wxHAS_MEMBER_DEFAULT
|
#define wxHAS_MEMBER_DEFAULT
|
||||||
#define wxMEMBER_DEFAULT = default
|
|
||||||
|
|
||||||
#define wxHAS_NOEXCEPT
|
#define wxHAS_NOEXCEPT
|
||||||
#define wxNOEXCEPT noexcept
|
#define wxNOEXCEPT noexcept
|
||||||
#else
|
#else
|
||||||
#define wxMEMBER_DEFAULT
|
|
||||||
|
|
||||||
#define wxNOEXCEPT
|
#define wxNOEXCEPT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3042,6 +3039,22 @@ typedef const void* WXWidget;
|
|||||||
#define DECLARE_NO_ASSIGN_CLASS(classname) \
|
#define DECLARE_NO_ASSIGN_CLASS(classname) \
|
||||||
wxDECLARE_NO_ASSIGN_CLASS(classname);
|
wxDECLARE_NO_ASSIGN_CLASS(classname);
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------- */
|
||||||
|
/* macros to define a class with default copy constructor and/or assignment operator */
|
||||||
|
/* --------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef wxHAS_MEMBER_DEFAULT
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_CTOR(classname) \
|
||||||
|
classname(const classname&) = default
|
||||||
|
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_CLASS(classname) \
|
||||||
|
wxDECLARE_DEFAULT_COPY_CTOR(classname); \
|
||||||
|
classname& operator=(const classname&) = default
|
||||||
|
#else
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_CTOR(classname)
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_CLASS(classname)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------- */
|
||||||
/* If a manifest is being automatically generated, add common controls 6 to it */
|
/* If a manifest is being automatically generated, add common controls 6 to it */
|
||||||
/* --------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------- */
|
||||||
|
@@ -267,9 +267,7 @@ public:
|
|||||||
wxUniCharRef& operator=(const wxUniCharRef& c)
|
wxUniCharRef& operator=(const wxUniCharRef& c)
|
||||||
{ if (&c != this) *this = c.UniChar(); return *this; }
|
{ if (&c != this) *this = c.UniChar(); return *this; }
|
||||||
|
|
||||||
#ifdef wxHAS_MEMBER_DEFAULT
|
wxDECLARE_DEFAULT_COPY_CTOR(wxUniCharRef);
|
||||||
wxUniCharRef(const wxUniCharRef&) wxMEMBER_DEFAULT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL(type) \
|
#define wxUNICHAR_REF_DEFINE_OPERATOR_EQUAL(type) \
|
||||||
wxUniCharRef& operator=(type c) { return *this = wxUniChar(c); }
|
wxUniCharRef& operator=(type c) { return *this = wxUniChar(c); }
|
||||||
|
@@ -1561,6 +1561,22 @@ typedef double wxDouble;
|
|||||||
*/
|
*/
|
||||||
#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2)
|
#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2)
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro can be used in a class declaration to enable declaring the
|
||||||
|
default copy constructor and assignment operator.
|
||||||
|
|
||||||
|
@since 3.1.4
|
||||||
|
*/
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_CLASS(classname)
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro can be used in a class declaration to enable declaring the
|
||||||
|
default copy constructor.
|
||||||
|
|
||||||
|
@since 3.1.4
|
||||||
|
*/
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_CTOR(classname)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A function which deletes and nulls the pointer.
|
A function which deletes and nulls the pointer.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user