mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument
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.
This commit is contained in:
@@ -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 :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Draw_Printer::Draw_Printer (const Draw_Interpretor& theTcl)
|
||||
: myTcl((Standard_Address)&theTcl)
|
||||
Draw_Printer::Draw_Printer (Draw_Interpretor& theTcl)
|
||||
: myTcl (&theTcl)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Send
|
||||
//function : send
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Draw_Printer::Send (const TCollection_ExtendedString& 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";
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Send
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Draw_Printer::Send (const Standard_CString 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 TCollection_AsciiString& 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";
|
||||
}
|
||||
*myTcl << theString << "\n";
|
||||
}
|
||||
|
@@ -16,18 +16,8 @@
|
||||
#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
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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); }
|
||||
|
@@ -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_AsciiString& theString,
|
||||
const Message_Gravity theGravity,
|
||||
const Standard_Boolean theToOutEol) const
|
||||
void Message_Printer::Send (const TCollection_ExtendedString& theString,
|
||||
const Message_Gravity theGravity) const
|
||||
{
|
||||
if (theGravity >= myTraceLevel)
|
||||
{
|
||||
Send (TCollection_ExtendedString (theString), theGravity, theToOutEol);
|
||||
send (TCollection_AsciiString (theString), theGravity);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Send
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Message_Printer::Send (const TCollection_AsciiString& theString,
|
||||
const Message_Gravity theGravity) const
|
||||
{
|
||||
if (theGravity >= myTraceLevel)
|
||||
{
|
||||
send (theString, theGravity);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -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;
|
||||
|
||||
};
|
||||
|
@@ -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)
|
||||
if (myEventSource != NULL)
|
||||
{
|
||||
debugMsgToConsole (theString);
|
||||
#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
|
||||
}
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
|
@@ -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:
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user