Pass parameters by const reference rather than by value

This commit is contained in:
Paul Cornett
2019-04-05 09:18:07 -07:00
parent d52acfe469
commit 365759753a
8 changed files with 17 additions and 17 deletions

View File

@@ -428,7 +428,7 @@ public:
virtual bool DoShowDialog( wxPropertyGrid* propGrid, virtual bool DoShowDialog( wxPropertyGrid* propGrid,
wxPGProperty* property ) = 0; wxPGProperty* property ) = 0;
void SetValue( wxVariant value ) void SetValue( const wxVariant& value )
{ {
m_value = value; m_value = value;
} }

View File

@@ -1736,7 +1736,7 @@ public:
// Helper function (for wxPython bindings and such) for settings protected // Helper function (for wxPython bindings and such) for settings protected
// m_value. // m_value.
void SetValuePlain( wxVariant value ) void SetValuePlain( const wxVariant& value )
{ {
m_value = value; m_value = value;
} }

View File

@@ -1299,7 +1299,7 @@ public:
// changed after the function returns (with true as return value). // changed after the function returns (with true as return value).
// ValueChangeInEvent() must be used if you wish the application to be // ValueChangeInEvent() must be used if you wish the application to be
// able to use wxEVT_PG_CHANGING to potentially veto the given value. // able to use wxEVT_PG_CHANGING to potentially veto the given value.
void ValueChangeInEvent( wxVariant variant ) void ValueChangeInEvent( const wxVariant& variant )
{ {
m_changeInEventValue = variant; m_changeInEventValue = variant;
m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT; m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT;
@@ -2203,7 +2203,7 @@ public:
m_propertyName = p->GetName(); m_propertyName = p->GetName();
} }
void SetPropertyValue( wxVariant value ) void SetPropertyValue( const wxVariant& value )
{ {
m_value = value; m_value = value;
} }

View File

@@ -137,16 +137,16 @@ public:
////@begin wxSymbolPickerDialog member function declarations ////@begin wxSymbolPickerDialog member function declarations
wxString GetFontName() const { return m_fontName ; } wxString GetFontName() const { return m_fontName ; }
void SetFontName(wxString value) { m_fontName = value ; } void SetFontName(const wxString& value) { m_fontName = value; }
bool GetFromUnicode() const { return m_fromUnicode ; } bool GetFromUnicode() const { return m_fromUnicode ; }
void SetFromUnicode(bool value) { m_fromUnicode = value ; } void SetFromUnicode(bool value) { m_fromUnicode = value ; }
wxString GetNormalTextFontName() const { return m_normalTextFontName ; } wxString GetNormalTextFontName() const { return m_normalTextFontName ; }
void SetNormalTextFontName(wxString value) { m_normalTextFontName = value ; } void SetNormalTextFontName(const wxString& value) { m_normalTextFontName = value; }
wxString GetSymbol() const { return m_symbol ; } wxString GetSymbol() const { return m_symbol ; }
void SetSymbol(wxString value) { m_symbol = value ; } void SetSymbol(const wxString& value) { m_symbol = value; }
/// Retrieves bitmap resources /// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name ); wxBitmap GetBitmapResource( const wxString& name );

View File

@@ -52,7 +52,7 @@ double MyDistance(const myVec3& v1, const myVec3& v2)
} }
// Angle between two normalized vectors, in radians // Angle between two normalized vectors, in radians
double AngleBetween(myVec3 v1, myVec3 v2) double AngleBetween(const myVec3& v1, const myVec3& v2)
{ {
double angle = MyDot(v1, v2); double angle = MyDot(v1, v2);
// Prevent issues due to numerical precision // Prevent issues due to numerical precision

View File

@@ -56,7 +56,7 @@ myVec3 MyCross(const myVec3& v1, const myVec3& v2);
double MyDistance(const myVec3& v1, const myVec3& v2); double MyDistance(const myVec3& v1, const myVec3& v2);
// Angle between two normalized vectors, in radians // Angle between two normalized vectors, in radians
double AngleBetween(myVec3 v1, myVec3 v2); double AngleBetween(const myVec3& v1, const myVec3& v2);
// Matrix 4x4 by 4x1 multiplication // Matrix 4x4 by 4x1 multiplication
myVec4 MyMatMul4x1(const double *m1, const myVec4& v); myVec4 MyMatMul4x1(const double *m1, const myVec4& v);

View File

@@ -305,14 +305,14 @@ void myOGLShaders::AddCode(const GLchar* shaString, GLenum shaType)
m_shaCode.push_back(sv); m_shaCode.push_back(sv);
} }
void myOGLShaders::AddAttrib(std::string name) void myOGLShaders::AddAttrib(const std::string& name)
{ {
shaVars sv = {0, name}; //We will set the location later shaVars sv = {0, name}; //We will set the location later
m_shaAttrib.push_back(sv); m_shaAttrib.push_back(sv);
// We don't check the max number of attribute locations (usually 16) // We don't check the max number of attribute locations (usually 16)
} }
void myOGLShaders::AddUnif(std::string name) void myOGLShaders::AddUnif(const std::string& name)
{ {
shaVars sv = {0, name}; shaVars sv = {0, name};
m_shaUnif.push_back(sv); m_shaUnif.push_back(sv);
@@ -333,7 +333,7 @@ void myOGLShaders::SetAttribLocations()
} }
} }
GLuint myOGLShaders::GetAttribLoc(std::string name) GLuint myOGLShaders::GetAttribLoc(const std::string& name)
{ {
for (shaVars_v::iterator it = m_shaAttrib.begin(); it != m_shaAttrib.end(); ++it) for (shaVars_v::iterator it = m_shaAttrib.begin(); it != m_shaAttrib.end(); ++it)
{ {
@@ -362,7 +362,7 @@ bool myOGLShaders::AskUnifLocations()
return true; return true;
} }
GLuint myOGLShaders::GetUnifLoc(std::string name) GLuint myOGLShaders::GetUnifLoc(const std::string& name)
{ {
for (shaVars_v::iterator it = m_shaUnif.begin(); it != m_shaUnif.end(); ++it) for (shaVars_v::iterator it = m_shaUnif.begin(); it != m_shaUnif.end(); ++it)
{ {

View File

@@ -109,10 +109,10 @@ public:
void CleanUp(); void CleanUp();
void AddCode(const GLchar* shaString, GLenum shaType); void AddCode(const GLchar* shaString, GLenum shaType);
void AddAttrib(std::string name); void AddAttrib(const std::string& name);
void AddUnif(std::string name); void AddUnif(const std::string& name);
GLuint GetAttribLoc(std::string name); GLuint GetAttribLoc(const std::string& name);
GLuint GetUnifLoc(std::string name); GLuint GetUnifLoc(const std::string& name);
// Disable generic vertex attribute array // Disable generic vertex attribute array
void DisableGenericVAA(); void DisableGenericVAA();