← Back to team overview

kicad-developers team mailing list archive

[PATCH 2/5] Implement GetClass() throughout the project

 

This function is really only used for diagnostics.
---
 3d-viewer/3d_material.h                   | 8 ++++++++
 3d-viewer/3d_struct.h                     | 8 ++++++++
 include/base_struct.h                     | 5 +----
 include/worksheet_viewitem.h              | 8 ++++++++
 pagelayout_editor/pl_editor_undo_redo.cpp | 8 ++++++++
 pcbnew/class_marker_pcb.h                 | 8 ++++++++
 pcbnew/ratsnest_viewitem.h                | 8 ++++++++
 pcbnew/router/router_preview_item.h       | 8 ++++++++
 pcbnew/tools/bright_box.h                 | 8 ++++++++
 pcbnew/tools/edit_points.h                | 8 ++++++++
 pcbnew/tools/selection_area.h             | 8 ++++++++
 11 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/3d-viewer/3d_material.h b/3d-viewer/3d_material.h
index 4064d08..7b86970 100644
--- a/3d-viewer/3d_material.h
+++ b/3d-viewer/3d_material.h
@@ -65,6 +65,14 @@ public:
 #if defined(DEBUG)
     void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
 #endif
+
+    /** Get class name
+     * @return  string "S3D_MATERIAL"
+     */
+    virtual wxString GetClass() const
+    {
+        return "S3D_MATERIAL";
+    }
 };
 
 void SetOpenGlDefaultMaterial();
diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h
index c64d3d8..51154ec 100644
--- a/3d-viewer/3d_struct.h
+++ b/3d-viewer/3d_struct.h
@@ -176,6 +176,14 @@ public:
         return m_Shape3DName;
     }
 
+    /** Get class name
+     * @return  string "S3D_MASTER"
+     */
+    virtual wxString GetClass() const
+    {
+        return "S3D_MASTER";
+    }
+
     /**
      * Function GetShape3DFullFilename
      * @return the full filename of the 3D shape,
diff --git a/include/base_struct.h b/include/base_struct.h
index 2e79b47..e6238f3 100644
--- a/include/base_struct.h
+++ b/include/base_struct.h
@@ -386,10 +386,7 @@ public:
      * returns the class name.
      * @return wxString
      */
-    virtual wxString GetClass() const
-    {
-        return wxT( "EDA_ITEM" );
-    }
+    virtual wxString GetClass() const = 0;
 
     /**
      * Function GetSelectMenuText
diff --git a/include/worksheet_viewitem.h b/include/worksheet_viewitem.h
index ca506c8..ff0c4df 100644
--- a/include/worksheet_viewitem.h
+++ b/include/worksheet_viewitem.h
@@ -128,6 +128,14 @@ public:
     {
     }
 
+    /** Get class name
+     * @return  string "WORKSHEET_VIEWITEM"
+     */
+    virtual wxString GetClass() const
+    {
+        return "WORKSHEET_VIEWITEM";
+    }
+
 protected:
     /// File name displayed in the title block
     std::string m_fileName;
diff --git a/pagelayout_editor/pl_editor_undo_redo.cpp b/pagelayout_editor/pl_editor_undo_redo.cpp
index 390aebb..e6e9819 100644
--- a/pagelayout_editor/pl_editor_undo_redo.cpp
+++ b/pagelayout_editor/pl_editor_undo_redo.cpp
@@ -57,6 +57,14 @@ public:
 #if defined(DEBUG)
     virtual void Show( int nestLevel, std::ostream& os ) const {}
 #endif
+
+    /** Get class name
+     * @return  string "PL_ITEM_LAYOUT"
+     */
+    virtual wxString GetClass() const
+    {
+        return "PL_ITEM_LAYOUT";
+    }
 };
 
 void PL_EDITOR_FRAME::SaveCopyInUndoList()
diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h
index 6fd09b0..89d73e6 100644
--- a/pcbnew/class_marker_pcb.h
+++ b/pcbnew/class_marker_pcb.h
@@ -124,6 +124,14 @@ public:
     void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
 #endif
 
+    /** Get class name
+     * @return  string "MARKER_PCB"
+     */
+    virtual wxString GetClass() const
+    {
+        return "MARKER_PCB";
+    }
+
 protected:
     ///> Pointer to BOARD_ITEM that causes DRC error.
     const BOARD_ITEM* m_item;
diff --git a/pcbnew/ratsnest_viewitem.h b/pcbnew/ratsnest_viewitem.h
index 0ccace0..63cf761 100644
--- a/pcbnew/ratsnest_viewitem.h
+++ b/pcbnew/ratsnest_viewitem.h
@@ -57,6 +57,14 @@ public:
     {
     }
 
+    /** Get class name
+     * @return  string "RATSNEST_VIEWITEM"
+     */
+    virtual wxString GetClass() const
+    {
+        return "RATSNEST_VIEWITEM";
+    }
+
 protected:
     ///> Object containing ratsnest data.
     RN_DATA* m_data;
diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h
index a5b6759..294fcdf 100644
--- a/pcbnew/router/router_preview_item.h
+++ b/pcbnew/router/router_preview_item.h
@@ -74,6 +74,14 @@ public:
 
     void Show( int aA, std::ostream& aB ) const {};
 
+    /** Get class name
+     * @return  string "ROUTER_PREVIEW_ITEM"
+     */
+    virtual wxString GetClass() const
+    {
+        return "ROUTER_PREVIEW_ITEM";
+    }
+
     const BOX2I ViewBBox() const;
 
     virtual void ViewDraw( int aLayer, KIGFX::GAL* aGal ) const;
diff --git a/pcbnew/tools/bright_box.h b/pcbnew/tools/bright_box.h
index f75a7d0..1bcfb6a 100644
--- a/pcbnew/tools/bright_box.h
+++ b/pcbnew/tools/bright_box.h
@@ -59,6 +59,14 @@ public:
     {
     }
 
+    /** Get class name
+     * @return  string "BRIGHT_BOX"
+     */
+    virtual wxString GetClass() const
+    {
+        return "BRIGHT_BOX";
+    }
+
 private:
     static const KIGFX::COLOR4D BOX_COLOR;
     static const double LINE_WIDTH;
diff --git a/pcbnew/tools/edit_points.h b/pcbnew/tools/edit_points.h
index 99b0efc..2e62c2a 100644
--- a/pcbnew/tools/edit_points.h
+++ b/pcbnew/tools/edit_points.h
@@ -507,6 +507,14 @@ public:
     {
     }
 
+    /** Get class name
+     * @return  string "EDIT_POINTS"
+     */
+    virtual wxString GetClass() const
+    {
+        return "EDIT_POINTS";
+    }
+
 private:
     EDA_ITEM* m_parent;                 ///< Parent of the EDIT_POINTs
     std::deque<EDIT_POINT> m_points;    ///< EDIT_POINTs for modifying m_parent
diff --git a/pcbnew/tools/selection_area.h b/pcbnew/tools/selection_area.h
index 533a516..7072bb6 100644
--- a/pcbnew/tools/selection_area.h
+++ b/pcbnew/tools/selection_area.h
@@ -67,6 +67,14 @@ public:
     {
     }
 
+    /** Get class name
+     * @return  string "SELECTION_AREA"
+     */
+    virtual wxString GetClass() const
+    {
+        return "SELECTION_AREA";
+    }
+
 private:
     VECTOR2I m_origin, m_end;
 };
-- 
2.1.4



Follow ups

References