Commit 32065b33 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Added const modifiers where applicable (PICKED_ITEMS_LIST).

Added PICKED_ITEMS_LIST::FindItem().
parent 4a0407fb
Loading
Loading
Loading
Loading
+19 −7
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ PICKED_ITEMS_LIST::~PICKED_ITEMS_LIST()
}
}




void PICKED_ITEMS_LIST::PushItem( ITEM_PICKER& aItem )
void PICKED_ITEMS_LIST::PushItem( const ITEM_PICKER& aItem )
{
{
    m_ItemsList.push_back( aItem );
    m_ItemsList.push_back( aItem );
}
}
@@ -70,7 +70,7 @@ ITEM_PICKER PICKED_ITEMS_LIST::PopItem()
}
}




bool PICKED_ITEMS_LIST::ContainsItem( EDA_ITEM* aItem ) const
bool PICKED_ITEMS_LIST::ContainsItem( const EDA_ITEM* aItem ) const
{
{
    for( size_t i = 0;  i < m_ItemsList.size();  i++ )
    for( size_t i = 0;  i < m_ItemsList.size();  i++ )
    {
    {
@@ -82,6 +82,18 @@ bool PICKED_ITEMS_LIST::ContainsItem( EDA_ITEM* aItem ) const
}
}




int PICKED_ITEMS_LIST::FindItem( const EDA_ITEM* aItem ) const
{
    for( size_t i = 0; i < m_ItemsList.size(); i++ )
    {
        if( m_ItemsList[i].GetItem() == aItem )
            return i;
    }

    return -1;
}


void PICKED_ITEMS_LIST::ClearItemsList()
void PICKED_ITEMS_LIST::ClearItemsList()
{
{
    m_ItemsList.clear();
    m_ItemsList.clear();
@@ -157,7 +169,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
}
}




ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx ) const
{
{
    ITEM_PICKER picker;
    ITEM_PICKER picker;


@@ -168,7 +180,7 @@ ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
}
}




EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx ) const
{
{
    if( aIdx < m_ItemsList.size() )
    if( aIdx < m_ItemsList.size() )
        return m_ItemsList[aIdx].GetItem();
        return m_ItemsList[aIdx].GetItem();
@@ -177,7 +189,7 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
}
}




EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx ) const
{
{
    if( aIdx < m_ItemsList.size() )
    if( aIdx < m_ItemsList.size() )
        return m_ItemsList[aIdx].GetLink();
        return m_ItemsList[aIdx].GetLink();
@@ -186,7 +198,7 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
}
}




UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx ) const
{
{
    if( aIdx < m_ItemsList.size() )
    if( aIdx < m_ItemsList.size() )
        return m_ItemsList[aIdx].GetStatus();
        return m_ItemsList[aIdx].GetStatus();
@@ -195,7 +207,7 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
}
}




