1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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

@@ -45,7 +45,7 @@ StepData_StepWriter& StepData_StepDumper::StepWriter ()
Standard_Boolean StepData_StepDumper::Dump
(const Handle(Message_Messenger)& S, const Handle(Standard_Transient)& ent,
(Standard_OStream& S, const Handle(Standard_Transient)& ent,
const Standard_Integer level)
{
Standard_Integer i, nb = themodel->NbEntities();
@@ -64,18 +64,18 @@ Standard_Boolean StepData_StepDumper::Dump
TColStd_SequenceOfAsciiString listypes;
if (!module->ComplexType(CN,listypes))
S << "(Complex Type : ask level > 0) cdl = "
<< ent->DynamicType()->Name() << " (...);" << Message_EndLine;
<< ent->DynamicType()->Name() << " (...);" << std::endl;
else {
Standard_Integer n = listypes.Length();
for (i = 1; i <= n; i ++) S << listypes.Value(i) << " (...)";
S << Message_EndLine;
S << std::endl;
}
}
else S << module->StepType(CN) << " (...);" << Message_EndLine;
else S << module->StepType(CN) << " (...);" << std::endl;
}
else S << "(Unrecognized Type for protocol) cdl = "
<< ent->DynamicType()->Name() << " (...);" << Message_EndLine;
if (nlab > 0) S << "/* Ident in file for "<<num<<" : #"<<nlab<<" */"<<Message_EndLine;
<< ent->DynamicType()->Name() << " (...);" << std::endl;
if (nlab > 0) S << "/* Ident in file for "<<num<<" : #"<<nlab<<" */"<<std::endl;
}
else if (level == 1) {
@@ -98,7 +98,7 @@ Standard_Boolean StepData_StepDumper::Dump
}
else {
Handle(Standard_Transient) anent;
// S << " -- Dumping Entity n0 " << num << " --" << std::endl;
// S<< " -- Dumping Entity n0 " << num << " --" << std::endl;
// ... Envoi ...
TColStd_Array1OfInteger tab(0,nb); tab.Init(0);
tab.SetValue(num,1);
@@ -141,31 +141,31 @@ Standard_Boolean StepData_StepDumper::Dump
else if (nlab > 0) nbi ++;
}
if (nbe > 0) {
// S <<" -- Displayed nums:"<<nbe<<" with ident=num:"<<nbq<<" , distinct proper ident:"<<nbi<<"\n";
// S<<" -- Displayed nums:"<<nbe<<" with ident=num:"<<nbq<<" , distinct proper ident:"<<nbi<<"\n";
if (nbu > 0) {
S<<" (no ident): ";
S <<" (no ident): ";
for (i = 1; i <= nb; i ++)
{ if (ids.Value(i) >= 0) continue; S<<" #"<<i; }
S<<Message_EndLine;
{ if (ids.Value(i) >= 0) continue; S <<" #"<<i; }
S <<std::endl;
}
if (nbq > 0) {
S<<" (ident = num): ";
for (i = 1; i <= nb; i ++) { if (ids.Value(i) == i) S<<" #"<<i; }
S<<Message_EndLine;
S <<" (ident = num): ";
for (i = 1; i <= nb; i ++) { if (ids.Value(i) == i) S <<" #"<<i; }
S <<std::endl;
}
if (nbi < 0) { // on n affiche plus num:#id , on envoie un petit help
Standard_Integer nbl = 0, nbr = 0, nbr0 = 0, nbc = 0;
char unid[30];
// S<<" (proper ident): #num #ident"<<std::endl;
S<<" (proper ident): num:#ident num:#ident ..."<<Message_EndLine;
// S <<" (proper ident): #num #ident"<<std::endl;
S <<" (proper ident): num:#ident num:#ident ..."<<std::endl;
for (i = 1; i <= nb; i ++) {
if (ids.Value(i) <= 0 || ids.Value(i) == i) continue;
sprintf (unid,"%d:#%d",i,ids.Value(i));
nbc = (Standard_Integer) strlen (unid); nbr = ((80-nbc) %4) +2;
nbl += nbc;
if (nbl+nbr0 > 79) { nbl = nbc; S<<Message_EndLine; }
if (nbl+nbr0 > 79) { nbl = nbc; S <<std::endl; }
else { nbl += nbr0; for (; nbr0 > 0; nbr0 --) S << " "; }
S<<unid;
S <<unid;
nbr0 = nbr;
// if (nbl+nbc > 79) { S<<std::endl<<unid; nbl = 0; }
@@ -175,23 +175,21 @@ Standard_Boolean StepData_StepDumper::Dump
// S<<" "<<i<<" ->#"<<ids.Value(i);
// nbl ++; if (nbl > 5) { nbl = nbr = 0; S<<std::endl; }
}
if (nbl > 0) S<<Message_EndLine;
if (nbl > 0) S <<std::endl;
}
if (nbi > 0) S<<"In dump, iii:#jjj means : entity rank iii has step ident #jjj"<<Message_EndLine;
// S <<" -- Dumping data, entity "<<num<<" level "<<level<<" :"<<std::endl;
if (nbi > 0) S <<"In dump, iii:#jjj means : entity rank iii has step ident #jjj"<<std::endl;
// S<<" -- Dumping data, entity "<<num<<" level "<<level<<" :"<<std::endl;
}
if (level > 0)
{
Standard_SStream aStream;
thewriter.Print(aStream);
S << aStream;
thewriter.Print (S);
}
return Standard_True;
}
Standard_Boolean StepData_StepDumper::Dump
(const Handle(Message_Messenger)& S, const Standard_Integer num,
(Standard_OStream& S, const Standard_Integer num,
const Standard_Integer level)
{
if (num <= 0 || num > themodel->NbEntities()) return Standard_False;

View File

@@ -30,9 +30,6 @@ class StepData_StepModel;
class Interface_InterfaceMismatch;
class StepData_Protocol;
class StepData_StepWriter;
class Message_Messenger;
class Standard_Transient;
//! Provides a way to dump entities processed through STEP, with
//! these features :
@@ -79,12 +76,12 @@ public:
//!
//! For levels 1,2,3, the numbers displayed (form #nnn) are the
//! numbers of the corresponding entities in the Model
Standard_EXPORT Standard_Boolean Dump (const Handle(Message_Messenger)& S, const Handle(Standard_Transient)& ent, const Standard_Integer level);
Standard_EXPORT Standard_Boolean Dump (Standard_OStream& S, const Handle(Standard_Transient)& ent, const Standard_Integer level);
//! Works as Dump with a Transient, but directly takes the
//! entity designated by its number in the Model
//! Returns False, also if <num> is out of range
Standard_EXPORT Standard_Boolean Dump (const Handle(Message_Messenger)& S, const Standard_Integer num, const Standard_Integer level);
Standard_EXPORT Standard_Boolean Dump (Standard_OStream& S, const Standard_Integer num, const Standard_Integer level);

View File

@@ -20,7 +20,6 @@
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_ShareTool.hxx>
#include <Message_Messenger.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
@@ -103,14 +102,13 @@ void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
}
void StepData_StepModel::DumpHeader
(const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const
void StepData_StepModel::DumpHeader (Standard_OStream& S, const Standard_Integer /*level*/) const
{
// NB : level n est pas utilise
Handle(StepData_Protocol) stepro = StepData::HeaderProtocol();
Standard_Boolean iapro = !stepro.IsNull();
if (!iapro) S<<" -- WARNING : StepModel DumpHeader, Protocol not defined\n";
if (!iapro) S <<" -- WARNING : StepModel DumpHeader, Protocol not defined\n";
Interface_EntityIterator iter = Header();
Standard_Integer nb = iter.NbEntities();
@@ -119,16 +117,14 @@ void StepData_StepModel::DumpHeader
S << " " << iter.Value()->DynamicType()->Name() << "\n";
}
if (!iapro || nb == 0) return;
S << " -- -- STEP MODEL HEADER CONTENT -- --" << Message_EndLine;
S << " -- -- STEP MODEL HEADER CONTENT -- --" << "\n";
S << " -- Dumped with Protocol : " << stepro->DynamicType()->Name()
<< " --"<<Message_EndLine;
<< " --\n";
Standard_SStream aSStream;
Handle(StepData_StepModel) me (this);
StepData_StepWriter SW(me);
SW.SendModel(stepro,Standard_True); // envoi HEADER seul
SW.Print(aSStream);
S << aSStream.str().c_str();
SW.Print(S);
}
@@ -171,13 +167,13 @@ Standard_Integer StepData_StepModel::IdentLabel
}
void StepData_StepModel::PrintLabel
(const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const
(const Handle(Standard_Transient)& ent, Standard_OStream& S) const
{
Standard_Integer num = (theidnums.IsNull() ? 0 : Number(ent));
Standard_Integer nid = (!num ? 0 : theidnums->Value(num));
if (nid > 0) S<<"#"<<nid;
else if (num > 0) S<<"(#"<<num<<")";
else S<<"(#0..)";
if (nid > 0) S <<"#"<<nid;
else if (num > 0) S <<"(#"<<num<<")";
else S <<"(#0..)";
}
Handle(TCollection_HAsciiString) StepData_StepModel::StringLabel

View File

@@ -17,24 +17,17 @@
#ifndef _StepData_StepModel_HeaderFile
#define _StepData_StepModel_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Interface_EntityList.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
class Standard_NoSuchObject;
class Standard_Transient;
class Interface_InterfaceModel;
class Interface_EntityIterator;
class Interface_Check;
class Message_Messenger;
class TCollection_HAsciiString;
class StepData_StepModel;
DEFINE_STANDARD_HANDLE(StepData_StepModel, Interface_InterfaceModel)
@@ -83,7 +76,7 @@ public:
//! prints its Type. Else sends the Header under the form of
//! HEADER Section of an Ascii Step File
//! <level> is not used because Header is not so big
Standard_EXPORT void DumpHeader (const Handle(Message_Messenger)& S, const Standard_Integer level = 0) const Standard_OVERRIDE;
Standard_EXPORT void DumpHeader (Standard_OStream& S, const Standard_Integer level = 0) const Standard_OVERRIDE;
//! erases specific labels, i.e. clears the map (entity-ident)
Standard_EXPORT void ClearLabels() Standard_OVERRIDE;
@@ -98,7 +91,7 @@ public:
//! Prints label specific to STEP norm for a given entity, i.e.
//! if a LabelIdent has been recorded, its value with '#', else
//! the number in the model with '#' and between ()
Standard_EXPORT void PrintLabel (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S) const Standard_OVERRIDE;
Standard_EXPORT void PrintLabel (const Handle(Standard_Transient)& ent, Standard_OStream& S) const Standard_OVERRIDE;
//! Returns a string with the label attached to a given entity,
//! same form as for PrintLabel

View File

@@ -187,11 +187,11 @@ void StepData_StepReaderData::SetRecord(const Standard_Integer num,
while (theidents(prev) <= 0) {
prev--; if (prev <= 0) break;
}
Handle(Message_Messenger) sout = Message::DefaultMessenger();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
sout << " *** Error on Record " << num << " (on " << NbRecords()
<< " -> " << num * 100 / NbRecords() << " % in File) ***";
if (prev > 0) sout << " Ident #" << theidents(prev);
sout << "\n" << errm << Message_EndLine;
sout << "\n" << errm << std::endl;
#endif
thecheck->AddWarning(errm.ToCString(), "Complex Type incorrect : ");
}
@@ -1526,7 +1526,7 @@ Standard_Integer StepData_StepReaderData::FindEntityNumber(const Standard_Intege
void StepData_StepReaderData::SetEntityNumbers(const Standard_Boolean withmap)
{
Handle(Message_Messenger) sout = Message::DefaultMessenger();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
// Passe initiale : Resolution directe par Map
// si tout passe (pas de collision), OK. Sinon, autres passes a prevoir
// On resoud du meme coup les sous-listes
@@ -1571,7 +1571,7 @@ void StepData_StepReaderData::SetEntityNumbers(const Standard_Boolean withmap)
if (letype == Interface_ParamSub) {
Standard_Integer numsub = FP.EntityNumber();
if (numsub > thelastn) {
sout << "Bad Sub.N0, Record " << num << " Param " << na << ":$" << numsub << Message_EndLine;
sout << "Bad Sub.N0, Record " << num << " Param " << na << ":$" << numsub << std::endl;
continue;
}
FP.SetEntityNumber(subn(numsub));
@@ -1596,7 +1596,7 @@ void StepData_StepReaderData::SetEntityNumbers(const Standard_Boolean withmap)
// ... Et sortir message un peu plus complet
sout << "*** ERR StepReaderData *** Pour Entite #" << ident
<< "\n Type:" << RecordType(num)
<< " Param.n0 " << na << ": #" << id << " Non trouve" << Message_EndLine;
<< " Param.n0 " << na << ": #" << id << " Non trouve" << std::endl;
} // FIN Mapping
} // FIN Traitement Reference
} // FIN Boucle Parametres
@@ -1663,7 +1663,7 @@ void StepData_StepReaderData::SetEntityNumbers(const Standard_Boolean withmap)
char ligne[80];
sprintf(ligne, "Ident defined SEVERAL TIMES : #%d", ident);
thecheck->AddFail(ligne, "Ident defined SEVERAL TIMES : #%d");
sout << "StepReaderData:SetEntityNumbers, " << ligne << Message_EndLine;
sout << "StepReaderData:SetEntityNumbers, " << ligne << std::endl;
}
if (indm(indmap) > 0) indm(indmap) = -indm(indmap); // Pas pour Map
// Cas Normal pour la Map
@@ -1856,7 +1856,7 @@ void StepData_StepReaderData::SetEntityNumbers(const Standard_Boolean withmap)
sout << "*** ERR StepReaderData *** Pour Entite " << nument
<< ", a " << (nr * 100) / nbseq << "% de DATA : #" << ident
<< "\n Type:" << RecordType(num)
<< " Param.n0 " << na << ": #" << id << " Non trouve" << Message_EndLine;
<< " Param.n0 " << na << ": #" << id << " Non trouve" << std::endl;
FP.SetEntityNumber(0); // -> Reference non resolue
}
}

