Replace wx_static_cast/wx_const_cast/wx_reinterpret_cast with the function-style casts

See #17655.
This commit is contained in:
ARATA Mizuki
2016-08-30 18:07:32 +09:00
parent b99d28bb46
commit 1e6251d592
7 changed files with 11 additions and 44 deletions

View File

@@ -108,7 +108,7 @@ class-specific shared data. For example:
@code
MyClassRefData* GetData() const
{
return wx_static_cast(MyClassRefData*, m_refData);
return static_cast<MyClassRefData*>(m_refData);
}
@endcode

View File

@@ -337,7 +337,7 @@ typedef short int WXTYPE;
#endif
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj)
#define wxConstCast(obj, className) const_cast<className *>(obj)
#ifndef HAVE_STD_WSTRING
#if __cplusplus >= 201103L
@@ -1284,7 +1284,7 @@ inline wxUIntPtr wxPtrToUInt(const void *p)
#pragma warning(disable: 1684)
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
return reinterpret_cast<wxUIntPtr>(p);
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
@@ -1303,7 +1303,7 @@ inline void *wxUIntToPtr(wxUIntPtr p)
#pragma warning(disable: 171)
#endif
return wx_reinterpret_cast(void *, p);
return reinterpret_cast<void *>(p);
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)

View File

@@ -238,7 +238,7 @@ public:
Node *GetNext() const { return m_next; }
Node *GetPrevious() const { return m_previous; }
T *GetData() const { return m_data; }
T **GetDataPtr() const { return &(wx_const_cast(nodetype*,this)->m_data); }
T **GetDataPtr() const { return &(const_cast<nodetype*>(this)->m_data); }
void SetData( T *data ) { m_data = data; }
int IndexOf() const

View File

@@ -789,39 +789,6 @@ public:
*/
#define wxIMPLEMENT_CLASS2( className, baseClassName1, baseClassName2 )
/**
Same as @c const_cast<T>(x) if the compiler supports const cast or @c (T)x for
old compilers. Unlike wxConstCast(), the cast it to the type @c T and not to
<tt>T *</tt> and also the order of arguments is the same as for the standard cast.
@header{wx/defs.h}
@see wx_reinterpret_cast(), wx_static_cast()
*/
#define wx_const_cast(T, x)
/**
Same as @c reinterpret_cast<T>(x) if the compiler supports reinterpret cast or
@c (T)x for old compilers.
@header{wx/defs.h}
@see wx_const_cast(), wx_static_cast()
*/
#define wx_reinterpret_cast(T, x)
/**
Same as @c static_cast<T>(x) if the compiler supports static cast or @c (T)x for
old compilers. Unlike wxStaticCast(), there are no checks being done and
the meaning of the macro arguments is exactly the same as for the standard
static cast, i.e. @a T is the full type name and star is not appended to it.
@header{wx/defs.h}
@see wx_const_cast(), wx_reinterpret_cast(), wx_truncate_cast()
*/
#define wx_static_cast(T, x)
/**
This case doesnt correspond to any standard cast but exists solely to make
casts which possibly result in a truncation of an integer value more
@@ -837,7 +804,7 @@ public:
@header{wx/defs.h}
@see wx_const_cast(), wxDynamicCast(), wxStaticCast()
@see wxDynamicCast(), wxStaticCast()
*/
#define wxConstCast( ptr, classname )
@@ -889,7 +856,7 @@ public:
@header{wx/object.h}
@see wx_static_cast(), wxDynamicCast(), wxConstCast()
@see wxDynamicCast(), wxConstCast()
*/
#define wxStaticCast( ptr, classname )

View File

@@ -89,7 +89,7 @@ public:
// wxMSW is one of the platforms where the generic implementation
// of wxFilePickerCtrl is used...
wxButton *pButt = wx_static_cast(wxButton*, myFilePickerCtrl->GetPickerCtrl());
wxButton *pButt = static_cast<wxButton*>(myFilePickerCtrl->GetPickerCtrl());
if (pButt)
pButt->SetLabel("Custom browse string");
#endif

View File

@@ -262,7 +262,7 @@ void ClassListDialog::InitControls()
bool ClassListDialog::IsToDiscard(const wxString &classname) const
{
wxCheckBox *cb = wx_static_cast(wxCheckBox*, FindWindow(ID_SHOW_ONLY_XTI));
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_ONLY_XTI));
if (!cb || !cb->IsChecked())
return false;
@@ -288,7 +288,7 @@ void ClassListDialog::UpdateFilterText()
void ClassListDialog::UpdateClassInfo(const wxString &itemName)
{
wxString classname = itemName.BeforeFirst(wxT(' '));
wxCheckBox *cb = wx_static_cast(wxCheckBox*, FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
m_pTextCtrl->SetValue(
DumpClassInfo(wxClassInfo::FindClass(classname), cb->IsChecked()));

View File

@@ -671,7 +671,7 @@ bool wxGLCanvasX11::InitXVisualInfo(const wxGLAttributes& dispAttrs,
{
*pFBC = NULL;
*pXVisual = glXChooseVisual(dpy, DefaultScreen(dpy),
wx_const_cast(int*, attrsListGLX) );
const_cast<int*>(attrsListGLX) );
}
return *pXVisual != NULL;