mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
"endl" manipulator for Message_Messenger is renamed to "Message_EndLine". The following entities from std namespace are now used with std:: explicitly specified (from Standard_Stream.hxx): std::istream,std::ostream,std::ofstream,std::ifstream,std::fstream, std::filebuf,std::streambuf,std::streampos,std::ios,std::cout,std::cerr, std::cin,std::endl,std::ends,std::flush,std::setw,std::setprecision, std::hex,std::dec.
This commit is contained in:
@@ -61,7 +61,7 @@ Standard_Boolean DDF::FindLabel (const Handle(TDF_Data)& DF,
|
||||
{
|
||||
Label.Nullify();
|
||||
TDF_Tool::Label(DF,Entry,Label,Standard_False);
|
||||
if (Label.IsNull() && Complain) cout << "No label for entry " << Entry <<endl;
|
||||
if (Label.IsNull() && Complain) std::cout << "No label for entry " << Entry <<std::endl;
|
||||
return !Label.IsNull();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ Standard_Boolean DDF::GetDF (Standard_CString& Name,
|
||||
DF = DDF->DataFramework();
|
||||
return Standard_True;
|
||||
}
|
||||
if (Complain) cout <<"framework "<<Name<<" not found "<< endl;
|
||||
if (Complain) std::cout <<"framework "<<Name<<" not found "<< std::endl;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ Standard_Boolean DDF::Find (const Handle(TDF_Data)& DF,
|
||||
TDF_Label L;
|
||||
if (FindLabel(DF,Entry,L,Complain)) {
|
||||
if (L.FindAttribute(ID,A)) return Standard_True;
|
||||
if (Complain) cout <<"attribute not found for entry : "<< Entry <<endl;
|
||||
if (Complain) std::cout <<"attribute not found for entry : "<< Entry <<std::endl;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -179,49 +179,49 @@ static Standard_Integer DDF_ForgetAttribute(Draw_Interpretor& di,
|
||||
|
||||
void ErrorMessage (const Storage_Error n)
|
||||
{
|
||||
cout << "Storage Error: " << flush;
|
||||
std::cout << "Storage Error: " << std::flush;
|
||||
|
||||
switch (n) {
|
||||
case Storage_VSOk:
|
||||
cout << "no problem" << endl;
|
||||
std::cout << "no problem" << std::endl;
|
||||
break;
|
||||
case Storage_VSOpenError:
|
||||
cout << "while opening the stream" << endl;
|
||||
std::cout << "while opening the stream" << std::endl;
|
||||
break;
|
||||
case Storage_VSModeError:
|
||||
cout << "the stream is opened with a wrong mode for operation " << endl;
|
||||
std::cout << "the stream is opened with a wrong mode for operation " << std::endl;
|
||||
break;
|
||||
case Storage_VSCloseError:
|
||||
cout << "while closing the stream" << endl;
|
||||
std::cout << "while closing the stream" << std::endl;
|
||||
break;
|
||||
case Storage_VSAlreadyOpen:
|
||||
cout << "stream is already opened" << endl;
|
||||
std::cout << "stream is already opened" << std::endl;
|
||||
break;
|
||||
case Storage_VSNotOpen:
|
||||
cout << "stream not opened" << endl;
|
||||
std::cout << "stream not opened" << std::endl;
|
||||
break;
|
||||
case Storage_VSSectionNotFound:
|
||||
cout << "the section is not found" << endl;
|
||||
std::cout << "the section is not found" << std::endl;
|
||||
break;
|
||||
case Storage_VSWriteError:
|
||||
cout << "error during writing" << endl;
|
||||
std::cout << "error during writing" << std::endl;
|
||||
break;
|
||||
case Storage_VSFormatError:
|
||||
cout << "wrong format error occured while reading" << endl;
|
||||
std::cout << "wrong format error occured while reading" << std::endl;
|
||||
break;
|
||||
case Storage_VSUnknownType:
|
||||
cout << "try to read an unknown type" << endl;
|
||||
std::cout << "try to read an unknown type" << std::endl;
|
||||
break;
|
||||
case Storage_VSTypeMismatch:
|
||||
cout << "try to read a wrong primitive type (read a char while expecting a real)" << endl;
|
||||
std::cout << "try to read a wrong primitive type (read a char while expecting a real)" << std::endl;
|
||||
break;
|
||||
case Storage_VSInternalError:
|
||||
cout << "internal error" << endl;
|
||||
std::cout << "internal error" << std::endl;
|
||||
break;
|
||||
case Storage_VSExtCharParityError: cout << "parity error" << endl;
|
||||
case Storage_VSExtCharParityError: std::cout << "parity error" << std::endl;
|
||||
break;
|
||||
default:
|
||||
cout << "unknown error code" << endl;
|
||||
std::cout << "unknown error code" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ DDF_Browser::DDF_Browser(const Handle(TDF_Data)& aDF)
|
||||
|
||||
void DDF_Browser::DrawOn(Draw_Display& /*dis*/) const
|
||||
{
|
||||
//cout<<"DDF_Browser"<<endl;
|
||||
//std::cout<<"DDF_Browser"<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Handle(Draw_Drawable3D) DDF_Browser::Copy() const
|
||||
|
||||
void DDF_Browser::Dump(Standard_OStream& S) const
|
||||
{
|
||||
S<<"DDF_Browser on a DF:"<<endl;
|
||||
S<<"DDF_Browser on a DF:"<<std::endl;
|
||||
S<<myDF;
|
||||
}
|
||||
|
||||
|
@@ -50,14 +50,14 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di,
|
||||
{
|
||||
if (n<2)
|
||||
{
|
||||
cout << "Use: " << a[0] << " document [brower_name]" << endl;
|
||||
std::cout << "Use: " << a[0] << " document [brower_name]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(TDF_Data) DF;
|
||||
if (!DDF::GetDF (a[1], DF))
|
||||
{
|
||||
cout << "Error: document " << a[1] << " is not found" << endl;
|
||||
std::cout << "Error: document " << a[1] << " is not found" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -72,14 +72,14 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di,
|
||||
OSD_File aTclScriptFile (aTclScript);
|
||||
if (aTclScriptFile.Exists()) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout << "Load " << aTclScript << endl;
|
||||
std::cout << "Load " << aTclScript << std::endl;
|
||||
#endif
|
||||
di.EvalFile( aTclScript.ToCString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Error: Could not load script " << aTclScript << endl;
|
||||
cout << "Check environment variable CSF_DrawPluginDefaults" << endl;
|
||||
std::cout << "Error: Could not load script " << aTclScript << std::endl;
|
||||
std::cout << "Check environment variable CSF_DrawPluginDefaults" << std::endl;
|
||||
}
|
||||
|
||||
// Call command dftree defined in dftree.tcl
|
||||
|
@@ -50,7 +50,7 @@ DDF_Data::DDF_Data(const Handle(TDF_Data)& aDF) : myDF (aDF) {}
|
||||
|
||||
void DDF_Data::DrawOn(Draw_Display& /*dis*/) const
|
||||
|
||||
{ cout<<"DDF_Data"<<endl; }
|
||||
{ std::cout<<"DDF_Data"<<std::endl; }
|
||||
|
||||
|
||||
|
||||
|
@@ -195,10 +195,10 @@ static Standard_Integer MiniDumpDF (Draw_Interpretor& di,
|
||||
|
||||
di<<"*********** Dump of "<<a[1]<<" ***********\n";
|
||||
|
||||
//DDF->DataFramework()->Dump(cout);
|
||||
//DDF->DataFramework()->Dump(std::cout);
|
||||
Standard_SStream aSStream;
|
||||
DDF->DataFramework()->Dump(aSStream);
|
||||
aSStream << ends;
|
||||
aSStream << std::ends;
|
||||
di << aSStream << "\n";
|
||||
|
||||
return 0;
|
||||
@@ -237,7 +237,7 @@ static Standard_Integer XDumpDF (Draw_Interpretor& di,
|
||||
//TDF_Tool::ExtendedDeepDump(cout,DDF->DataFramework(),filter);
|
||||
Standard_SStream aSStream;
|
||||
TDF_Tool::ExtendedDeepDump(aSStream,DDF->DataFramework(),filter);
|
||||
aSStream << ends;
|
||||
aSStream << std::ends;
|
||||
di << aSStream <<"\n";
|
||||
|
||||
return 0;
|
||||
@@ -293,30 +293,30 @@ static Standard_Integer DDF_CheckAttrs (Draw_Interpretor& di,Standard_Integer n
|
||||
Standard_Boolean Shar = Standard_False;
|
||||
for (TDF_AttributeIterator itr(SOURCE); itr.More(); itr.Next()) {
|
||||
itr.Value()->References(ds1);
|
||||
// cout<<"\tSource Attribute dynamic type = "<<itr.Value()->DynamicType()<<endl;
|
||||
// std::cout<<"\tSource Attribute dynamic type = "<<itr.Value()->DynamicType()<<std::endl;
|
||||
const TDF_AttributeMap& attMap = ds1->Attributes(); //attMap
|
||||
for (TDF_MapIteratorOfAttributeMap attMItr(attMap);attMItr.More(); attMItr.Next()) {
|
||||
Handle(TDF_Attribute) sAtt = attMItr.Key();
|
||||
// cout<<"\t\tSource references attribute dynamic type = "<<sAtt->DynamicType()<<endl;
|
||||
// std::cout<<"\t\tSource references attribute dynamic type = "<<sAtt->DynamicType()<<std::endl;
|
||||
for (TDF_AttributeIterator itr2(TARGET); itr2.More(); itr2.Next()) {
|
||||
itr2.Value()->References(ds2);
|
||||
// cout<<"\t\t\tTARGET attribute dynamic type = "<<itr2.Value()->DynamicType()<<endl;
|
||||
// std::cout<<"\t\t\tTARGET attribute dynamic type = "<<itr2.Value()->DynamicType()<<std::endl;
|
||||
const TDF_AttributeMap& attMap2 = ds2->Attributes(); //attMap
|
||||
for (TDF_MapIteratorOfAttributeMap attMItr2(attMap2);attMItr2.More(); attMItr2.Next()) {
|
||||
Handle(TDF_Attribute) tAtt = attMItr2.Key();
|
||||
// cout<<"\t\t\t\tTarget reference attribute dynamic type = "<<tAtt->DynamicType()<<endl;
|
||||
// std::cout<<"\t\t\t\tTarget reference attribute dynamic type = "<<tAtt->DynamicType()<<std::endl;
|
||||
if (tAtt->IsInstance(sAtt->DynamicType()))
|
||||
if(tAtt == sAtt) {
|
||||
TCollection_AsciiString entr1,entr2;
|
||||
if(!Shar) {
|
||||
TDF_Tool::Entry(SOURCE, entr1);
|
||||
TDF_Tool::Entry(TARGET, entr2);
|
||||
//cout<<"\tSHAREABLE attribute(s) found between Lab1 = "<<entr1<<" and Lab2 = "<<entr2<<endl;
|
||||
//std::cout<<"\tSHAREABLE attribute(s) found between Lab1 = "<<entr1<<" and Lab2 = "<<entr2<<std::endl;
|
||||
di<<"\tSHAREABLE attribute(s) found between Lab1 = "<<entr1.ToCString()<<" and Lab2 = "<<entr2.ToCString()<<"\n";
|
||||
Shar = Standard_True;
|
||||
}
|
||||
TDF_Tool::Entry(sAtt->Label(), entr1);
|
||||
//cout<<"\tAttribute dynamic type = "<<sAtt->DynamicType()<<",\tlocated on Label = "<<entr1<<endl;
|
||||
//std::cout<<"\tAttribute dynamic type = "<<sAtt->DynamicType()<<",\tlocated on Label = "<<entr1<<std::endl;
|
||||
di<<"\tAttribute dynamic type = " << sAtt->DynamicType()->Name();
|
||||
di<<",\tlocated on Label = "<<entr1.ToCString()<<"\n";
|
||||
}
|
||||
@@ -351,14 +351,14 @@ static Standard_Integer DDF_CheckLabel (Draw_Interpretor& di,Standard_Integer n
|
||||
Handle(TDF_DataSet) ds1 = new TDF_DataSet();
|
||||
for (TDF_AttributeIterator itr(SOURCE); itr.More(); itr.Next()) {
|
||||
itr.Value()->References(ds1);
|
||||
//cout<<"\tSource Attribute dynamic type = "<<itr.Value()->DynamicType()<<endl;
|
||||
//std::cout<<"\tSource Attribute dynamic type = "<<itr.Value()->DynamicType()<<std::endl;
|
||||
di<<"\tSource Attribute dynamic type = " << itr.Value()->DynamicType()->Name() << "\n";
|
||||
const TDF_AttributeMap& attMap = ds1->Attributes(); //attMap
|
||||
for (TDF_MapIteratorOfAttributeMap attMItr(attMap);attMItr.More(); attMItr.Next()) {
|
||||
Handle(TDF_Attribute) sAtt = attMItr.Key();
|
||||
TCollection_AsciiString entry;
|
||||
TDF_Tool::Entry(sAtt->Label(), entry);
|
||||
//cout<<"\t\tReferences attribute dynamic type = "<<sAtt->DynamicType()<<",\tLabel = "<<entry<<endl;
|
||||
//std::cout<<"\t\tReferences attribute dynamic type = "<<sAtt->DynamicType()<<",\tLabel = "<<entry<<std::endl;
|
||||
di<<"\t\tReferences attribute dynamic type = " << sAtt->DynamicType()->Name();
|
||||
di<<",\tLabel = "<<entry.ToCString()<<"\n";
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Stor
|
||||
if (OpenMode() == Storage_VSNone) {
|
||||
if (aMode == Storage_VSRead) {
|
||||
if (myIStream != NULL) delete myIStream;
|
||||
myIStream = new ifstream(aName.ToCString(),ios::in); // ios::nocreate is not portable
|
||||
myIStream = new std::ifstream(aName.ToCString(),std::ios::in); // std::ios::nocreate is not portable
|
||||
if (myIStream->fail()) {
|
||||
result = Storage_VSOpenError;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Stor
|
||||
}
|
||||
else if (aMode == Storage_VSWrite) {
|
||||
if (myOStream != NULL) delete myOStream;
|
||||
myOStream = new ofstream(aName.ToCString(),ios::out);
|
||||
myOStream = new std::ofstream(aName.ToCString(),std::ios::out);
|
||||
if (myOStream->fail()) {
|
||||
result = Storage_VSOpenError;
|
||||
}
|
||||
@@ -104,10 +104,10 @@ Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Stor
|
||||
|
||||
//=======================================================================
|
||||
//function : Open
|
||||
//purpose : "Opens" an istream.
|
||||
//purpose : "Opens" an std::istream.
|
||||
//=======================================================================
|
||||
|
||||
Storage_Error DDF_IOStream::Open(istream* anIStream)
|
||||
Storage_Error DDF_IOStream::Open(std::istream* anIStream)
|
||||
{
|
||||
myOStream = NULL;
|
||||
SetOpenMode(Storage_VSRead);
|
||||
@@ -120,10 +120,10 @@ Storage_Error DDF_IOStream::Open(istream* anIStream)
|
||||
|
||||
//=======================================================================
|
||||
//function : Open
|
||||
//purpose : "Opens" an ostream.
|
||||
//purpose : "Opens" an std::ostream.
|
||||
//=======================================================================
|
||||
|
||||
Storage_Error DDF_IOStream::Open(ostream* anOStream)
|
||||
Storage_Error DDF_IOStream::Open(std::ostream* anOStream)
|
||||
{
|
||||
myIStream = NULL;
|
||||
SetOpenMode(Storage_VSWrite);
|
||||
@@ -263,7 +263,7 @@ void DDF_IOStream::ReadExtendedLine(TCollection_ExtendedString& buffer)
|
||||
myIStream->get(c);
|
||||
check++;
|
||||
// if ((check % 2) != 0) throw Storage_StreamExtCharParityError();
|
||||
// cout << check << endl;
|
||||
// std::cout << check << std::endl;
|
||||
j = (Standard_ExtCharacter)c;
|
||||
if (c != '\n') fin = Standard_False;
|
||||
i |= (0x00FF & j);
|
||||
@@ -271,7 +271,7 @@ void DDF_IOStream::ReadExtendedLine(TCollection_ExtendedString& buffer)
|
||||
}
|
||||
|
||||
// if ((check % 2) != 0) throw Storage_StreamExtCharParityError();
|
||||
// cout << check << endl;
|
||||
// std::cout << check << std::endl;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -647,7 +647,7 @@ Storage_Error DDF_IOStream::BeginReadInfoSection()
|
||||
|
||||
if (strncmp(DDF_IOStream::MagicNumber(),l.ToCString(),len) != 0) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"BeginReadInfoSection: format error"<<endl;
|
||||
std::cout<<"BeginReadInfoSection: format error"<<std::endl;
|
||||
#endif
|
||||
s = Storage_VSFormatError;
|
||||
}
|
||||
@@ -1339,7 +1339,7 @@ Storage_Error DDF_IOStream::EndReadDataSection()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Storage_Error DDF_IOStream::IsGoodFileType(istream* anIStream)
|
||||
Storage_Error DDF_IOStream::IsGoodFileType(std::istream* anIStream)
|
||||
{
|
||||
DDF_IOStream f;
|
||||
Storage_Error s;
|
||||
@@ -1356,7 +1356,7 @@ Storage_Error DDF_IOStream::IsGoodFileType(istream* anIStream)
|
||||
|
||||
if (strncmp(DDF_IOStream::MagicNumber(),l.ToCString(),len) != 0) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"IsGoodFileType: format error"<<endl;
|
||||
std::cout<<"IsGoodFileType: format error"<<std::endl;
|
||||
#endif
|
||||
s = Storage_VSFormatError;
|
||||
}
|
||||
|
@@ -46,11 +46,11 @@ public:
|
||||
//
|
||||
DDF_IOStream();
|
||||
Storage_Error Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode) ;
|
||||
Storage_Error Open(istream* anIStream) ;
|
||||
Storage_Error Open(ostream* anOStream) ;
|
||||
Storage_Error Open(std::istream* anIStream) ;
|
||||
Storage_Error Open(std::ostream* anOStream) ;
|
||||
Standard_Boolean IsEnd() ;
|
||||
Storage_Position Tell() { return -1; }
|
||||
static Storage_Error IsGoodFileType(istream* anIStream) ;
|
||||
static Storage_Error IsGoodFileType(std::istream* anIStream) ;
|
||||
Storage_Error BeginWriteInfoSection() ;
|
||||
void WriteInfo(const Standard_Integer nbObj,const TCollection_AsciiString& dbVersion,const TCollection_AsciiString& date,const TCollection_AsciiString& schemaName,const TCollection_AsciiString& schemaVersion,const TCollection_ExtendedString& appName,const TCollection_AsciiString& appVersion,const TCollection_ExtendedString& objectType,const TColStd_SequenceOfAsciiString& userInfo) ;
|
||||
Storage_Error EndWriteInfoSection() ;
|
||||
@@ -217,8 +217,8 @@ static Standard_CString MagicNumber() ;
|
||||
// Fields PRIVATE
|
||||
//
|
||||
//FSD_FStream myStream;
|
||||
istream* myIStream;
|
||||
ostream* myOStream;
|
||||
std::istream* myIStream;
|
||||
std::ostream* myOStream;
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user