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

Operators << for Handle(Message_Messenger) are removed; their use is replaced by use of Message_Messenger::StreamBuffer
Message_Messenger has been replaced by Standard_OStream within Interface_InterfaceModel,IFSelect,IGES,STEP dump interfaces.
This commit is contained in:
abv
2020-04-30 15:45:31 +03:00
committed by bugmaster
parent 39c8dc708f
commit 0ebe5b0a7f
382 changed files with 3109 additions and 3576 deletions

View File

@@ -685,7 +685,7 @@ void Interface_Check::GetAsWarning(const Handle(Interface_Check)& other,
//purpose :
//=======================================================================
void Interface_Check::Print(const Handle(Message_Messenger)& S, const Standard_Integer level,
void Interface_Check::Print(Standard_OStream& S, const Standard_Integer level,
const Standard_Integer final) const
{
Standard_Integer j, nb = NbFails();
@@ -695,9 +695,9 @@ void Interface_Check::Print(const Handle(Message_Messenger)& S, const Standard_I
// if (nb > 0) S<<" --> Fails : "<<nb<<std::endl;
for (j = 1; j <= nb; j ++) {
if (final >= 0)
S<<CFail(j,Standard_True)<<"\n";
S <<CFail(j,Standard_True)<<"\n";
else
S<<CFail(j,Standard_False)<<"\n";
S <<CFail(j,Standard_False)<<"\n";
// if (final == 0)
// if (Fail(j,Standard_True) != Fail(j,Standard_False))
// S<<"[original:"<<CFail(j,Standard_False)<<"]\n";
@@ -709,9 +709,9 @@ void Interface_Check::Print(const Handle(Message_Messenger)& S, const Standard_I
// if (nb > 0) S<<" --> Warnings : "<<nb<<std::endl;
for (j = 1; j <= nb; j ++) {
if (final >= 0)
S<<CWarning(j,Standard_True)<<"\n";
S <<CWarning(j,Standard_True)<<"\n";
else
S<<CWarning(j,Standard_False)<<"\n";
S <<CWarning(j,Standard_False)<<"\n";
// if (final == 0)
// if (Warning(j,Standard_True) != Warning(j,Standard_False))
// S<<"[original:"<<CWarning(j,Standard_False)<<"]\n";
@@ -724,9 +724,9 @@ void Interface_Check::Print(const Handle(Message_Messenger)& S, const Standard_I
// if (nb > 0) S<<" --> Infos : "<<nb<<std::endl;
for (j = 1; j <= nb; j ++) {
if (final >= 0)
S<<CInfoMsg(j,Standard_True)<<"\n";
S <<CInfoMsg(j,Standard_True)<<"\n";
else
S<<CInfoMsg(j,Standard_False)<<"\n";
S <<CInfoMsg(j,Standard_False)<<"\n";
// if (final == 0)
// if (InfoMsg(j,Standard_True) != InfoMsg(j,Standard_False))
// S<<"[original:"<<CInfoMsg(j,Standard_False)<<"]\n";
@@ -744,5 +744,6 @@ void Interface_Check::Print(const Handle(Message_Messenger)& S, const Standard_I
void Interface_Check::Trace(const Standard_Integer level,
const Standard_Integer final) const
{
Print (Message::DefaultMessenger(), level, final);
Message_Messenger::StreamBuffer sout = Message::SendInfo(); // shouldn't it be changed to SendTrace()?
Print (sout, level, final);
}

View File

@@ -30,7 +30,6 @@ class Standard_Transient;
class Standard_OutOfRange;
class Message_Msg;
class TCollection_HAsciiString;
class Message_Messenger;
// resolve name collisions with X11 headers
#ifdef Status
@@ -238,7 +237,7 @@ public:
//! <final> : if positive (D) prints final values of messages
//! if negative, prints originals
//! if null, prints both forms
Standard_EXPORT void Print (const Handle(Message_Messenger)& S, const Standard_Integer level, const Standard_Integer final = 1) const;
Standard_EXPORT void Print (Standard_OStream& S, const Standard_Integer level, const Standard_Integer final = 1) const;
//! Prints the messages of the check to the default trace file
//! By default, according to the default standard level

View File

@@ -16,7 +16,6 @@
#include <Interface_CheckIterator.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_IntVal.hxx>
#include <Message_Messenger.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_HAsciiString.hxx>
@@ -501,7 +500,7 @@ Standard_Integer Interface_CheckIterator::Number () const
//purpose :
//=======================================================================
void Interface_CheckIterator::Print(const Handle(Message_Messenger)& S,
void Interface_CheckIterator::Print(Standard_OStream& S,
const Standard_Boolean failsonly,
const Standard_Integer final) const
{
@@ -514,7 +513,7 @@ void Interface_CheckIterator::Print(const Handle(Message_Messenger)& S,
//purpose :
//=======================================================================
void Interface_CheckIterator::Print(const Handle(Message_Messenger)& S,
void Interface_CheckIterator::Print(Standard_OStream& S,
const Handle(Interface_InterfaceModel)& model,
const Standard_Boolean failsonly,
const Standard_Integer /*final*/) const
@@ -540,22 +539,22 @@ void Interface_CheckIterator::Print(const Handle(Message_Messenger)& S,
// mesnum = mesnum0;
// if (yamod) mesnum = (nm0 > 0 ? mesnum1 : mesnum2);
if (!titre) S<<" ** " << Name() << " **"<<Message_EndLine;
if (!titre) S <<" ** " << Name() << " **"<<std::endl;
titre = Standard_True;
S<<"Check:"; if(nb > 9 && i < 10) S<<" "; if (nb > 99 && i < 100) S<<" ";
S<<i;
if (num < 0) S<<" -- Global Check"<<Message_EndLine;
else if (num == 0) S<<" -- Entity n0 ??:";
S <<"Check:"; if(nb > 9 && i < 10) S <<" "; if (nb > 99 && i < 100) S <<" ";
S <<i;
if (num < 0) S <<" -- Global Check"<<std::endl;
else if (num == 0) S <<" -- Entity n0 ??:";
else {
if (yamod) { S<<" -- Entity (n0:id) "; model->Print (ent,S); }
else S<<" -- Entity n0 "<<num;
if (yamod) { S <<" -- Entity (n0:id) "; model->Print (ent, S); }
else S <<" -- Entity n0 "<<num;
// S<<" -- Entity n0 "<<num<<mesnum;
// if (yamod) model->PrintLabel(ent,S);
}
if (num >= 0 && entnul) S<<" (unknown Type)"<<Message_EndLine;
if (num >= 0 && entnul) S <<" (unknown Type)"<<std::endl;
else if (num >= 0 && !entnul) {
if (yamod) S<<" Type:"<<model->TypeName(ent)<<Message_EndLine;
else S<<" Type:"<<ent->DynamicType()->Name()<<Message_EndLine;
if (yamod) S <<" Type:"<<model->TypeName(ent)<<std::endl;
else S <<" Type:"<<ent->DynamicType()->Name()<<std::endl;
}
nbch ++;

View File

@@ -34,7 +34,6 @@ class Interface_IntVal;
class Standard_NoSuchObject;
class Interface_Check;
class Standard_Transient;
class Message_Messenger;
// resolve name collisions with X11 headers
#ifdef Status
@@ -181,12 +180,12 @@ public:
//! If <final> > 0, prints only final messages
//! It uses the recorded Model if it is defined
//! Remark : Works apart from the iteration methods (no interference)
Standard_EXPORT void Print (const Handle(Message_Messenger)& S, const Standard_Boolean failsonly, const Standard_Integer final = 0) const;
Standard_EXPORT void Print (Standard_OStream& S, const Standard_Boolean failsonly, const Standard_Integer final = 0) const;
//! Works as Print without a model, but for entities which have
//! no attached number (Number not positive), tries to compute
//! this Number from <model> and displays "original" or "computed"
Standard_EXPORT void Print (const Handle(Message_Messenger)& S, const Handle(Interface_InterfaceModel)& model, const Standard_Boolean failsonly, const Standard_Integer final = 0) const;
Standard_EXPORT void Print (Standard_OStream& S, const Handle(Interface_InterfaceModel)& model, const Standard_Boolean failsonly, const Standard_Integer final = 0) const;
//! Clears data of iteration
Standard_EXPORT void Destroy();

View File

@@ -26,7 +26,6 @@
#include <Interface_Protocol.hxx>
#include <Interface_ReportEntity.hxx>
#include <Interface_ShareTool.hxx>
#include <Message_Messenger.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Transient.hxx>
@@ -155,18 +154,18 @@ void Interface_CheckTool::FillCheck(const Handle(Standard_Transient)& ent,
//=======================================================================
void Interface_CheckTool::Print(const Handle(Interface_Check)& ach,
const Handle(Message_Messenger)& S) const
Standard_OStream& S) const
{
Standard_Integer i, nb;
nb = ach->NbFails();
if (nb > 0) S << " Fail Messages : " << nb << " :\n";
for (i = 1; i <= nb; i ++) {
S << ach->Fail(i) << "\n";
S << ach->Fail(i)->String() << "\n";
}
nb = ach->NbWarnings();
if (nb > 0) S << " Warning Messages : " << nb << " :\n";
for (i = 1; i <= nb; i ++) {
S << ach->Warning(i) << "\n";
S << ach->Warning(i)->String() << "\n";
}
}
@@ -177,7 +176,7 @@ void Interface_CheckTool::Print(const Handle(Interface_Check)& ach,
//=======================================================================
void Interface_CheckTool::Print(const Interface_CheckIterator& list,
const Handle(Message_Messenger)& S) const
Standard_OStream& S) const
{
Handle(Interface_InterfaceModel) model = theshare.Model();
list.Print(S,model,Standard_False);

View File

@@ -33,7 +33,6 @@ class Interface_HGraph;
class Standard_Transient;
class Interface_ShareTool;
class Interface_Check;
class Message_Messenger;
class Interface_CheckIterator;
class Interface_EntityIterator;
@@ -71,12 +70,12 @@ public:
Standard_EXPORT void FillCheck (const Handle(Standard_Transient)& ent, const Interface_ShareTool& sh, Handle(Interface_Check)& ach);
//! Utility method which Prints the content of a Check
Standard_EXPORT void Print (const Handle(Interface_Check)& ach, const Handle(Message_Messenger)& S) const;
Standard_EXPORT void Print (const Handle(Interface_Check)& ach, Standard_OStream& S) const;
//! Simply Lists all the Checks and the Content (messages) and the
//! Entity, if there is, of each Check
//! (if all Checks are OK, nothing is Printed)
Standard_EXPORT void Print (const Interface_CheckIterator& list, const Handle(Message_Messenger)& S) const;
Standard_EXPORT void Print (const Interface_CheckIterator& list, Standard_OStream& S) const;
//! Returns the Check associated to an Entity identified by
//! its Number in a Model.

View File

@@ -575,7 +575,10 @@ Handle(Standard_Transient) Interface_FileReaderTool::LoadedEntity
thereports->SetValue(irep,rep);
if ( thetrace >= 2 && !Messenger().IsNull())
ach->Print (Messenger(),2);
{
Message_Messenger::StreamBuffer sout = Messenger()->SendInfo();
ach->Print (sout,2);
}
}
// Rechargement ? si oui, dans une UnknownEntity fournie par le protocole

View File

@@ -27,7 +27,6 @@
#include <Interface_Protocol.hxx>
#include <Interface_ReportEntity.hxx>
#include <Interface_SignType.hxx>
#include <Message_Messenger.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Transient.hxx>
@@ -916,18 +915,18 @@ void Interface_InterfaceModel::VerifyCheck (Handle(Interface_Check)& /*ach*/) co
//=======================================================================
void Interface_InterfaceModel::Print(const Handle(Standard_Transient)& ent,
const Handle(Message_Messenger)& S,
Standard_OStream& S,
const Standard_Integer mode) const
{
if (ent.IsNull()) { S<<"NULL"; return; }
if (ent.IsNull()) { S << "NULL" ; return; }
Standard_Integer num = Number(ent);
if (mode <= 0) S<<num;
if (mode == 0) S<<":";
if (mode <= 0) S <<num;
if (mode == 0) S <<":";
if (mode >= 0) {
if (num > 0)
PrintToLog(ent,S);
// PrintLabel (ent,S);
else S<<"??";
else S <<"??";
}
}
@@ -938,7 +937,7 @@ void Interface_InterfaceModel::Print(const Handle(Standard_Transient)& ent,
//=======================================================================
void Interface_InterfaceModel::PrintToLog(const Handle(Standard_Transient)& ent,
const Handle(Message_Messenger)& S) const
Standard_OStream& S) const
{
PrintLabel (ent,S);
}

View File

@@ -40,7 +40,6 @@ class Interface_ReportEntity;
class Interface_CheckIterator;
class Interface_GeneralLib;
class Interface_EntityIterator;
class Message_Messenger;
class Interface_InterfaceModel;
@@ -345,7 +344,7 @@ public:
//! Dumps Header in a short, easy to read, form, onto a Stream
//! <level> allows to print more or less parts of the header,
//! if necessary. 0 for basic print
Standard_EXPORT virtual void DumpHeader (const Handle(Message_Messenger)& S, const Standard_Integer level = 0) const = 0;
Standard_EXPORT virtual void DumpHeader (Standard_OStream& S, const Standard_Integer level = 0) const = 0;
//! Prints identification of a given entity in <me>, in order to
//! be printed in a list or phrase
@@ -354,17 +353,17 @@ public:
//! <mode> = 0 (D) : prints its number plus '/' plus PrintLabel
//! If <ent> == <me>, simply prints "Global"
//! If <ent> is unknown, prints "??/its type"
Standard_EXPORT void Print (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& s, const Standard_Integer mode = 0) const;
Standard_EXPORT void Print (const Handle(Standard_Transient)& ent, Standard_OStream& s, const Standard_Integer mode = 0) const;
//! Prints label specific to each norm, for a given entity.
//! Must only print label itself, in order to be included in a
//! phrase. Can call the result of StringLabel, but not obliged.
Standard_EXPORT virtual void PrintLabel (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const = 0;
Standard_EXPORT virtual void PrintLabel (const Handle(Standard_Transient)& ent, Standard_OStream& S) const = 0;
//! Prints label specific to each norm in log format, for
//! a given entity.
//! By default, just calls PrintLabel, can be redefined
Standard_EXPORT virtual void PrintToLog (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const;
Standard_EXPORT virtual void PrintToLog (const Handle(Standard_Transient)& ent, Standard_OStream& S) const;
//! Returns a string with the label attached to a given entity.
//! Warning : While this string may be edited on the spot, if it is a read

View File

@@ -203,13 +203,13 @@ Interface_ShareTool::Interface_ShareTool (const Handle(Interface_HGraph)& ahgrap
return list;
}
void Interface_ShareTool::Print
(const Interface_EntityIterator& iter, const Handle(Message_Messenger)& S) const
void Interface_ShareTool::Print (const Interface_EntityIterator& iter, Standard_OStream& S) const
{
S << " Nb.Entities : " << iter.NbEntities() << " : ";
for (iter.Start(); iter.More(); iter.Next()) {
Handle(Standard_Transient) ent = iter.Value();
S << " n0/id:"; Model()->Print(ent,S);
S << " n0/id:";
Model()->Print (ent, S);
}
S<<Message_EndLine;
S <<std::endl;
}

View File

@@ -17,13 +17,8 @@
#ifndef _Interface_ShareTool_HeaderFile
#define _Interface_ShareTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Type.hxx>
class Interface_HGraph;
class Standard_DomainError;
class Interface_InterfaceError;
@@ -33,9 +28,6 @@ class Interface_GTool;
class Interface_Protocol;
class Interface_Graph;
class Interface_EntityIterator;
class Standard_Transient;
class Message_Messenger;
//! Builds the Graph of Dependancies, from the General Service
//! "Shared" -> builds for each Entity of a Model, the Shared and
@@ -113,7 +105,7 @@ public:
//! Utility method which Prints the content of an iterator
//! (by their Numbers)
Standard_EXPORT void Print (const Interface_EntityIterator& iter, const Handle(Message_Messenger)& S) const;
Standard_EXPORT void Print (const Interface_EntityIterator& iter,Standard_OStream& S) const;

View File

@@ -11,10 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Static.hxx>
#include <Interface_InterfaceError.hxx>
#include <Interface_Static.hxx>
#include <Message_Messenger.hxx>
#include <OSD_Path.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
@@ -84,15 +83,15 @@ static char defmess[31];
// ## Print ##
void Interface_Static::PrintStatic (const Handle(Message_Messenger)& S) const
void Interface_Static::PrintStatic (Standard_OStream& S) const
{
S<<"--- Static Value : "<<Name()<<" Family:"<<Family();
S <<"--- Static Value : "<<Name()<<" Family:"<<Family();
Print (S);
if (!thewild.IsNull())
S<<" -- Attached to wild-card : "<<thewild->Name()<<Message_EndLine;
S<<"--- Actual status : "<<(theupdate ? "" : "original")<<" Value : ";
S <<" -- Attached to wild-card : "<<thewild->Name()<<std::endl;
S <<"--- Actual status : "<<(theupdate ? "" : "original")<<" Value : ";
if (thesatisf) S<<" -- Specific Function for Satisfies : "<<thesatisn.ToCString()<<Message_EndLine;
if (thesatisf) S <<" -- Specific Function for Satisfies : "<<thesatisn.ToCString()<<std::endl;
}

View File

@@ -35,8 +35,6 @@
class TCollection_HAsciiString;
class Standard_Transient;
class Interface_InterfaceError;
class Message_Messenger;
class Interface_Static;
DEFINE_STANDARD_HANDLE(Interface_Static, Interface_TypedValue)
@@ -95,7 +93,7 @@ public:
//! - Current status (empty string if it was updated or
//! if it is the original one)
//! - Value
Standard_EXPORT void PrintStatic (const Handle(Message_Messenger)& S) const;
Standard_EXPORT void PrintStatic (Standard_OStream& S) const;
//! Returns the family. It can be : a resource name for applis,
//! an internal name between : $e (environment variables),