Add more consts all over the place

This commit is contained in:
Werni 2020-10-27 11:03:35 +00:00 committed by Ian McInerney
parent e739d5ba65
commit a7d5d1f091
53 changed files with 115 additions and 115 deletions

View File

@ -48,7 +48,7 @@ void WX_TEXT_ENTRY_DIALOG::SetTextValidator( const wxTextValidator& validator )
}
wxString WX_TEXT_ENTRY_DIALOG::GetValue()
wxString WX_TEXT_ENTRY_DIALOG::GetValue() const
{
return m_textCtrl->GetValue();
}

View File

@ -44,7 +44,7 @@ public:
void SetTextValidator( wxTextValidatorStyle style );
void SetTextValidator( const wxTextValidator& validator );
wxString GetValue();
wxString GetValue() const;
};
#endif // _DIALOG_TEXT_ENTRY_H_

View File

@ -62,7 +62,7 @@ EDA_POSITION_CTRL::~EDA_POSITION_CTRL()
/* Returns (in internal units) to coordinate between (in user units)
*/
wxPoint EDA_POSITION_CTRL::GetValue()
wxPoint EDA_POSITION_CTRL::GetValue() const
{
return wxPoint( ValueFromString( m_UserUnit, m_FramePosX->GetValue() ),
ValueFromString( m_UserUnit, m_FramePosY->GetValue() ) );
@ -93,7 +93,7 @@ EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxS
}
wxSize EDA_SIZE_CTRL::GetValue()
wxSize EDA_SIZE_CTRL::GetValue() const
{
wxPoint pos = EDA_POSITION_CTRL::GetValue();

View File

@ -481,7 +481,7 @@ void EDA_TEXT::printOneLineOfText( RENDER_SETTINGS* aSettings, const wxPoint& aO
}
wxString EDA_TEXT::GetTextStyleName()
wxString EDA_TEXT::GetTextStyleName() const
{
int style = 0;

View File

@ -33,37 +33,37 @@ ORIGIN_TRANSFORMS::~ORIGIN_TRANSFORMS()
int ORIGIN_TRANSFORMS::ToDisplay( int aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
return static_cast<int>( ToDisplay( static_cast<long long int>( aValue ), aCoordType ) );
}
long long int ORIGIN_TRANSFORMS::ToDisplay( long long int aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
return aValue;
}
double ORIGIN_TRANSFORMS::ToDisplay( double aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
return aValue;
}
int ORIGIN_TRANSFORMS::FromDisplay( int aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
return static_cast<int>( FromDisplay( static_cast<long long int>( aValue ), aCoordType ) );
}
long long int ORIGIN_TRANSFORMS::FromDisplay( long long int aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
return aValue;
}
double ORIGIN_TRANSFORMS::FromDisplay( double aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
return aValue;
}

View File

@ -225,7 +225,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
}
const std::map<std::string, TOOL_ACTION*>& ACTION_MANAGER::GetActions()
const std::map<std::string, TOOL_ACTION*>& ACTION_MANAGER::GetActions() const
{
return m_actionNameIndex;
}

View File

@ -1504,13 +1504,13 @@ bool VIEW::IsVisible( const VIEW_ITEM* aItem ) const
}
void VIEW::Update( VIEW_ITEM* aItem )
void VIEW::Update( const VIEW_ITEM* aItem ) const
{
Update( aItem, ALL );
}
void VIEW::Update( VIEW_ITEM* aItem, int aUpdateFlags )
void VIEW::Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const
{
VIEW_ITEM_DATA* viewData = aItem->viewPrivData();

View File

@ -263,13 +263,13 @@ public:
return GetValue( m_rows[ aRow ], aCol );
}
std::vector<SCH_REFERENCE> GetRowReferences( int aRow )
std::vector<SCH_REFERENCE> GetRowReferences( int aRow ) const
{
wxCHECK( aRow < (int)m_rows.size(), std::vector<SCH_REFERENCE>() );
return m_rows[ aRow ].m_Refs;
}
wxString GetValue( DATA_MODEL_ROW& group, int aCol )
wxString GetValue( const DATA_MODEL_ROW& group, int aCol )
{
std::vector<SCH_REFERENCE> references;
wxString fieldValue;

View File

@ -613,7 +613,7 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
template <class T>
wxString FIELDS_GRID_TABLE<T>::StringFromBool( bool aValue )
wxString FIELDS_GRID_TABLE<T>::StringFromBool( bool aValue ) const
{
if( aValue )
return wxT( "1" );
@ -623,7 +623,7 @@ wxString FIELDS_GRID_TABLE<T>::StringFromBool( bool aValue )
template <class T>
bool FIELDS_GRID_TABLE<T>::BoolFromString( wxString aValue )
bool FIELDS_GRID_TABLE<T>::BoolFromString( wxString aValue ) const
{
if( aValue == "1" )
{

View File

@ -96,8 +96,8 @@ public:
void SetValue( int aRow, int aCol, const wxString &aValue ) override;
void SetValueAsBool( int aRow, int aCol, bool aValue ) override;
wxString StringFromBool( bool aValue );
bool BoolFromString( wxString aValue );
wxString StringFromBool( bool aValue ) const;
bool BoolFromString( wxString aValue ) const;
protected:
void initGrid( DIALOG_SHIM* aDialog );

View File

@ -65,7 +65,7 @@ public:
return wxT( "LIB_ARC" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Arc" );
}

View File

@ -49,7 +49,7 @@ public:
return wxT( "LIB_BEZIER" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Bezier" );
}

View File

@ -48,7 +48,7 @@ public:
return wxT( "LIB_CIRCLE" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Circle" );
}

View File

@ -97,7 +97,7 @@ public:
return wxT( "LIB_FIELD" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Field" );
}

View File

@ -120,7 +120,7 @@ public:
* Provide a user-consumable name of the object type. Perform localization when
* called so that run-time language selection works.
*/
virtual wxString GetTypeName() = 0;
virtual wxString GetTypeName() const = 0;
/**
* Begin drawing a component library draw item at \a aPosition.

View File

@ -117,7 +117,7 @@ public:
return wxT( "LIB_PIN" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Pin" );
}

View File

@ -48,7 +48,7 @@ public:
return wxT( "LIB_POLYLINE" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "PolyLine" );
}

View File

@ -49,7 +49,7 @@ public:
return wxT( "LIB_RECTANGLE" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Rectangle" );
}

View File

@ -54,7 +54,7 @@ public:
return wxT( "LIB_TEXT" );
}
wxString GetTypeName() override
wxString GetTypeName() const override
{
return _( "Text" );
}

View File

@ -119,7 +119,7 @@ public:
* @param aRobust If true, search the whole tree, not just the bounding box
* @return true if the item definitely exists, false if it does not exist within bbox
*/
bool contains( SCH_ITEM* aItem, bool aRobust = false )
bool contains( const SCH_ITEM* aItem, bool aRobust = false ) const
{
const EDA_RECT& bbox = aItem->GetBoundingBox();
const int type = int( aItem->Type() );
@ -158,12 +158,12 @@ public:
* Returns the number of items in the tree
* @return number of elements in the tree;
*/
size_t size()
size_t size() const
{
return m_count;
}
bool empty()
bool empty() const
{
return m_count == 0;
}

View File

@ -178,7 +178,7 @@ public:
*
* @param aCommit is the commit to add the children to.
*/
void AddChildrenToCommit( BOARD_COMMIT& aCommit )
void AddChildrenToCommit( BOARD_COMMIT& aCommit ) const
{
RunOnChildren( [&]( BOARD_ITEM* bItem )
{
@ -191,7 +191,7 @@ public:
* Note that this function should not add or remove items to the group
* @param aFunction is the function to be invoked.
*/
void RunOnChildren( const std::function<void ( BOARD_ITEM* )>& aFunction );
void RunOnChildren( const std::function<void ( BOARD_ITEM* )>& aFunction ) const;
/**
* Invokes a function on all descendents of the group.
@ -199,7 +199,7 @@ public:
* groups.
* @param aFunction is the function to be invoked.
*/
void RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFunction );
void RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFunction ) const;
private:
std::unordered_set<BOARD_ITEM*> m_items; // Members of the group

View File

@ -117,7 +117,7 @@ public:
void Enable( bool x_win_on, bool y_win_on );
void SetValue( int x_value, int y_value );
wxPoint GetValue();
wxPoint GetValue() const;
};
@ -132,7 +132,7 @@ public:
EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
~EDA_SIZE_CTRL() { }
wxSize GetValue();
wxSize GetValue() const;
};

View File

@ -106,7 +106,7 @@ public:
* @brief GetSizeMax
* @return the max size dimension
*/
int GetSizeMax() const { return ( m_Size.x > m_Size.y )?m_Size.x:m_Size.y; }
int GetSizeMax() const { return ( m_Size.x > m_Size.y ) ? m_Size.x : m_Size.y; }
int GetX() const { return m_Pos.x; }
int GetY() const { return m_Pos.y; }

View File

@ -351,7 +351,7 @@ public:
/**
* @return a wxString with the style name( Normal, Italic, Bold, Bold+Italic)
*/
wxString GetTextStyleName();
wxString GetTextStyleName() const;
/**
* Populate \a aPositions with the position of each line of

View File

@ -107,7 +107,7 @@ public:
void Clear() { clear(); }
const wxString& GetValue() { return m_field; }
const wxString& GetValue() const { return m_field; }
void SetField( const wxString& aField, bool aUseUTF8, bool aEscapeString )
{
@ -116,7 +116,7 @@ public:
m_escapeString = aEscapeString;
}
bool IsEmpty() { return m_field.IsEmpty(); }
bool IsEmpty() const { return m_field.IsEmpty(); }
std::string GetGerberString();

View File

@ -254,7 +254,7 @@ public:
VAR_REF() {};
virtual ~VAR_REF() {};
virtual VAR_TYPE_T GetType() = 0;
virtual VAR_TYPE_T GetType() const = 0;
virtual VALUE GetValue( CONTEXT* aCtx ) = 0;
};

View File

@ -23,7 +23,7 @@
*/
#ifndef ORIGIN_TRANSFORMS_H_
#define ORIGIN_TRANSFORMS_H_ 1
#define ORIGIN_TRANSFORMS_H_
/**
* A class to perform either relative or absolute display origin
@ -61,28 +61,28 @@ public:
// =============== Single-axis Transforms ===============
virtual int ToDisplay( int aValue,
COORD_TYPES_T aCoordType );
COORD_TYPES_T aCoordType ) const;
virtual long long int ToDisplay( long long int aValue,
COORD_TYPES_T aCoordType );
COORD_TYPES_T aCoordType ) const;
virtual double ToDisplay( double aValue,
COORD_TYPES_T aCoordType );
COORD_TYPES_T aCoordType ) const;
virtual int FromDisplay( int aValue,
COORD_TYPES_T aCoordType );
COORD_TYPES_T aCoordType ) const;
virtual long long int FromDisplay( long long int aValue,
COORD_TYPES_T aCoordType );
COORD_TYPES_T aCoordType ) const;
virtual double FromDisplay( double aValue,
COORD_TYPES_T aCoordType );
COORD_TYPES_T aCoordType ) const;
// =============== Two-axis Transforms ===============
template<class T>
T ToDisplayAbs( const T& aValue )
T ToDisplayAbs( const T& aValue ) const
{
T displayValue;
@ -92,7 +92,7 @@ public:
}
template<class T>
T ToDisplayRel( const T& aValue )
T ToDisplayRel( const T& aValue ) const
{
T displayValue;
@ -103,7 +103,7 @@ public:
template<class T>
T FromDisplayAbs( const T& aValue )
T FromDisplayAbs( const T& aValue ) const
{
T displayValue;
@ -113,7 +113,7 @@ public:
}
template<class T>
T FromDisplayRel( const T& aValue )
T FromDisplayRel( const T& aValue ) const
{
T displayValue;

View File

@ -110,7 +110,7 @@ public:
/**
* Get a list of currently-registered actions mapped by their name.
*/
const std::map<std::string, TOOL_ACTION*>& GetActions();
const std::map<std::string, TOOL_ACTION*>& GetActions() const;
/**
* Finds an action with a given name (if there is one available).

View File

@ -141,8 +141,8 @@ public:
* @param aItem: the item to update.
* @param aUpdateFlags: how much the object has changed.
*/
virtual void Update( VIEW_ITEM* aItem, int aUpdateFlags );
virtual void Update( VIEW_ITEM* aItem );
virtual void Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const;
virtual void Update( const VIEW_ITEM* aItem ) const;
/**
* Function SetRequired()

View File

@ -77,7 +77,7 @@ public:
* with aBounds.
*/
template <class Visitor>
void Query( const BOX2I& aBounds, Visitor& aVisitor ) // const
void Query( const BOX2I& aBounds, Visitor& aVisitor ) const
{
int mmin[2] = { aBounds.GetX(), aBounds.GetY() };
int mmax[2] = { aBounds.GetRight(), aBounds.GetBottom() };

View File

@ -50,7 +50,7 @@ public:
void SetValue( bool aValue );
///> Read the checkbox state
bool GetValue() { return m_checked; }
bool GetValue() const { return m_checked; }
private:
bool m_checked;

View File

@ -173,7 +173,7 @@ class SHAPE_INDEX
* Checks if the iterator has reached the end.
* @return true if it is in an invalid position (data finished)
*/
bool IsNull()
bool IsNull() const
{
return iterator.IsNull();
}
@ -184,7 +184,7 @@ class SHAPE_INDEX
* Checks if the iterator has not reached the end.
* @return true if it is in an valid position (data not finished)
*/
bool IsNotNull()
bool IsNotNull() const
{
return iterator.IsNotNull();
}
@ -275,7 +275,7 @@ class SHAPE_INDEX
* @param aVisitor object to be invoked on every object contained in the search area.
*/
template <class V>
int Query( const SHAPE *aShape, int aMinDistance, V& aVisitor, bool aExact )
int Query( const SHAPE *aShape, int aMinDistance, V& aVisitor) const
{
BOX2I box = aShape->BBox();
box.Inflate( aMinDistance );
@ -377,4 +377,4 @@ typename SHAPE_INDEX<T>::Iterator SHAPE_INDEX<T>::Begin()
return Iterator( this );
}
#endif
#endif /* __SHAPE_INDEX_H */

View File

@ -969,7 +969,7 @@ wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource )
}
unsigned BOARD::GetNodesCount( int aNet )
unsigned BOARD::GetNodesCount( int aNet ) const
{
unsigned retval = 0;
@ -1854,7 +1854,7 @@ bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aError
}
const std::vector<D_PAD*> BOARD::GetPads()
const std::vector<D_PAD*> BOARD::GetPads() const
{
std::vector<D_PAD*> allPads;
@ -1868,7 +1868,7 @@ const std::vector<D_PAD*> BOARD::GetPads()
}
unsigned BOARD::GetPadCount()
unsigned BOARD::GetPadCount() const
{
unsigned retval = 0;

View File

@ -680,7 +680,7 @@ public:
* @param aNet Only count nodes belonging to this net
* @return the number of pads members of nets (i.e. with netcode > 0)
*/
unsigned GetNodesCount( int aNet = -1 );
unsigned GetNodesCount( int aNet = -1 ) const;
/**
* @return the number of unconnected nets in the current ratsnest.
@ -690,7 +690,7 @@ public:
/**
* @return the number of pads in board
*/
unsigned GetPadCount();
unsigned GetPadCount() const;
/**
* Return a reference to a list of all the pads.
@ -700,7 +700,7 @@ public:
*
* @return D_PADS - a full list of pads
*/
const std::vector<D_PAD*> GetPads();
const std::vector<D_PAD*> GetPads() const;
void BuildListOfNets()
{

View File

@ -1063,7 +1063,7 @@ EDA_ITEM* MODULE::Clone() const
}
void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const
{
try
{

View File

@ -594,7 +594,7 @@ public:
* Note that this function should not add or remove items to the module
* @param aFunction is the function to be invoked.
*/
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction );
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
/**
* Returns a set of all layers that this module has drawings on similar to ViewGetLayers()

View File

@ -310,7 +310,7 @@ void PCB_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
}
void PCB_GROUP::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction )
void PCB_GROUP::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction ) const
{
try
{
@ -324,7 +324,7 @@ void PCB_GROUP::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFuncti
}
void PCB_GROUP::RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFunction )
void PCB_GROUP::RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFunction ) const
{
try
{

View File

@ -713,7 +713,7 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
}
void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
void TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const
{
wxString msg;

View File

@ -259,7 +259,7 @@ public:
#endif
protected:
void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const;
int m_Width; ///< Thickness of track, or via diameter

View File

@ -107,7 +107,7 @@ public:
* with aBounds.
*/
template <class Visitor>
void Query( const BOX2I& aBounds, const LAYER_RANGE& aRange, Visitor& aVisitor )
void Query( const BOX2I& aBounds, const LAYER_RANGE& aRange, Visitor& aVisitor ) const
{
const int mmin[3] = { aRange.Start(), aBounds.GetX(), aBounds.GetY() };
const int mmax[3] = { aRange.End(), aBounds.GetRight(), aBounds.GetBottom() };

View File

@ -55,7 +55,7 @@ public:
}
// returns the selected text (fp reference)
const wxString GetValue()
const wxString GetValue() const
{
return m_SearchTextCtrl->GetValue();
}

View File

@ -95,7 +95,7 @@ protected:
}
///> Gets the current target for downloaded libraries
inline wxString getDownloadDir()
inline wxString getDownloadDir() const
{
return m_downloadDir->GetValue();
}

View File

@ -240,7 +240,7 @@ public:
bool CheckColliding( SHAPE* aRefShape,
PCB_LAYER_ID aTargetLayer,
int aClearance = 0,
std::function<bool( BOARD_ITEM*)> aFilter = nullptr )
std::function<bool( BOARD_ITEM*)> aFilter = nullptr ) const
{
BOX2I box = aRefShape->BBox();
box.Inflate( aClearance );
@ -276,7 +276,7 @@ public:
PCB_LAYER_ID aTargetLayer,
std::function<bool( BOARD_ITEM*)> aFilter = nullptr,
std::function<bool( BOARD_ITEM*, int)> aVisitor = nullptr,
int aClearance = 0 )
int aClearance = 0 ) const
{
// keep track of BOARD_ITEMs that have been already found to collide (some items
// might be build of COMPOUND/triangulated shapes and a single subshape collision
@ -344,7 +344,7 @@ public:
ITEM_WITH_SHAPE*, ITEM_WITH_SHAPE*,
bool* aCollision )> aVisitor,
int aMaxClearance,
std::function<bool(int, int )> aProgressReporter )
std::function<bool(int, int )> aProgressReporter ) const
{
std::vector< PAIR_INFO > pairsToVisit;
@ -463,12 +463,12 @@ public:
* Returns the number of items in the tree
* @return number of elements in the tree;
*/
size_t size()
size_t size() const
{
return m_count;
}
bool empty()
bool empty() const
{
return m_count == 0;
}

View File

@ -488,9 +488,9 @@ void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions()
}
BOARD_ITEM* PCB_EXPR_VAR_REF::GetObject( LIBEVAL::CONTEXT* aCtx ) const
BOARD_ITEM* PCB_EXPR_VAR_REF::GetObject( const LIBEVAL::CONTEXT* aCtx ) const
{
wxASSERT( dynamic_cast<PCB_EXPR_CONTEXT*>( aCtx ) );
wxASSERT( dynamic_cast<const PCB_EXPR_CONTEXT*>( aCtx ) );
const PCB_EXPR_CONTEXT* ctx = static_cast<const PCB_EXPR_CONTEXT*>( aCtx );
BOARD_ITEM* item = ctx->GetItem( m_itemIndex );

View File

@ -97,7 +97,7 @@ public:
bool IsEnum() const { return m_isEnum; }
void SetType( LIBEVAL::VAR_TYPE_T type ) { m_type = type; }
LIBEVAL::VAR_TYPE_T GetType() override { return m_type; }
LIBEVAL::VAR_TYPE_T GetType() const override { return m_type; }
void AddAllowedClass( TYPE_ID type_hash, PROPERTY_BASE* prop )
{
@ -106,7 +106,7 @@ public:
virtual LIBEVAL::VALUE GetValue( LIBEVAL::CONTEXT* aCtx ) override;
BOARD_ITEM* GetObject( LIBEVAL::CONTEXT* aCtx ) const;
BOARD_ITEM* GetObject( const LIBEVAL::CONTEXT* aCtx ) const;
private:
std::unordered_map<TYPE_ID, PROPERTY_BASE*> m_matchingTypes;

View File

@ -39,7 +39,7 @@ PCB_ORIGIN_TRANSFORMS::~PCB_ORIGIN_TRANSFORMS()
{}
long long int PCB_ORIGIN_TRANSFORMS::ToDisplay( long long int aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
long long int value = aValue;
@ -57,7 +57,7 @@ long long int PCB_ORIGIN_TRANSFORMS::ToDisplay( long long int aValue,
}
double PCB_ORIGIN_TRANSFORMS::ToDisplay( double aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
double value = aValue;
@ -75,7 +75,7 @@ double PCB_ORIGIN_TRANSFORMS::ToDisplay( double aValue,
}
long long int PCB_ORIGIN_TRANSFORMS::FromDisplay( long long int aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
long long value = aValue;
@ -93,7 +93,7 @@ long long int PCB_ORIGIN_TRANSFORMS::FromDisplay( long long int aValue,
}
double PCB_ORIGIN_TRANSFORMS::FromDisplay( double aValue,
COORD_TYPES_T aCoordType )
COORD_TYPES_T aCoordType ) const
{
double value = aValue;

View File

@ -23,7 +23,7 @@
*/
#ifndef PCB_ORIGIN_TRANSFORM_H_
#define PCB_ORIGIN_TRANSFORM_H_ 1
#define PCB_ORIGIN_TRANSFORM_H_
#include <origin_transforms.h>
@ -38,16 +38,16 @@ public:
using ORIGIN_TRANSFORMS::ToDisplay;
virtual long long int ToDisplay( long long int aValue, COORD_TYPES_T aCoordType ) override;
virtual long long int ToDisplay( long long int aValue, COORD_TYPES_T aCoordType ) const override;
virtual double ToDisplay( double aValue, COORD_TYPES_T aCoordType ) override;
virtual double ToDisplay( double aValue, COORD_TYPES_T aCoordType ) const override;
using ORIGIN_TRANSFORMS::FromDisplay;
virtual long long int FromDisplay( long long int aValue, COORD_TYPES_T aCoordType ) override;
virtual long long int FromDisplay( long long int aValue, COORD_TYPES_T aCoordType ) const override;
virtual double FromDisplay( double aValue, COORD_TYPES_T aCoordType ) override;
virtual double FromDisplay( double aValue, COORD_TYPES_T aCoordType ) const override;
/**

View File

@ -90,13 +90,13 @@ void PCB_VIEW::Remove( KIGFX::VIEW_ITEM* aItem )
}
void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem, int aUpdateFlags )
void PCB_VIEW::Update( const KIGFX::VIEW_ITEM* aItem, int aUpdateFlags ) const
{
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
const BOARD_ITEM* item = static_cast<const BOARD_ITEM*>( aItem );
if( item->Type() == PCB_MODULE_T )
{
MODULE* mod = static_cast<MODULE*>( item );
const MODULE* mod = static_cast<const MODULE*>( item );
mod->RunOnChildren( [this, aUpdateFlags] ( BOARD_ITEM* aModItem )
{
@ -108,7 +108,7 @@ void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem, int aUpdateFlags )
}
void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem )
void PCB_VIEW::Update( const KIGFX::VIEW_ITEM* aItem ) const
{
PCB_VIEW::Update( aItem, KIGFX::ALL );
}

View File

@ -46,10 +46,10 @@ public:
virtual void Remove( VIEW_ITEM* aItem ) override;
/// @copydoc VIEW::Update()
virtual void Update( VIEW_ITEM* aItem, int aUpdateFlags ) override;
virtual void Update( const VIEW_ITEM* aItem, int aUpdateFlags ) const override;
/// @copydoc VIEW::Update()
virtual void Update( VIEW_ITEM* aItem ) override;
virtual void Update( const VIEW_ITEM* aItem ) const override;
void UpdateDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions );
};

View File

@ -78,7 +78,7 @@ public:
* @return number of items found.
*/
template<class Visitor>
int Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor );
int Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) const;
/**
* Searches items in the index that are in proximity of aShape.
@ -92,7 +92,7 @@ public:
* @return number of items found.
*/
template<class Visitor>
int Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor );
int Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const;
/**
* Returns list of all items in a given net.
@ -120,7 +120,7 @@ public:
private:
template <class Visitor>
int querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor );
int querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const;
std::deque<ITEM_SHAPE_INDEX> m_subIndices;
std::map<int, NET_ITEMS_LIST> m_netMap;
@ -129,16 +129,16 @@ private:
template<class Visitor>
int INDEX::querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
int INDEX::querySingle( std::size_t aIndex, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const
{
if( aIndex >= m_subIndices.size() )
return 0;
return m_subIndices[aIndex].Query( aShape, aMinDistance, aVisitor, false );
return m_subIndices[aIndex].Query( aShape, aMinDistance, aVisitor);
}
template<class Visitor>
int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor )
int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor ) const
{
int total = 0;
@ -151,7 +151,7 @@ int INDEX::Query( const ITEM* aItem, int aMinDistance, Visitor& aVisitor )
}
template<class Visitor>
int INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
int INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor ) const
{
int total = 0;

View File

@ -179,7 +179,7 @@ public:
///> Zooms the screen to center and fit the current selection.
void zoomFitSelection();
BOARD* GetBoard()
BOARD* GetBoard() const
{
return board();
}
@ -394,4 +394,4 @@ private:
std::unique_ptr<PRIV> m_priv;
};
#endif
#endif /* __SELECTION_TOOL_H */

View File

@ -208,18 +208,18 @@ NET_GRID_ENTRY& NET_GRID_TABLE::GetEntry( int aRow )
}
int NET_GRID_TABLE::GetRowByNetcode( int aCode )
int NET_GRID_TABLE::GetRowByNetcode( int aCode ) const
{
auto it = std::find_if( m_nets.begin(), m_nets.end(),
auto it = std::find_if( m_nets.cbegin(), m_nets.cend(),
[aCode]( const NET_GRID_ENTRY& aEntry )
{
return aEntry.code == aCode;
} );
if( it == m_nets.end() )
if( it == m_nets.cend() )
return -1;
return std::distance( m_nets.begin(), it );
return std::distance( m_nets.cbegin(), it );
}

View File

@ -112,7 +112,7 @@ public:
NET_GRID_ENTRY& GetEntry( int aRow );
int GetRowByNetcode( int aCode );
int GetRowByNetcode( int aCode ) const;
void Rebuild();