From 494001ed4ce948e697d5c0f28867728f44dfa732 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 6 Apr 2024 10:16:06 +0100 Subject: [PATCH] Harmonize more APIs. --- eeschema/lib_field.h | 2 +- eeschema/lib_item.cpp | 2 +- eeschema/lib_item.h | 6 ------ eeschema/lib_pin.h | 2 +- eeschema/lib_shape.h | 2 +- eeschema/lib_text.h | 2 +- include/api/api_handler.h | 4 ++-- 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index f918d5557e..4fd886ac20 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -79,7 +79,7 @@ public: return aItem && aItem->Type() == LIB_FIELD_T; } - wxString GetTypeName() const override + wxString GetFriendlyName() const override { return _( "Field" ); } diff --git a/eeschema/lib_item.cpp b/eeschema/lib_item.cpp index 0b567d3a08..1f78ebb717 100644 --- a/eeschema/lib_item.cpp +++ b/eeschema/lib_item.cpp @@ -70,7 +70,7 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorType() == LIB_PIN_T; } - wxString GetTypeName() const override + wxString GetFriendlyName() const override { return _( "Pin" ); } diff --git a/eeschema/lib_shape.h b/eeschema/lib_shape.h index 7318dafc1b..3eab67a135 100644 --- a/eeschema/lib_shape.h +++ b/eeschema/lib_shape.h @@ -49,7 +49,7 @@ public: return aItem && aItem->Type() == LIB_SHAPE_T; } - wxString GetTypeName() const override + wxString GetFriendlyName() const override { return ShowShape(); } diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 3fa18e8554..50d2a1d29a 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -55,7 +55,7 @@ public: return aItem && aItem->Type() == LIB_TEXT_T; } - wxString GetTypeName() const override + wxString GetFriendlyName() const override { return _( "Text" ); } diff --git a/include/api/api_handler.h b/include/api/api_handler.h index daf668f5a4..433db158e4 100644 --- a/include/api/api_handler.h +++ b/include/api/api_handler.h @@ -92,7 +92,7 @@ protected: HANDLER_RESULT( HandlerType::* aHandler )( RequestType&, const HANDLER_CONTEXT& ) ) { - std::string typeName = RequestType().GetTypeName(); + std::string typeName = RequestType().GetFriendlyName(); wxASSERT_MSG( !m_handlers.count( typeName ), wxString::Format( "Duplicate API handler for type %s", typeName ) ); @@ -138,7 +138,7 @@ private: if( !aRequest.message().UnpackTo( &aDest ) ) { std::string msg = fmt::format( "could not unpack message of type {} from request", - aDest.GetTypeName() ); + aDest.GetFriendlyName() ); aReply.mutable_status()->set_status( ApiStatusCode::AS_BAD_REQUEST ); aReply.mutable_status()->set_error_message( msg ); return false;