1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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:
kgv
2020-04-15 22:44:49 +03:00
committed by bugmaster
parent 0ebe5b0a7f
commit fa8a462827
15 changed files with 156 additions and 344 deletions

View 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 :
//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";
}

View File

@@ -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