From a93c2c24faa7000c370e4561b622653d32330f19 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 21 Nov 2021 17:26:51 +0100 Subject: [PATCH] kicad2step: fix compatibility with OCC versions < 7.5 --- utils/kicad2step/kicad2step.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/utils/kicad2step/kicad2step.cpp b/utils/kicad2step/kicad2step.cpp index 2ee29859b0..4120672054 100644 --- a/utils/kicad2step/kicad2step.cpp +++ b/utils/kicad2step/kicad2step.cpp @@ -41,6 +41,14 @@ #include // OpenCascade output messenger #include // In open cascade +#include + +#define OCC_VERSION_MIN 0x070500 + +#if OCC_VERSION_HEX < OCC_VERSION_MIN +#include +#endif + class KICAD2STEP_FRAME : public KICAD2STEP_FRAME_BASE { public: @@ -62,12 +70,31 @@ void ReportMessage( const wxString& aMessage ) class KiCadPrinter : public Message_Printer { protected: - virtual void send (const TCollection_AsciiString& theString, const Message_Gravity theGravity) const override +#if OCC_VERSION_HEX < OCC_VERSION_MIN + virtual void Send( const TCollection_ExtendedString& theString, + const Message_Gravity theGravity, + const Standard_Boolean theToPutEol ) const override + { + Send (TCollection_AsciiString (theString), theGravity, theToPutEol); + } + + virtual void Send( const TCollection_AsciiString& theString, + const Message_Gravity theGravity, + const Standard_Boolean theToPutEol) const override +#else + virtual void send( const TCollection_AsciiString& theString, + const Message_Gravity theGravity ) const override +#endif { if( theGravity >= Message_Info ) { - ReportMessage( theString.ToCString() ); + ReportMessage( theString.ToCString() ); +#if OCC_VERSION_HEX < OCC_VERSION_MIN + if( theToPutEol ) + ReportMessage( "\n" ); +#else ReportMessage( "\n" ); +#endif } if( theGravity >= Message_Alarm ) openPanel->m_error = true;