STATUS_FLAGS PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
STATUS_FLAGS PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx ) const
{
{
    if( aIdx < m_ItemsList.size() )
    if( aIdx < m_ItemsList.size() )
        return m_ItemsList[aIdx].GetFlags();
        return m_ItemsList[aIdx].GetFlags();
+1 −1
Original line number Original line Diff line number Diff line
@@ -124,7 +124,7 @@ public:
     * @param aTransformPoint = the reference point of the transformation,
     * @param aTransformPoint = the reference point of the transformation,
     *                          for commands like move
     *                          for commands like move
     */
     */
    virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
    virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
                                     UNDO_REDO_T aTypeCommand,
                                     UNDO_REDO_T aTypeCommand,
                                     const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
                                     const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
    {
    {
+1 −1
Original line number Original line Diff line number Diff line
@@ -160,7 +160,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
}
}




void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
                                         UNDO_REDO_T        aTypeCommand,
                                         UNDO_REDO_T        aTypeCommand,
                                         const wxPoint&     aTransformPoint )
                                         const wxPoint&     aTransformPoint )
{
{
+1 −1
Original line number Original line Diff line number Diff line
@@ -676,7 +676,7 @@ public:
     * @param aTransformPoint = the reference point of the transformation,
     * @param aTransformPoint = the reference point of the transformation,
     *                          for commands like move
     *                          for commands like move
     */
     */
    void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
    void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
                             UNDO_REDO_T aTypeCommand,
                             UNDO_REDO_T aTypeCommand,
                             const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
                             const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
    {
    {
+15 −8
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ public:


    void SetStatus( UNDO_REDO_T aStatus ) { m_undoRedoStatus = aStatus; }
    void SetStatus( UNDO_REDO_T aStatus ) { m_undoRedoStatus = aStatus; }


    UNDO_REDO_T GetStatus() { return m_undoRedoStatus; }
    UNDO_REDO_T GetStatus() const { return m_undoRedoStatus; }


    void SetFlags( STATUS_FLAGS aFlags ) { m_pickerFlags = aFlags; }
    void SetFlags( STATUS_FLAGS aFlags ) { m_pickerFlags = aFlags; }


@@ -148,7 +148,7 @@ public:
     * pushes \a aItem to the top of the list
     * pushes \a aItem to the top of the list
     * @param aItem Picker to push on to the list.
     * @param aItem Picker to push on to the list.
     */
     */
    void PushItem( ITEM_PICKER& aItem );
    void PushItem( const ITEM_PICKER& aItem );


    /**
    /**
     * Function PopItem
     * Function PopItem
@@ -160,7 +160,14 @@ public:
     * Function IsItemInList
     * Function IsItemInList
     * @return True if \a aItem is found in the pick list.
     * @return True if \a aItem is found in the pick list.
     */
     */
    bool ContainsItem( EDA_ITEM* aItem ) const;
    bool ContainsItem( const EDA_ITEM* aItem ) const;

    /**
     * Function FindItem
     * @return Index of the searched item. If the item is not stored in the list, negative value
     * is returned.
     */
    int FindItem( const EDA_ITEM* aItem ) const;


    /**
    /**
     * Function ClearItemsList
     * Function ClearItemsList
@@ -201,21 +208,21 @@ public:
     * if this picker does not exist, a picker is returned,
     * if this picker does not exist, a picker is returned,
     * with its members set to 0 or NULL
     * with its members set to 0 or NULL
     */
     */
    ITEM_PICKER GetItemWrapper( unsigned int aIdx );
    ITEM_PICKER GetItemWrapper( unsigned int aIdx ) const;


    /**
    /**
     * Function GetPickedItem
     * Function GetPickedItem
     * @return A pointer to the picked item
     * @return A pointer to the picked item
     * @param aIdx Index of the picked item in the picked list
     * @param aIdx Index of the picked item in the picked list
     */
     */
    EDA_ITEM* GetPickedItem( unsigned int aIdx );
    EDA_ITEM* GetPickedItem( unsigned int aIdx ) const;


    /**
    /**
     * Function GetPickedItemLink
     * Function GetPickedItemLink
     * @return link of the picked item, or null if does not exist
     * @return link of the picked item, or null if does not exist
     * @param aIdx Index of the picked item in the picked list
     * @param aIdx Index of the picked item in the picked list
     */
     */
    EDA_ITEM* GetPickedItemLink( unsigned int aIdx );
    EDA_ITEM* GetPickedItemLink( unsigned int aIdx ) const;


    /**
    /**
     * Function GetPickedItemStatus
     * Function GetPickedItemStatus
@@ -223,7 +230,7 @@ public:
     *          or UR_UNSPECIFIED if does not exist
     *          or UR_UNSPECIFIED if does not exist
     * @param aIdx Index of the picked item in the picked list
     * @param aIdx Index of the picked item in the picked list
     */
     */
    UNDO_REDO_T GetPickedItemStatus( unsigned int aIdx );
    UNDO_REDO_T GetPickedItemStatus( unsigned int aIdx ) const;


    /**
    /**
     * Function GetPickerFlags
     * Function GetPickerFlags
@@ -231,7 +238,7 @@ public:
     * @param aIdx Index of the picker in the picked list
     * @param aIdx Index of the picker in the picked list
     * @return The value stored in the picker, if the picker exists, or 0 if does not exist
     * @return The value stored in the picker, if the picker exists, or 0 if does not exist
     */
     */
    STATUS_FLAGS GetPickerFlags( unsigned aIdx );
    STATUS_FLAGS GetPickerFlags( unsigned aIdx ) const;


    /**
    /**
     * Function SetPickedItem
     * Function SetPickedItem
Loading