From 7b7a3316456bf0e84d3aff19d996698de85a03b9 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 26 Sep 2013 11:22:59 +0200 Subject: [PATCH] Added some const modifiers. --- common/tool/tool_base.cpp | 8 ++++---- include/tool/tool_base.h | 16 ++++++++-------- include/tool/tool_manager.h | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/tool/tool_base.cpp b/common/tool/tool_base.cpp index 15409d1a8c..066d85dd33 100644 --- a/common/tool/tool_base.cpp +++ b/common/tool/tool_base.cpp @@ -25,25 +25,25 @@ #include #include -KiGfx::VIEW* TOOL_BASE::getView() +KiGfx::VIEW* TOOL_BASE::getView() const { return m_toolMgr->GetView(); } -KiGfx::VIEW_CONTROLS* TOOL_BASE::getViewControls() +KiGfx::VIEW_CONTROLS* TOOL_BASE::getViewControls() const { return m_toolMgr->GetViewControls(); } -wxWindow* TOOL_BASE::getEditFrameInt() +wxWindow* TOOL_BASE::getEditFrameInt() const { return m_toolMgr->GetEditFrame(); } -EDA_ITEM* TOOL_BASE::getModelInt() +EDA_ITEM* TOOL_BASE::getModelInt() const { return m_toolMgr->GetModel(); } diff --git a/include/tool/tool_base.h b/include/tool/tool_base.h index 0925e4edb1..1b9da87305 100644 --- a/include/tool/tool_base.h +++ b/include/tool/tool_base.h @@ -80,7 +80,7 @@ public: return m_toolName; } - TOOL_MANAGER* GetManager() + TOOL_MANAGER* GetManager() const { return m_toolMgr; } @@ -96,8 +96,8 @@ protected: */ void attachManager( TOOL_MANAGER* aManager ); - KiGfx::VIEW* getView(); - KiGfx::VIEW_CONTROLS* getViewControls(); + KiGfx::VIEW* getView() const; + KiGfx::VIEW_CONTROLS* getViewControls() const; /** * Function getEditFrame() @@ -106,7 +106,7 @@ protected: * run-time type check */ template - T* getEditFrame() + T* getEditFrame() const { return static_cast( getEditFrameInt() ); } @@ -117,10 +117,10 @@ protected: * Returns the model object if it matches the requested type. */ template - T* getModel( KICAD_T modelType ) + T* getModel( KICAD_T modelType ) const { EDA_ITEM* m = getModelInt(); -// assert(modelType == m->Type()); + return static_cast( m ); } @@ -132,8 +132,8 @@ protected: private: // hide the implementation to avoid spreading half of // kicad and wxWidgets headers to the tools that may not need them at all! - EDA_ITEM* getModelInt(); - wxWindow* getEditFrameInt(); + EDA_ITEM* getModelInt() const; + wxWindow* getEditFrameInt() const; }; #endif diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index c2a8310f5c..eac8371268 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -144,22 +144,22 @@ public: KiGfx::VIEW_CONTROLS* aViewControls, wxWindow* aFrame ); /* Accessors for the environment objects (view, model, etc.) */ - KiGfx::VIEW* GetView() + KiGfx::VIEW* GetView() const { return m_view; } - KiGfx::VIEW_CONTROLS* GetViewControls() + KiGfx::VIEW_CONTROLS* GetViewControls() const { return m_viewControls; } - EDA_ITEM* GetModel() + EDA_ITEM* GetModel() const { return m_model; } - wxWindow* GetEditFrame() + wxWindow* GetEditFrame() const { return m_editFrame; }