View File

@@ -98,7 +98,7 @@ void StepData_StepReaderTool::Prepare (const Standard_Boolean optim)
SetEntities();
}
catch(Standard_Failure const& anException) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
sout << " Exception Raised during Preparation :\n";
sout << anException.GetMessageString();
sout << "\n Now, trying to continue, but with presomption of failure\n";
@@ -159,7 +159,7 @@ void StepData_StepReaderTool::PrepareHeader
void StepData_StepReaderTool::BeginRead
(const Handle(Interface_InterfaceModel)& amodel)
{
Handle(Message_Messenger) sout = Message::DefaultMessenger();
Message_Messenger::StreamBuffer sout = Message::SendInfo();
DeclareAndCast(StepData_StepModel,model,amodel);
DeclareAndCast(StepData_StepReaderData,stepdat,Data());
@@ -184,7 +184,7 @@ void StepData_StepReaderTool::BeginRead
Handle(Interface_Check) mch = model->GlobalCheck();
Standard_Integer nbmess = ach->NbWarnings();
sout<<nbmess<<" Warnings on Reading Header Entity N0."<<i<<":";
if (!ent.IsNull()) sout << ent->DynamicType()->Name() << Message_EndLine;
if (!ent.IsNull()) sout << ent->DynamicType()->Name() << std::endl;
for (Standard_Integer nf = 1; nf <= nbmess; nf ++)
sout << ach->CWarning(nf) << "\n";
}
@@ -192,7 +192,7 @@ void StepData_StepReaderTool::BeginRead
Handle(Interface_Check) mch = model->GlobalCheck();
Standard_Integer nbmess = ach->NbFails();
sout << " Errors on Reading Header Entity N0."<<i<<":";
if (!ent.IsNull()) sout << ent->DynamicType()->Name() << Message_EndLine;
if (!ent.IsNull()) sout << ent->DynamicType()->Name() << std::endl;
for (Standard_Integer nf = 1; nf <= nbmess; nf ++)
sout << ach->CFail(nf) << "\n";
}