--- 3d-viewer/3d_material.h | 3 +++ 3d-viewer/3d_struct.h | 2 ++ common/base_struct.cpp | 7 ------- eeschema/class_libentry.h | 6 ++++++ eeschema/class_sch_screen.h | 3 +++ gerbview/class_gbr_screen.h | 3 +++ gerbview/class_gerber_draw_item.h | 2 ++ include/base_struct.h | 9 +-------- include/class_pcb_screen.h | 3 +++ include/origin_viewitem.h | 3 +++ include/worksheet_viewitem.h | 3 +++ pagelayout_editor/class_pl_editor_screen.h | 3 +++ pagelayout_editor/pl_editor_undo_redo.cpp | 3 +++ pcbnew/class_board.h | 3 +++ pcbnew/class_marker_pcb.h | 3 +++ pcbnew/class_netinfo.h | 2 ++ pcbnew/ratsnest_viewitem.h | 3 +++ pcbnew/router/router_preview_item.h | 3 +++ pcbnew/tools/bright_box.h | 2 ++ pcbnew/tools/edit_points.h | 2 ++ pcbnew/tools/selection_area.h | 2 ++ 21 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/3d-viewer/3d_material.h b/3d-viewer/3d_material.h index 3bff7e6..4d8ab53 100644 --- a/3d-viewer/3d_material.h +++ b/3d-viewer/3d_material.h @@ -76,6 +76,9 @@ public: { return wxT( "S3D_MATERIAL" ); } + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone S3D_MATERIAL" ) ); } }; void SetOpenGlDefaultMaterial(); diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index fc85567..43d0b65 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -169,6 +169,8 @@ private: void calcBBox(); CBBOX m_BBox; ///< Model oriented Bouding Box CBBOX m_fastAABBox; ///< Axis Align Bounding Box that contain the other bounding boxes + + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone S3D_MASTER" ) ); } }; diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 9b6273d..10ca003 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -100,13 +100,6 @@ void EDA_ITEM::SetModified() } -EDA_ITEM* EDA_ITEM::Clone() const -{ - wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() + - wxT( ". Bad programmer!" ) ); -} - - SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart, INSPECTOR* inspector, const void* testData, diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 2359349..21e2cb6 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -180,6 +180,9 @@ public: #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone LIB_PART" ) ); } }; extern bool operator<( const LIB_ALIAS& aItem1, const LIB_ALIAS& aItem2 ); @@ -772,6 +775,9 @@ public: #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone LIB_PART" ) ); } }; #endif // CLASS_LIBENTRY_H diff --git a/eeschema/class_sch_screen.h b/eeschema/class_sch_screen.h index a6715f0..7f10f2c 100644 --- a/eeschema/class_sch_screen.h +++ b/eeschema/class_sch_screen.h @@ -529,6 +529,9 @@ public: #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // overload #endif + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone SCH_SCREEN" ) ); } }; diff --git a/gerbview/class_gbr_screen.h b/gerbview/class_gbr_screen.h index 19b5f90..b1d13fe 100644 --- a/gerbview/class_gbr_screen.h +++ b/gerbview/class_gbr_screen.h @@ -63,6 +63,9 @@ public: * virtual pure in BASE_SCREEN, so it must be defined here */ void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ); + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone GBR_SCREEN" ) ); } }; diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index 49e3340..f6d3633 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -304,6 +304,8 @@ public: void Show( int nestLevel, std::ostream& os ) const; // override #endif +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone GERBER_DRAW_ITEM" ) ); } }; #endif /* CLASS_GERBER_DRAW_ITEM_H */ diff --git a/include/base_struct.h b/include/base_struct.h index d9903fb..f356828 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -332,16 +332,9 @@ public: * Function Clone * creates a duplicate of this item with linked list members set to NULL. * - * The default version will return NULL in release builds and likely crash the - * program. In debug builds, a warning message indicating the derived class - * has not implemented cloning. This really should be a pure virtual function. - * Due to the fact that there are so many objects derived from EDA_ITEM, the - * decision was made to return NULL until all the objects derived from EDA_ITEM - * implement cloning. Once that happens, this function should be made pure. - * * @return A clone of the item. */ - virtual EDA_ITEM* Clone() const; // should not be inline, to save the ~ 6 bytes per call site. + virtual EDA_ITEM* Clone() const = 0; /** * Function IterateForward diff --git a/include/class_pcb_screen.h b/include/class_pcb_screen.h index dc65b3d..06ded62 100644 --- a/include/class_pcb_screen.h +++ b/include/class_pcb_screen.h @@ -100,6 +100,9 @@ public: * So this function can be called to remove old commands */ void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ); + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone PCB_SCREEN" ) ); } }; #endif // CLASS_PCB_SCREEN_H_ diff --git a/include/origin_viewitem.h b/include/origin_viewitem.h index 02900fb..0f0912d 100644 --- a/include/origin_viewitem.h +++ b/include/origin_viewitem.h @@ -138,6 +138,9 @@ protected: ///> If set, the marker will be drawn even if its position is 0,0 bool m_drawAtZero; + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone ORIGIN_VIEWITEM" ) ); } }; } // namespace KIGFX diff --git a/include/worksheet_viewitem.h b/include/worksheet_viewitem.h index 149f804..ccaa3f0 100644 --- a/include/worksheet_viewitem.h +++ b/include/worksheet_viewitem.h @@ -165,6 +165,9 @@ protected: /// Draws a border that determines the page size. void drawBorder( GAL* aGal ) const; + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone ORIGIN_VIEWITEM" ) ); } }; } diff --git a/pagelayout_editor/class_pl_editor_screen.h b/pagelayout_editor/class_pl_editor_screen.h index 957180f..31d5c3f 100644 --- a/pagelayout_editor/class_pl_editor_screen.h +++ b/pagelayout_editor/class_pl_editor_screen.h @@ -74,6 +74,9 @@ public: * @param aItem Any object derived from WORKSHEET_DATAITEM */ void SetCurItem( WORKSHEET_DATAITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*)aItem ); } + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone PL_EDITOR_SCREEN" ) ); } }; diff --git a/pagelayout_editor/pl_editor_undo_redo.cpp b/pagelayout_editor/pl_editor_undo_redo.cpp index de00b81..cabc8bc 100644 --- a/pagelayout_editor/pl_editor_undo_redo.cpp +++ b/pagelayout_editor/pl_editor_undo_redo.cpp @@ -65,6 +65,9 @@ public: { return wxT( "PL_ITEM_LAYOUT" ); } + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone PL_ITEM_LAYOUT" ) ); } }; void PL_EDITOR_FRAME::SaveCopyInUndoList() diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index ba5241f..245e7ac 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -1391,6 +1391,9 @@ public: * aPosition and a pointer to the via are returned. */ TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList ); + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone BOARD" ) ); } }; #endif // CLASS_BOARD_H_ diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index e524ae7..8035b09 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -135,6 +135,9 @@ public: protected: ///> Pointer to BOARD_ITEM that causes DRC error. const BOARD_ITEM* m_item; + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone PCB_MARKER" ) ); } }; #endif // CLASS_MARKER_PCB_H diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 82ac8d7..86903c1 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -706,6 +706,8 @@ public: return m_parent; } +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone NETINFO_ITEM" ) ); } }; diff --git a/pcbnew/ratsnest_viewitem.h b/pcbnew/ratsnest_viewitem.h index 8898be8..0ae4edd 100644 --- a/pcbnew/ratsnest_viewitem.h +++ b/pcbnew/ratsnest_viewitem.h @@ -70,6 +70,9 @@ public: protected: ///> Object containing ratsnest data. RN_DATA* m_data; + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone RATSNEST_VIEWITEM" ) ); } }; } // namespace KIGFX diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h index 653900d..c40748c 100644 --- a/pcbnew/router/router_preview_item.h +++ b/pcbnew/router/router_preview_item.h @@ -122,6 +122,9 @@ private: KIGFX::COLOR4D m_color; VECTOR2I m_pos; + +private: + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone ROUTER_PREVIEW_ITEM" ) ); } }; #endif diff --git a/pcbnew/tools/bright_box.h b/pcbnew/tools/bright_box.h index fc9aeee..86ea561 100644 --- a/pcbnew/tools/bright_box.h +++ b/pcbnew/tools/bright_box.h @@ -74,6 +74,8 @@ private: static const double LINE_WIDTH; BOARD_ITEM* m_item; + + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone BRIGHT_BOX" ) ); } }; #endif diff --git a/pcbnew/tools/edit_points.h b/pcbnew/tools/edit_points.h index ca9e373..5d7ae5b 100644 --- a/pcbnew/tools/edit_points.h +++ b/pcbnew/tools/edit_points.h @@ -525,6 +525,8 @@ private: std::deque<EDIT_POINT> m_points; ///< EDIT_POINTs for modifying m_parent std::deque<EDIT_LINE> m_lines; ///< EDIT_LINEs for modifying m_parent std::list<int> m_contours; ///< Indices of end contour points + + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone EDIT_POINTS" ) ); } }; #endif /* EDIT_POINTS_H_ */ diff --git a/pcbnew/tools/selection_area.h b/pcbnew/tools/selection_area.h index 737e7be..aceb1e1 100644 --- a/pcbnew/tools/selection_area.h +++ b/pcbnew/tools/selection_area.h @@ -79,6 +79,8 @@ public: private: VECTOR2I m_origin, m_end; + + virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone SELECTION_AREA" ) ); } }; #endif
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp