]> OCCT Git - occt-copy.git/commitdiff
0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument
authorkgv <kgv@opencascade.com>
Wed, 15 Apr 2020 19:44:49 +0000 (22:44 +0300)
committerbugmaster <bugmaster@opencascade.com>
Sat, 9 May 2020 14:22:14 +0000 (17:22 +0300)
The argument putEndl has been removed from Message_Messenger::Send() and Message_Printer::Send() methods.

Message_Printer interface has been changed, so that sub-classes have to implement new method
Message_Printer::send() accepting TCollection_AsciiString.
Old three Message_Printer::Send() methods remain available without putEndl argument
and redirecting to new send() method by default.

Removed dummy Message_PrinterOStream::GetUseUtf8() property.
Message_PrinterOStream, Message_PrinterSystemLog and Draw_Printer
now implement single method Message_Printer::send() instead of triplet.

15 files changed:
dox/dev_guides/upgrade/upgrade.md
samples/java/jniviewer/jni/OcctJni_MsgPrinter.cxx
samples/java/jniviewer/jni/OcctJni_MsgPrinter.hxx
src/Draw/Draw_Printer.cxx
src/Draw/Draw_Printer.hxx
src/Message/Message_Messenger.cxx
src/Message/Message_Messenger.hxx
src/Message/Message_Printer.cxx
src/Message/Message_Printer.hxx
src/Message/Message_PrinterOStream.cxx
src/Message/Message_PrinterOStream.hxx
src/Message/Message_PrinterSystemLog.cxx
src/Message/Message_PrinterSystemLog.hxx
src/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx
src/TransferBRep/TransferBRep.cxx

index fb2e134943d7fd9788ee4455e815e804f34c511c..88b05a2c91af3ac20303a359ad0c92d4db9f3e2e 100644 (file)
@@ -1934,3 +1934,47 @@ void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
 Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating values and derivatives of offset curve is unified for offset direction used in class Geom2d_OffsetCurve: now offset direction points to outer ("right") side of base curve instead of the previously used inner ("left") side. Old usage of class in any application should be changed something like that:
 
 Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
+
+@subsection upgrade_750_message_messenger Message_Messenger interface change
+
+Operators << with left argument *Handle(Message_Messenger)*, used to output messages with
+a stream-like interface,  have been removed.
+This functionality is provided now by separate class *Message_Messenger::StreamBuffer*.
+That class contains a stringstream buffer which can be filled using standard stream
+operators. The string is sent to a messenger on destruction of the buffer object,
+call of its method Flush(), or using operator << with one of ostream manipulators (*std::endl, std::flush, std::ends*). Manipulator *Message_EndLine* has been removed,
+*std::endl* should be used instead.
+
+New methods *SendFail(), SendAlarm(), SendWarning(), SendInfo()*, and *SendTrace()* are
+provided in both *Message_Messenger* class and as static functions in *Message* package
+(short-cuts to default messenger), returning buffer object for the output of
+corresponding type of the message.
+
+The code that used operator << for messenger, should be ported as follows.
+
+Before the change:
+~~~~~
+  Handle(Message_Messenger) theMessenger = ...;
+  theMessenger << "Sample string " << anInteger << ", " << Message_EndLine;
+~~~~~
+
+After the change, single-line variant:
+~~~~~
+  Handle(Message_Messenger) theMessenger = ...;
+  theMessenger->SendInfo() << "Value = " << anInteger << ", ";
+~~~~~
+
+After the change, extended variant:
+~~~~~
+  Handle(Message_Messenger) theMessenger = ...;
+  Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo();
+  aSender << "Array: [";
+  for (int i = 0; i < aNb; ++i) { aSender << anArray[i]; }
+  aSender << "]" << std::endl; // aSender can be used further for other messages
+~~~~~
+
+@subsection upgrade_750_message_printer Message_Printer interface change
+
+Previously, sub-classes of *Message_Printer* have to provide a triplet of *Message_Printer::Send()* methods accepting different string representations: TCollection_AsciiString, TCollection_ExtendedString and Standard_CString.
+*Message_Printer* interface has been changed, so that sub-classes now have to implement only single method *Message_Printer::send()* accepting TCollection_AsciiString argument and having no Endl flag, which has been removed.
+Old three Message_Printer::Send() methods remain defined virtual with unused last argument and redirecting to new send() method by default.
index da559a40273241ee4d82c5cd3e8c42569f894427..62ea7f954e69d5f7415afc13abd84311d033c027 100644 (file)
@@ -48,27 +48,11 @@ OcctJni_MsgPrinter::~OcctJni_MsgPrinter()
 }
 
 // =======================================================================
-// function : Send
+// function : send
 // purpose  :
 // =======================================================================
-void OcctJni_MsgPrinter::Send (const TCollection_ExtendedString& theString,
-                               const Message_Gravity             theGravity,
-                               const Standard_Boolean            theToPutEndl) const
-{
-  if (theGravity >= myTraceLevel)
-  {
-    const TCollection_AsciiString aStr (theString);
-    OcctJni_MsgPrinter::Send (aStr, theGravity, theToPutEndl);
-  }
-}
-
-// =======================================================================
-// function : Send
-// purpose  :
-// =======================================================================
-void OcctJni_MsgPrinter::Send (const TCollection_AsciiString& theString,
-                               const Message_Gravity          theGravity,
-                               const Standard_Boolean         theToPutEndl) const
+void OcctJni_MsgPrinter::send (const TCollection_AsciiString& theString,
+                               const Message_Gravity theGravity) const
 {
   if (theGravity < myTraceLevel)
   {
@@ -85,17 +69,3 @@ void OcctJni_MsgPrinter::Send (const TCollection_AsciiString& theString,
   myJEnv->CallObjectMethod (myJObj, myJMet, aJStr);
   myJEnv->DeleteLocalRef (aJStr);
 }
-
-// =======================================================================
-// function : Send
-// purpose  :
-// =======================================================================
-void OcctJni_MsgPrinter::Send (const Standard_CString& theString,
-                               const Message_Gravity   theGravity,
-                               const Standard_Boolean  theToPutEndl) const
-{
-  if (theGravity >= myTraceLevel)
-  {
-    OcctJni_MsgPrinter::Send (TCollection_AsciiString (theString), theGravity, theToPutEndl);
-  }
-}
index 5f2fa0c733ec43dd668af7acd304cc604376d322..3f825dea524eeb9b7772a942c16ee5fd2603b602 100644 (file)
@@ -30,20 +30,11 @@ public:
   //! Destructor.
   ~OcctJni_MsgPrinter();
 
-  //! Redirection to TCollection_AsciiString method
-  virtual void Send (const TCollection_ExtendedString& theString,
-                     const Message_Gravity             theGravity,
-                     const Standard_Boolean            theToPutEndl) const;
-
-  //! Redirection to TCollection_AsciiString method
-  virtual void Send (const Standard_CString&           theString,
-                     const Message_Gravity             theGravity,
-                     const Standard_Boolean            theToPutEndl) const;
+protected:
 
   //! Main printing method
-  virtual void Send (const TCollection_AsciiString&    theString,
-                     const Message_Gravity             theGravity,
-                     const Standard_Boolean            theToPutEndl) const;
+  virtual void send (const TCollection_AsciiString& theString,
+                     const Message_Gravity theGravity) const;
 
 private:
 
index 09e29e1e14b2fe5a93c3a424d55b17ce1d699d76..32c8ad63e2b31b55c663970f401cec593572fa37 100644 (file)
@@ -13,9 +13,8 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <Draw_Printer.hxx>
-#include <Standard_Type.hxx>
+
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 
@@ -23,75 +22,25 @@ IMPLEMENT_STANDARD_RTTIEXT(Draw_Printer,Message_Printer)
 
 //=======================================================================
 //function : Draw_Printer
-//purpose  : 
-//=======================================================================
-Draw_Printer::Draw_Printer (const Draw_Interpretor& theTcl)
-: myTcl((Standard_Address)&theTcl)
-{
-}
-
-//=======================================================================
-//function : Send
-//purpose  :
-//=======================================================================
-
-void Draw_Printer::Send (const TCollection_ExtendedString& theString,
-                         const Message_Gravity             theGravity,
-                         const Standard_Boolean            theToPutEol) const
-{
-  if (!myTcl
-   || theGravity < myTraceLevel)
-  {
-    return;
-  }
-
-  (*(Draw_Interpretor*)myTcl) << theString;
-  if (theToPutEol)
-  {
-    (*(Draw_Interpretor*)myTcl) << "\n";
-  }
-}
-
-//=======================================================================
-//function : Send
 //purpose  :
 //=======================================================================
-
-void Draw_Printer::Send (const Standard_CString theString,
-                         const Message_Gravity  theGravity,
-                         const Standard_Boolean theToPutEol) const
+Draw_Printer::Draw_Printer (Draw_Interpretor& theTcl)
+: myTcl (&theTcl)
 {
-  if (!myTcl
-   || theGravity < myTraceLevel)
-  {
-    return;
-  }
-
-  (*(Draw_Interpretor*)myTcl) << theString;
-  if (theToPutEol)
-  {
-    (*(Draw_Interpretor*)myTcl) << "\n";
-  }
 }
 
 //=======================================================================
-//function : Send
+//function : send
 //purpose  :
 //=======================================================================
-
-void Draw_Printer::Send (const TCollection_AsciiString& theString,
-                         const Message_Gravity          theGravity,
-                         const Standard_Boolean         theToPutEol) const
+void Draw_Printer::send (const TCollection_AsciiString& theString,
+                         const Message_Gravity theGravity) const
 {
-  if (!myTcl
+  if (myTcl == NULL
    || theGravity < myTraceLevel)
   {
     return;
   }
 
-  (*(Draw_Interpretor*)myTcl) << theString;
-  if (theToPutEol)
-  {
-    (*(Draw_Interpretor*)myTcl) << "\n";
-  }
+  *myTcl << theString << "\n";
 }
index 2cd649bc2b18ac7c80457f69d0530f73d038d927..58e758e03c0382de37f352d9ceadffb38e815de0 100644 (file)
 #ifndef _Draw_Printer_HeaderFile
 #define _Draw_Printer_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <Standard_Address.hxx>
 #include <Message_Printer.hxx>
 #include <Draw_Interpretor.hxx>
-#include <Message_Gravity.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_CString.hxx>
-class TCollection_ExtendedString;
-class TCollection_AsciiString;
-
 
 class Draw_Printer;
 DEFINE_STANDARD_HANDLE(Draw_Printer, Message_Printer)
@@ -36,53 +26,22 @@ DEFINE_STANDARD_HANDLE(Draw_Printer, Message_Printer)
 //! (Message_Messenge) directed to Draw_Interpretor
 class Draw_Printer : public Message_Printer
 {
-
+  DEFINE_STANDARD_RTTIEXT(Draw_Printer, Message_Printer)
 public:
 
-  
   //! Creates a printer connected to the interpretor.
-  Standard_EXPORT Draw_Printer(const Draw_Interpretor& theTcl);
-  
-  //! Send a string message with specified trace level.
-  //! The parameter putEndl specified whether end-of-line
-  //! should be added to the end of the message.
-  //! This method must be redefined in descentant.
-  Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString, const Message_Gravity theGravity, const Standard_Boolean putEndl) const Standard_OVERRIDE;
-  
-  //! Send a string message with specified trace level.
-  //! The parameter putEndl specified whether end-of-line
-  //! should be added to the end of the message.
-  //! Default implementation calls first method Send().
-  Standard_EXPORT virtual void Send (const Standard_CString theString, const Message_Gravity theGravity, const Standard_Boolean putEndl) const Standard_OVERRIDE;
-  
-  //! Send a string message with specified trace level.
-  //! The parameter putEndl specified whether end-of-line
-  //! should be added to the end of the message.
-  //! Default implementation calls first method Send().
-  Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString, const Message_Gravity theGravity, const Standard_Boolean putEndl) const Standard_OVERRIDE;
-
-
-
-
-  DEFINE_STANDARD_RTTIEXT(Draw_Printer,Message_Printer)
+  Standard_EXPORT Draw_Printer (Draw_Interpretor& theTcl);
 
 protected:
 
-
-
+  //! Send a string message with specified trace level.
+  Standard_EXPORT virtual void send (const TCollection_AsciiString& theString,
+                                     const Message_Gravity theGravity) const Standard_OVERRIDE;
 
 private:
 
-
-  Standard_Address myTcl;
-
+  Draw_Interpretor* myTcl;
 
 };
 
-
-
-
-
-
-
 #endif // _Draw_Printer_HeaderFile
index 1e44c8b22088a0df17d6cb11cda947fa5e0a4451..e620ee29fc3483f0317d3b98934c97b9e326ee6c 100644 (file)
@@ -111,15 +111,14 @@ Standard_Integer Message_Messenger::RemovePrinters (const Handle(Standard_Type)&
 //=======================================================================
 
 void Message_Messenger::Send (const Standard_CString theString,
-                             const Message_Gravity theGravity,
-                             const Standard_Boolean putEndl) const
+                             const Message_Gravity theGravity) const
 {
   for (Message_SequenceOfPrinters::Iterator aPrinterIter (myPrinters); aPrinterIter.More(); aPrinterIter.Next())
   {
     const Handle(Message_Printer)& aPrinter = aPrinterIter.Value();
     if (!aPrinter.IsNull())
     {
-      aPrinter->Send (theString, theGravity, putEndl);
+      aPrinter->Send (theString, theGravity);
     }
   }
 }
@@ -130,15 +129,14 @@ void Message_Messenger::Send (const Standard_CString theString,
 //=======================================================================
 
 void Message_Messenger::Send (const TCollection_AsciiString& theString,
-                                    const Message_Gravity theGravity,
-                                    const Standard_Boolean putEndl) const
+                              const Message_Gravity theGravity) const
 {
   for (Message_SequenceOfPrinters::Iterator aPrinterIter (myPrinters); aPrinterIter.More(); aPrinterIter.Next())
   {
     const Handle(Message_Printer)& aPrinter = aPrinterIter.Value();
     if (!aPrinter.IsNull())
     {
-      aPrinter->Send (theString, theGravity, putEndl);
+      aPrinter->Send (theString, theGravity);
     }
   }
 }
@@ -149,15 +147,14 @@ void Message_Messenger::Send (const TCollection_AsciiString& theString,
 //=======================================================================
 
 void Message_Messenger::Send (const TCollection_ExtendedString& theString,
-                                    const Message_Gravity theGravity,
-                                    const Standard_Boolean putEndl) const
+                              const Message_Gravity theGravity) const
 {
   for (Message_SequenceOfPrinters::Iterator aPrinterIter (myPrinters); aPrinterIter.More(); aPrinterIter.Next())
   {
     const Handle(Message_Printer)& aPrinter = aPrinterIter.Value();
     if (!aPrinter.IsNull())
     {
-      aPrinter->Send (theString, theGravity, putEndl);
+      aPrinter->Send (theString, theGravity);
     }
   }
 }
index fbed890b6705ef9cf12a3943b5c61f1360199590..ca993d51e30809667e802da2939319edc8eb6d2e 100644 (file)
@@ -174,22 +174,16 @@ public:
   //! Dispatch a message to all the printers in the list.
   //! Three versions of string representations are accepted for
   //! convenience, by default all are converted to ExtendedString.
-  //! The parameter putEndl specifies whether the new line should
-  //! be started after this message (default) or not (may have
-  //! sense in some conditions).
   Standard_EXPORT void Send (const Standard_CString theString,
-                             const Message_Gravity theGravity = Message_Warning,
-                             const Standard_Boolean putEndl = Standard_True) const;
+                             const Message_Gravity theGravity = Message_Warning) const;
   
   //! See above
   Standard_EXPORT void Send (const TCollection_AsciiString& theString,
-                             const Message_Gravity theGravity = Message_Warning,
-                             const Standard_Boolean putEndl = Standard_True) const;
+                             const Message_Gravity theGravity = Message_Warning) const;
   
   //! See above
   Standard_EXPORT void Send (const TCollection_ExtendedString& theString,
-                             const Message_Gravity theGravity = Message_Warning,
-                             const Standard_Boolean putEndl = Standard_True) const;
+                             const Message_Gravity theGravity = Message_Warning) const;
 
   //! Create string buffer for message of specified type
   StreamBuffer Send (Message_Gravity theGravity) { return StreamBuffer (this, theGravity); }
index 8ed2b87e6a5a52d142bfa885557c8b9e90e4a259..06a64c05d2bb97e4c6c4009575ec742204fe0941 100644 (file)
@@ -33,14 +33,12 @@ Message_Printer::Message_Printer()
 //function : Send
 //purpose  :
 //=======================================================================
-
 void Message_Printer::Send (const Standard_CString theString,
-                            const Message_Gravity  theGravity,
-                            const Standard_Boolean theToOutEol) const
+                            const Message_Gravity  theGravity) const
 {
   if (theGravity >= myTraceLevel)
   {
-    Send (TCollection_ExtendedString (theString, Standard_True), theGravity, theToOutEol);
+    send (TCollection_AsciiString (theString), theGravity);
   }
 }
 
@@ -48,13 +46,24 @@ void Message_Printer::Send (const Standard_CString theString,
 //function : Send
 //purpose  :
 //=======================================================================
+void Message_Printer::Send (const TCollection_ExtendedString& theString,
+                            const Message_Gravity theGravity) const
+{
+  if (theGravity >= myTraceLevel)
+  {
+    send (TCollection_AsciiString (theString), theGravity);
+  }
+}
 
+//=======================================================================
+//function : Send
+//purpose  :
+//=======================================================================
 void Message_Printer::Send (const TCollection_AsciiString& theString,
-                            const Message_Gravity          theGravity,
-                            const Standard_Boolean         theToOutEol) const
+                            const Message_Gravity theGravity) const
 {
   if (theGravity >= myTraceLevel)
   {
-    Send (TCollection_ExtendedString (theString), theGravity, theToOutEol);
+    send (theString, theGravity);
   }
 }
index e7e70ddfbd8694b548ab749a00cc2570236cc3cb..cd28dcee1daa575c2acbfa679dafeea410a7cc06 100644 (file)
@@ -48,25 +48,33 @@ public:
   void SetTraceLevel (const Message_Gravity theTraceLevel) { myTraceLevel = theTraceLevel; }
 
   //! Send a string message with specified trace level.
-  //! The parameter theToPutEol specified whether end-of-line should be added to the end of the message.
-  //! This method must be redefined in descentant.
-  Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const = 0;
+  //! The last Boolean argument is deprecated and unused.
+  //! Default implementation redirects to send().
+  Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString,
+                                     const Message_Gravity theGravity) const;
   
   //! Send a string message with specified trace level.
-  //! The parameter theToPutEol specified whether end-of-line should be added to the end of the message.
-  //! Default implementation calls first method Send().
-  Standard_EXPORT virtual void Send (const Standard_CString theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const;
+  //! The last Boolean argument is deprecated and unused.
+  //! Default implementation redirects to send().
+  Standard_EXPORT virtual void Send (const Standard_CString theString,
+                                     const Message_Gravity theGravity) const;
   
   //! Send a string message with specified trace level.
-  //! The parameter theToPutEol specified whether end-of-line should be added to the end of the message.
-  //! Default implementation calls first method Send().
-  Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const;
+  //! The last Boolean argument is deprecated and unused.
+  //! Default implementation redirects to send().
+  Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString,
+                                     const Message_Gravity theGravity) const;
 
 protected:
 
   //! Empty constructor with Message_Info trace level
   Standard_EXPORT Message_Printer();
 
+  //! Send a string message with specified trace level.
+  //! This method must be redefined in descentant.
+  Standard_EXPORT virtual void send (const TCollection_AsciiString& theString,
+                                     const Message_Gravity theGravity) const = 0;
+
 protected:
 
   Message_Gravity myTraceLevel;
index ce7bb1ec358e4072732731fdb93fb134200db8bf..ee53f8187ac6c0cc02793a7ca1a117876c575543 100644 (file)
@@ -36,7 +36,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Message_PrinterOStream,Message_Printer)
 Message_PrinterOStream::Message_PrinterOStream (const Message_Gravity theTraceLevel)
 : myStream  (&std::cout),
   myIsFile  (Standard_False),
-  myUseUtf8 (Standard_False),
   myToColorize (Standard_True)
 {
   myTraceLevel = theTraceLevel;
@@ -52,7 +51,6 @@ Message_PrinterOStream::Message_PrinterOStream (const Standard_CString theFileNa
                                                 const Message_Gravity  theTraceLevel)
 : myStream (&std::cout),
   myIsFile (Standard_False),
-  myUseUtf8 (Standard_False),
   myToColorize (Standard_True)
 {
   myTraceLevel = theTraceLevel;
@@ -112,13 +110,11 @@ void Message_PrinterOStream::Close ()
 }
 
 //=======================================================================
-//function : Send
-//purpose  : 
+//function : send
+//purpose  :
 //=======================================================================
-
-void Message_PrinterOStream::Send (const Standard_CString theString,
-                                  const Message_Gravity theGravity,
-                                  const Standard_Boolean putEndl) const
+void Message_PrinterOStream::send (const TCollection_AsciiString& theString,
+                                   const Message_Gravity theGravity) const
 {
   if (theGravity < myTraceLevel
    || myStream == NULL)
@@ -165,35 +161,7 @@ void Message_PrinterOStream::Send (const Standard_CString theString,
   {
     *aStream << theString;
   }
-  if (putEndl)
-  {
-    (*aStream) << std::endl;
-  }
-}
-
-//=======================================================================
-//function : Send
-//purpose  : 
-//=======================================================================
-
-void Message_PrinterOStream::Send (const TCollection_AsciiString &theString,
-                                  const Message_Gravity theGravity,
-                                  const Standard_Boolean putEndl) const
-{
-  Send ( theString.ToCString(), theGravity, putEndl );
-}
-
-//=======================================================================
-//function : Send
-//purpose  : 
-//=======================================================================
-
-void Message_PrinterOStream::Send (const TCollection_ExtendedString &theString,
-                                  const Message_Gravity theGravity,
-                                  const Standard_Boolean putEndl) const
-{
-  TCollection_AsciiString aStr (theString, myUseUtf8 ? Standard_Character(0) : '?');
-  Send (aStr.ToCString(), theGravity, putEndl);
+  (*aStream) << std::endl;
 }
 
 //=======================================================================
index 163a2ac0ced277c0ef21e3c41e4c3846293bdbe0..fe69d4ff8691b09b3b0dbac987d0b537a007923e 100644 (file)
@@ -65,12 +65,6 @@ public:
   Close();
 }
 
-  //! Returns option to convert non-Ascii symbols to UTF8 encoding
-  Standard_Boolean GetUseUtf8() const { return myUseUtf8; }
-  
-  //! Sets option to convert non-Ascii symbols to UTF8 encoding
-  void SetUseUtf8 (const Standard_Boolean useUtf8) { myUseUtf8 = useUtf8; }
-
   //! Returns reference to the output stream
   Standard_OStream& GetStream() const { return *(Standard_OStream*)myStream; }
 
@@ -80,28 +74,17 @@ public:
   //! Set if text output into console should be colorized depending on message gravity.
   void SetToColorize (Standard_Boolean theToColorize) { myToColorize = theToColorize; }
 
+protected:
+
   //! Puts a message to the current stream
   //! if its gravity is equal or greater
   //! to the trace level set by SetTraceLevel()
-  Standard_EXPORT virtual void Send (const Standard_CString theString, const Message_Gravity theGravity, const Standard_Boolean putEndl = Standard_True) const Standard_OVERRIDE;
-  
-  //! Puts a message to the current stream
-  //! if its gravity is equal or greater
-  //! to the trace level set by SetTraceLevel()
-  Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString, const Message_Gravity theGravity, const Standard_Boolean putEndl = Standard_True) const Standard_OVERRIDE;
-  
-  //! Puts a message to the current stream
-  //! if its gravity is equal or greater
-  //! to the trace level set by SetTraceLevel()
-  //! Non-Ascii symbols are converted to UTF-8 if UseUtf8
-  //! option is set, else replaced by symbols '?'
-  Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString, const Message_Gravity theGravity, const Standard_Boolean putEndl = Standard_True) const Standard_OVERRIDE;
+  Standard_EXPORT virtual void send (const TCollection_AsciiString& theString, const Message_Gravity theGravity) const Standard_OVERRIDE;
 
 private:
 
   Standard_Address myStream;
   Standard_Boolean myIsFile;
-  Standard_Boolean myUseUtf8;
   Standard_Boolean myToColorize;
 
 };
index b87d4b410d82de7340016ee9af81240c3b407bed..e17b7df791690e9362c2ff5e831ecf722c5d4519 100644 (file)
@@ -149,12 +149,11 @@ Message_PrinterSystemLog::~Message_PrinterSystemLog()
 }
 
 //=======================================================================
-//function : Send
+//function : send
 //purpose  :
 //=======================================================================
-void Message_PrinterSystemLog::Send (const Standard_CString theString,
-                                     const Message_Gravity theGravity,
-                                     const Standard_Boolean ) const
+void Message_PrinterSystemLog::send (const TCollection_AsciiString& theString,
+                                     const Message_Gravity theGravity) const
 {
   if (theGravity < myTraceLevel)
   {
@@ -162,38 +161,18 @@ void Message_PrinterSystemLog::Send (const Standard_CString theString,
   }
 
 #if defined(_WIN32)
-  Send (TCollection_ExtendedString (theString), theGravity, true);
-#elif defined(__ANDROID__)
-  __android_log_write (getAndroidLogPriority (theGravity), myEventSourceName.ToCString(), theString);
-#elif defined(__EMSCRIPTEN__)
-  if (theGravity == Message_Trace)
-  {
-    debugMsgToConsole (theString);
-  }
-  else
-  {
-    emscripten_log (getEmscriptenPriority (theGravity), "%s", theString);
-  }
-#else
-  syslog (getSysLogPriority (theGravity), "%s", theString);
-#endif
-}
-
-//=======================================================================
-//function : Send
-//purpose  :
-//=======================================================================
-void Message_PrinterSystemLog::Send (const TCollection_AsciiString& theString,
-                                     const Message_Gravity theGravity,
-                                     const Standard_Boolean ) const
-{
-  if (theGravity < myTraceLevel)
+  if (myEventSource != NULL)
   {
-    return;
+  #if !defined(OCCT_UWP)
+    const TCollection_ExtendedString aWideString (theString);
+    const WORD aLogType = getEventLogPriority (theGravity);
+    const wchar_t* aMessage[1] = { aWideString.ToWideString() };
+    ReportEventW ((HANDLE )myEventSource, aLogType, 0, 0, NULL,
+                  1, 0, aMessage, NULL);
+  #else
+    (void )theString;
+  #endif
   }
-
-#if defined(_WIN32)
-  Send (TCollection_ExtendedString (theString), theGravity, true);
 #elif defined(__ANDROID__)
   __android_log_write (getAndroidLogPriority (theGravity), myEventSourceName.ToCString(), theString.ToCString());
 #elif defined(__EMSCRIPTEN__)
@@ -209,33 +188,3 @@ void Message_PrinterSystemLog::Send (const TCollection_AsciiString& theString,
   syslog (getSysLogPriority (theGravity), "%s", theString.ToCString());
 #endif
 }
-
-//=======================================================================
-//function : Send
-//purpose  :
-//=======================================================================
-void Message_PrinterSystemLog::Send (const TCollection_ExtendedString& theString,
-                                     const Message_Gravity theGravity,
-                                     const Standard_Boolean ) const
-{
-  if (theGravity < myTraceLevel)
-  {
-    return;
-  }
-
-#if defined(_WIN32)
-  if (myEventSource != NULL)
-  {
-  #if !defined(OCCT_UWP)
-    const WORD aLogType = getEventLogPriority (theGravity);
-    const wchar_t* aMessage[1] = { theString.ToWideString() };
-    ReportEventW ((HANDLE )myEventSource, aLogType, 0, 0, NULL,
-                  1, 0, aMessage, NULL);
-  #else
-    (void )theString;
-  #endif
-  }
-#else
-  Send (TCollection_AsciiString (theString), theGravity, true);
-#endif
-}
index 309a48a250041ae2d082a791f147326986b0e786..82b0e4e0e05f22fd927e5cb14cd5e5ba793f93b3 100644 (file)
@@ -36,20 +36,11 @@ public:
   //! Destructor.
   Standard_EXPORT virtual ~Message_PrinterSystemLog();
 
+protected:
+
   //! Puts a message to the system log.
-  Standard_EXPORT virtual void Send (const Standard_CString theString,
-                                     const Message_Gravity theGravity,
-                                     const Standard_Boolean theToPutEndl) const Standard_OVERRIDE;
-  
-  //! Puts a message to the system log.
-  Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString,
-                                     const Message_Gravity theGravity,
-                                     const Standard_Boolean theToPutEndl) const Standard_OVERRIDE;
-  
-  //! Puts a message to the system log.
-  Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString,
-                                     const Message_Gravity theGravity,
-                                     const Standard_Boolean theToPutEndl) const Standard_OVERRIDE;
+  Standard_EXPORT virtual void send (const TCollection_AsciiString& theString,
+                                     const Message_Gravity theGravity) const Standard_OVERRIDE;
 
 private:
 
index 18f64135a1f1bd59e87692383548c71a6732cc2b..9c797217a04b9b7e8eab33e061f4c465fc5d53a5 100644 (file)
@@ -122,29 +122,29 @@ void ShapeProcessAPI_ApplySequence::PrintPreparationResult () const
 
   // mapping
   Message_Msg EPMSG100 ("PrResult.Print.MSG100"); //Mapping:
-  aMessenger->Send (EPMSG100, Message_Info, Standard_True);
+  aMessenger->Send (EPMSG100, Message_Info);
   Message_Msg TPMSG50 ("PrResult.Print.MSG50"); //  Shells:
-  aMessenger->Send (TPMSG50, Message_Info, Standard_True);
+  aMessenger->Send (TPMSG50, Message_Info);
   Message_Msg EPMSG110 ("PrResult.Print.MSG110"); //    Result is Shell                 : %d
   EPMSG110.Arg (SS);
-  aMessenger->Send (EPMSG110, Message_Info, Standard_True);
+  aMessenger->Send (EPMSG110, Message_Info);
   Message_Msg EPMSG150 ("PrResult.Print.MSG150"); //    No Result                       : %d
   EPMSG150.Arg (SN);
-  aMessenger->Send (EPMSG150, Message_Info, Standard_True);
+  aMessenger->Send (EPMSG150, Message_Info);
   
   TCollection_AsciiString tmp110 (EPMSG110.Original()), tmp150  (EPMSG150.Original());
   EPMSG110.Set (tmp110.ToCString());
   EPMSG150.Set (tmp150.ToCString());
 
   Message_Msg TPMSG55 ("PrResult.Print.MSG55"); //  Faces:
-  aMessenger->Send (TPMSG55, Message_Info, Standard_True);
+  aMessenger->Send (TPMSG55, Message_Info);
   Message_Msg EPMSG115 ("PrResult.Print.MSG115"); //    Result is Face                  : %d
   EPMSG115.Arg (FF);
-  aMessenger->Send (EPMSG115, Message_Info, Standard_True);
+  aMessenger->Send (EPMSG115, Message_Info);
   EPMSG110.Arg (FS);
-  aMessenger->Send (EPMSG110, Message_Info, Standard_True);
+  aMessenger->Send (EPMSG110, Message_Info);
   EPMSG150.Arg (FN);
-  aMessenger->Send (EPMSG150, Message_Info, Standard_True);
+  aMessenger->Send (EPMSG150, Message_Info);
   
   // preparation ratio
   Standard_Real SPR = 1, FPR = 1;
@@ -153,12 +153,12 @@ void ShapeProcessAPI_ApplySequence::PrintPreparationResult () const
   if (NbS > 0) SPR = 1. * (NbS - SN) / NbS;
   if (NbF > 0) FPR = 1. * (NbF - FN) / NbF;
   Message_Msg PMSG200 ("PrResult.Print.MSG200"); //Preparation ratio:
-  aMessenger->Send (PMSG200, Message_Info, Standard_True);
+  aMessenger->Send (PMSG200, Message_Info);
   Message_Msg PMSG205 ("PrResult.Print.MSG205"); //  Shells: %d per cent
   PMSG205.Arg ((Standard_Integer) (100 * SPR));
-  aMessenger->Send (PMSG205, Message_Info, Standard_True);
+  aMessenger->Send (PMSG205, Message_Info);
   Message_Msg PMSG210 ("PrResult.Print.MSG210"); //  Faces : %d per cent
   PMSG210.Arg ((Standard_Integer) (100 * FPR));
-  aMessenger->Send (PMSG210, Message_Info, Standard_True);
+  aMessenger->Send (PMSG210, Message_Info);
 }
 
index 831f1fcfecbb93282c7accb2085182b7384a7ccb..057ca42f2a692bb22aec010688d7858053a643a0 100644 (file)
@@ -442,52 +442,52 @@ void TransferBRep::PrintResultInfo(const Handle(Message_Printer)& Printer,
   NRWF = ResultInfo->NoResultWarningFail();
   
   Message_Msg aLocalHeader = Header;
-  Printer->Send (aLocalHeader, Message_Info, Standard_True);
+  Printer->Send (aLocalHeader, Message_Info);
   
   Message_Msg EPMSG30 ("Result.Print.MSG30"); //    Result: %d
   EPMSG30.Arg (R);
-  Printer->Send (EPMSG30, Message_Info, Standard_True);
+  Printer->Send (EPMSG30, Message_Info);
   if(printEmpty || (RW > 0 )) {
     Message_Msg EPMSG32 ("Result.Print.MSG32"); //    Result + Warning(s): %d
     EPMSG32.Arg (RW);
-    Printer->Send (EPMSG32, Message_Info, Standard_True);
+    Printer->Send (EPMSG32, Message_Info);
   }
   if(printEmpty || (RF > 0 )) {
     Message_Msg EPMSG34 ("Result.Print.MSG34"); //    Result + Fail(s): %d
     EPMSG34.Arg (RF);
-    Printer->Send (EPMSG34, Message_Info, Standard_True);
+    Printer->Send (EPMSG34, Message_Info);
   }
   if(printEmpty || (RWF > 0)) {
     Message_Msg EPMSG36 ("Result.Print.MSG36"); //    Result + Warning(s) + Fail(s): %d
     EPMSG36.Arg (RWF);
-    Printer->Send (EPMSG36, Message_Info, Standard_True);
+    Printer->Send (EPMSG36, Message_Info);
   }
   Message_Msg EPMSG38 ("Result.Print.MSG38"); //    TOTAL Result: %d
   EPMSG38.Arg (R + RW + RF + RWF);
-  Printer->Send (EPMSG38, Message_Info, Standard_True);
+  Printer->Send (EPMSG38, Message_Info);
   if(printEmpty || (NR > 0)) {
     Message_Msg EPMSG40 ("Result.Print.MSG40"); //    No Result: %d
     EPMSG40.Arg (NR);
-    Printer->Send (EPMSG40, Message_Info, Standard_True);
+    Printer->Send (EPMSG40, Message_Info);
   }
   if(printEmpty || (NRW > 0)) {
     Message_Msg EPMSG42 ("Result.Print.MSG42"); //    No Result + Warning(s): %d
     EPMSG42.Arg (NRW);
-    Printer->Send (EPMSG42, Message_Info, Standard_True);
+    Printer->Send (EPMSG42, Message_Info);
   }
   if(printEmpty || (NRF > 0)) {
     Message_Msg EPMSG44 ("Result.Print.MSG44"); //    No Result + Fail(s): %d
     EPMSG44.Arg (NRF);
-    Printer->Send (EPMSG44, Message_Info, Standard_True);
+    Printer->Send (EPMSG44, Message_Info);
   }
   if(printEmpty || (NRWF > 0)) {
     Message_Msg EPMSG46 ("Result.Print.MSG46"); //    No Result + Warning(s) + Fail(s): %d
     EPMSG46.Arg (NRWF);
-    Printer->Send (EPMSG46, Message_Info, Standard_True);
+    Printer->Send (EPMSG46, Message_Info);
   }
   
   Message_Msg EPMSG48 ("Result.Print.MSG48"); //    TOTAL No Result: %d
   EPMSG48.Arg (NR + NRW + NRF + NRWF);
-  Printer->Send (EPMSG48, Message_Info, Standard_True);
+  Printer->Send (EPMSG48, Message_Info);
 
 }