From b5d4c6068e131800f732fd26c1f53c8efc8e780d Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 17 Mar 2021 09:44:48 -0700 Subject: [PATCH] Make some member functions const --- include/wx/glcanvas.h | 2 +- include/wx/graphics.h | 2 +- include/wx/html/helpdata.h | 8 ++++---- include/wx/html/htmlcell.h | 2 +- include/wx/html/winpars.h | 2 +- include/wx/ipcbase.h | 2 +- include/wx/layout.h | 4 ++-- include/wx/paper.h | 16 ++++++++-------- include/wx/process.h | 4 ++-- interface/wx/graphics.h | 2 +- interface/wx/layout.h | 4 ++-- interface/wx/process.h | 4 ++-- src/common/paper.cpp | 16 ++++++++-------- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/wx/glcanvas.h b/include/wx/glcanvas.h index d21f0d45b8..9338c850d7 100644 --- a/include/wx/glcanvas.h +++ b/include/wx/glcanvas.h @@ -185,7 +185,7 @@ public: // set this context as the current one virtual bool SetCurrent(const wxGLCanvas& win) const = 0; - bool IsOK() { return m_isOk; } + bool IsOK() const { return m_isOk; } protected: bool m_isOk; diff --git a/include/wx/graphics.h b/include/wx/graphics.h index 1320a22cf4..8196cb8ce3 100644 --- a/include/wx/graphics.h +++ b/include/wx/graphics.h @@ -876,7 +876,7 @@ public: virtual void EnableOffset(bool enable = true); void DisableOffset() { EnableOffset(false); } - bool OffsetEnabled() { return m_enableOffset; } + bool OffsetEnabled() const { return m_enableOffset; } protected: // These fields must be initialized in the derived class ctors. diff --git a/include/wx/html/helpdata.h b/include/wx/html/helpdata.h index eb3a72f66c..8e54cd7a2c 100644 --- a/include/wx/html/helpdata.h +++ b/include/wx/html/helpdata.h @@ -138,10 +138,10 @@ public: bool case_sensitive, bool whole_words_only, const wxString& book = wxEmptyString); bool Search(); // do the next iteration - bool IsActive() { return m_Active; } - int GetCurIndex() { return m_CurIndex; } - int GetMaxIndex() { return m_MaxIndex; } - const wxString& GetName() { return m_Name; } + bool IsActive() const { return m_Active; } + int GetCurIndex() const { return m_CurIndex; } + int GetMaxIndex() const { return m_MaxIndex; } + const wxString& GetName() const { return m_Name; } const wxHtmlHelpDataItem *GetCurItem() const { return m_CurItem; } diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index 0068c8c173..e555c26416 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -222,7 +222,7 @@ public: void SetScriptMode(wxHtmlScriptMode mode, long previousBase); wxHtmlScriptMode GetScriptMode() const { return m_ScriptMode; } - long GetScriptBaseline() { return m_ScriptBaseline; } + long GetScriptBaseline() const { return m_ScriptBaseline; } // Formatting cells are not visible on the screen, they only alter // renderer's state. diff --git a/include/wx/html/winpars.h b/include/wx/html/winpars.h index 03da8c0458..97d5a87f02 100644 --- a/include/wx/html/winpars.h +++ b/include/wx/html/winpars.h @@ -55,7 +55,7 @@ public: void SetDC(wxDC *dc, double pixel_scale, double font_scale); wxDC *GetDC() {return m_DC;} - double GetPixelScale() {return m_PixelScale;} + double GetPixelScale() const { return m_PixelScale; } int GetCharHeight() const {return m_CharHeight;} int GetCharWidth() const {return m_CharWidth;} diff --git a/include/wx/ipcbase.h b/include/wx/ipcbase.h index 864a2ec3ea..9d13867d78 100644 --- a/include/wx/ipcbase.h +++ b/include/wx/ipcbase.h @@ -58,7 +58,7 @@ public: virtual ~wxConnectionBase(); void SetConnected( bool c ) { m_connected = c; } - bool GetConnected() { return m_connected; } + bool GetConnected() const { return m_connected; } // Calls that CLIENT can make bool Execute(const void *data, size_t size, wxIPCFormat fmt = wxIPC_PRIVATE) diff --git a/include/wx/layout.h b/include/wx/layout.h index 829fa9d8e2..2b062584d9 100644 --- a/include/wx/layout.h +++ b/include/wx/layout.h @@ -112,14 +112,14 @@ public: wxEdge GetMyEdge() const { return myEdge; } void SetEdge(wxEdge which) { myEdge = which; } void SetValue(int v) { value = v; } - int GetMargin() { return margin; } + int GetMargin() const { return margin; } void SetMargin(int m) { margin = m; } int GetValue() const { return value; } int GetPercent() const { return percent; } int GetOtherEdge() const { return otherEdge; } bool GetDone() const { return done; } void SetDone(bool d) { done = d; } - wxRelationship GetRelationship() { return relationship; } + wxRelationship GetRelationship() const { return relationship; } void SetRelationship(wxRelationship r) { relationship = r; } // Reset constraint if it mentions otherWin diff --git a/include/wx/paper.h b/include/wx/paper.h index 19e6d26a45..a86b7aa208 100644 --- a/include/wx/paper.h +++ b/include/wx/paper.h @@ -82,28 +82,28 @@ public: void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h); // Find by name - wxPrintPaperType *FindPaperType(const wxString& name); + wxPrintPaperType *FindPaperType(const wxString& name) const; // Find by size id - wxPrintPaperType *FindPaperType(wxPaperSize id); + wxPrintPaperType *FindPaperType(wxPaperSize id) const; // Find by platform id - wxPrintPaperType *FindPaperTypeByPlatformId(int id); + wxPrintPaperType *FindPaperTypeByPlatformId(int id) const; // Find by size - wxPrintPaperType *FindPaperType(const wxSize& size); + wxPrintPaperType *FindPaperType(const wxSize& size) const; // Convert name to size id - wxPaperSize ConvertNameToId(const wxString& name); + wxPaperSize ConvertNameToId(const wxString& name) const; // Convert size id to name - wxString ConvertIdToName(wxPaperSize paperId); + wxString ConvertIdToName(wxPaperSize paperId) const; // Get the paper size - wxSize GetSize(wxPaperSize paperId); + wxSize GetSize(wxPaperSize paperId) const; // Get the paper size - wxPaperSize GetSize(const wxSize& size); + wxPaperSize GetSize(const wxSize& size) const; // wxPrintPaperType* Item(size_t index) const; diff --git a/include/wx/process.h b/include/wx/process.h index 733275d99a..bf32dd9281 100644 --- a/include/wx/process.h +++ b/include/wx/process.h @@ -167,10 +167,10 @@ public: // accessors // PID of process which terminated - int GetPid() { return m_pid; } + int GetPid() const { return m_pid; } // the exit code - int GetExitCode() { return m_exitcode; } + int GetExitCode() const { return m_exitcode; } // implement the base class pure virtual virtual wxEvent *Clone() const wxOVERRIDE { return new wxProcessEvent(*this); } diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index 768a4305e0..7e3c79bb09 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -1154,7 +1154,7 @@ public: virtual void EnableOffset(bool enable = true); void DisableOffset(); - bool OffsetEnabled(); + bool OffsetEnabled() const; /** @} */ diff --git a/interface/wx/layout.h b/interface/wx/layout.h index 02da3feb23..667752b25e 100644 --- a/interface/wx/layout.h +++ b/interface/wx/layout.h @@ -84,14 +84,14 @@ public: wxEdge GetMyEdge() const; void SetEdge(wxEdge which); void SetValue(int v); - int GetMargin(); + int GetMargin() const; void SetMargin(int m); int GetValue() const; int GetPercent() const; int GetOtherEdge() const; bool GetDone() const; void SetDone(bool d); - wxRelationship GetRelationship(); + wxRelationship GetRelationship() const; void SetRelationship(wxRelationship r); // Reset constraint if it mentions otherWin diff --git a/interface/wx/process.h b/interface/wx/process.h index 50d49398b4..96fd157f0b 100644 --- a/interface/wx/process.h +++ b/interface/wx/process.h @@ -305,12 +305,12 @@ public: /** Returns the exist status. */ - int GetExitCode(); + int GetExitCode() const; /** Returns the process id. */ - int GetPid(); + int GetPid() const; }; diff --git a/src/common/paper.cpp b/src/common/paper.cpp index 43b2c13312..bfbc0d76f5 100644 --- a/src/common/paper.cpp +++ b/src/common/paper.cpp @@ -236,7 +236,7 @@ void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, int platformId, con m_list->push_back(tmp); } -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) +wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) const { wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name); if (it != m_map->end()) @@ -245,7 +245,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) return NULL; } -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) +wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) const { typedef wxStringToPrintPaperTypeHashMap::iterator iterator; @@ -259,7 +259,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) return NULL; } -wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) +wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) const { typedef wxStringToPrintPaperTypeHashMap::iterator iterator; @@ -273,7 +273,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) return NULL; } -wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) +wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) const { // Take the item ordering into account so that the more common types // are likely to be taken into account first. This fixes problems with, @@ -291,7 +291,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) } // Convert name to size id -wxPaperSize wxPrintPaperDatabase::ConvertNameToId(const wxString& name) +wxPaperSize wxPrintPaperDatabase::ConvertNameToId(const wxString& name) const { wxPrintPaperType* type = FindPaperType(name); if (type) @@ -301,7 +301,7 @@ wxPaperSize wxPrintPaperDatabase::ConvertNameToId(const wxString& name) } // Convert size id to name -wxString wxPrintPaperDatabase::ConvertIdToName(wxPaperSize paperId) +wxString wxPrintPaperDatabase::ConvertIdToName(wxPaperSize paperId) const { wxPrintPaperType* type = FindPaperType(paperId); if (type) @@ -311,7 +311,7 @@ wxString wxPrintPaperDatabase::ConvertIdToName(wxPaperSize paperId) } // Get the paper size -wxSize wxPrintPaperDatabase::GetSize(wxPaperSize paperId) +wxSize wxPrintPaperDatabase::GetSize(wxPaperSize paperId) const { wxPrintPaperType* type = FindPaperType(paperId); if (type) @@ -321,7 +321,7 @@ wxSize wxPrintPaperDatabase::GetSize(wxPaperSize paperId) } // Get the paper size -wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size) +wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size) const { wxPrintPaperType* type = FindPaperType(size); if (type)