Pass non-primitive types by const reference instead of value.

No real changes, just avoid the unnecessary copying and also make the
signatures more consistent by adding the apparently forgotten "&" in a couple
of places.

See #15893.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-01-20 14:45:08 +00:00
parent 62e17153c2
commit d2f125aa35
7 changed files with 9 additions and 9 deletions

View File

@@ -65,7 +65,7 @@ public:
void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString ); void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename = wxEmptyString );
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#define wxFileCtrl wxGtkFileCtrl #define wxFileCtrl wxGtkFileCtrl

View File

@@ -91,7 +91,7 @@ public:
{ return DoPoke(item, ws, { return DoPoke(item, ws,
size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t)
: size, wxIPC_UNICODETEXT); } : size, wxIPC_UNICODETEXT); }
bool Poke(const wxString& item, const wxString s) bool Poke(const wxString& item, const wxString& s)
{ {
const wxScopedCharBuffer buf = s.utf8_str(); const wxScopedCharBuffer buf = s.utf8_str();
return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT);
@@ -113,7 +113,7 @@ public:
{ return DoAdvise(item, ws, { return DoAdvise(item, ws,
size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t)
: size, wxIPC_UNICODETEXT); } : size, wxIPC_UNICODETEXT); }
bool Advise(const wxString& item, const wxString s) bool Advise(const wxString& item, const wxString& s)
{ {
const wxScopedCharBuffer buf = s.utf8_str(); const wxScopedCharBuffer buf = s.utf8_str();
return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT);

View File

@@ -1692,7 +1692,7 @@ public:
@param text @param text
Initial text value of created wxTextCtrl. Initial text value of created wxTextCtrl.
*/ */
void SetupTextCtrlValue( const wxString text ) { m_prevTcValue = text; } void SetupTextCtrlValue( const wxString& text ) { m_prevTcValue = text; }
/** /**
Unfocuses or closes editor if one was open, but does not deselect Unfocuses or closes editor if one was open, but does not deselect

View File

@@ -903,7 +903,7 @@ public:
/** /**
Finds the container at the given point, which is in screen coordinates. Finds the container at the given point, which is in screen coordinates.
*/ */
wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0); wxRichTextParagraphLayoutBox* FindContainerAtPoint(const wxPoint& pt, long& position, int& hit, wxRichTextObject* hitObj, int flags = 0);
//@} //@}
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP

View File

@@ -237,8 +237,8 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent
{ {
public: public:
wxWebViewEvent() {} wxWebViewEvent() {}
wxWebViewEvent(wxEventType type, int id, const wxString url, wxWebViewEvent(wxEventType type, int id, const wxString& url,
const wxString target) const wxString& target)
: wxNotifyEvent(type, id), m_url(url), m_target(target) : wxNotifyEvent(type, id), m_url(url), m_target(target)
{} {}

View File

@@ -63,7 +63,7 @@ void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd)
wnd->GetEventHandler()->ProcessEvent( event ); wnd->GetEventHandler()->ProcessEvent( event );
} }
void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename ) void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename )
{ {
wxFileCtrlEvent event( wxEVT_FILECTRL_FILEACTIVATED, wnd, wnd->GetId() ); wxFileCtrlEvent event( wxEVT_FILECTRL_FILEACTIVATED, wnd, wnd->GetId() );
event.SetDirectory( fileCtrl->GetDirectory() ); event.SetDirectory( fileCtrl->GetDirectory() );

View File

@@ -2985,7 +2985,7 @@ wxRichTextCtrl::HitTest(const wxPoint& pt,
} }
wxRichTextParagraphLayoutBox* wxRichTextParagraphLayoutBox*
wxRichTextCtrl::FindContainerAtPoint(const wxPoint pt, long& position, int& hit, wxRichTextObject* hitObj, int flags/* = 0*/) wxRichTextCtrl::FindContainerAtPoint(const wxPoint& pt, long& position, int& hit, wxRichTextObject* hitObj, int flags/* = 0*/)
{ {
wxClientDC dc(this); wxClientDC dc(this);
PrepareDC(dc); PrepareDC(dc);