1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024792: Remove unused hacks for compilers without STL

This commit is contained in:
kgv
2014-04-03 17:15:09 +04:00
committed by apn
parent 91720fc5f3
commit d41f6af3f2
10 changed files with 50 additions and 168 deletions

View File

@@ -123,14 +123,7 @@ inline const Handle(Message_Messenger)&
operator << (const Handle(Message_Messenger)& theMessenger,
const Standard_SStream& theStream)
{
#ifdef USE_STL_STREAM
theMessenger->Send (theStream.str().c_str(), Message_Info, Standard_False);
#else
// Note: use dirty tricks -- unavoidable with old streams
TCollection_AsciiString aStr (((Standard_SStream&)theStream).str(), theStream.pcount());
theMessenger->Send (aStr, Message_Info, Standard_False);
((Standard_SStream&)theStream).freeze (false);
#endif
return theMessenger;
}

View File

@@ -27,7 +27,7 @@
//=======================================================================
Message_PrinterOStream::Message_PrinterOStream (const Message_Gravity theTraceLevel)
: myStream (&cout),
: myStream (&std::cout),
myIsFile (Standard_False),
myUseUtf8 (Standard_False)
{
@@ -42,35 +42,38 @@ Message_PrinterOStream::Message_PrinterOStream (const Message_Gravity theTraceLe
Message_PrinterOStream::Message_PrinterOStream (const Standard_CString theFileName,
const Standard_Boolean theToAppend,
const Message_Gravity theTraceLevel)
: myStream (&cout),
: myStream (&std::cout),
myIsFile (Standard_False)
{
myTraceLevel = theTraceLevel;
if ( strcasecmp(theFileName, "cout") == 0 )
myStream = &cerr;
else if ( strcasecmp(theFileName, "cerr") == 0 )
myStream = &cout;
else
if (strcasecmp(theFileName, "cout") == 0)
{
TCollection_AsciiString aFileName (theFileName);
myStream = &std::cerr;
return;
}
else if (strcasecmp(theFileName, "cerr") == 0)
{
myStream = &std::cout;
return;
}
TCollection_AsciiString aFileName (theFileName);
#ifdef _WIN32
aFileName.ChangeAll ('/', '\\');
aFileName.ChangeAll ('/', '\\');
#endif
ofstream *ofile = new ofstream (aFileName.ToCString(),
#ifdef USE_STL_STREAMS
(theToAppend ? (std::ios_base::app | std::ios_base::out) : std::ios_base::out ) );
#else
(theToAppend ? ios::app : ios::out ) );
#endif
if ( ofile ) {
myStream = (Standard_OStream*)ofile;
myIsFile = Standard_True;
}
else {
myStream = &cout;
cerr << "Error opening " << theFileName << endl << flush;
}
std::ofstream* aFile = new std::ofstream (aFileName.ToCString(),
(theToAppend ? (std::ios_base::app | std::ios_base::out) : std::ios_base::out));
if (aFile->is_open())
{
myStream = (Standard_OStream* )aFile;
myIsFile = Standard_True;
}
else
{
delete aFile;
myStream = &std::cout;
std::cerr << "Error opening " << theFileName << std::endl << std::flush;
}
}
@@ -88,7 +91,7 @@ void Message_PrinterOStream::Close ()
ostr->flush();
if ( myIsFile )
{
ofstream* ofile = (ofstream*)ostr;
std::ofstream* ofile = (std::ofstream* )ostr;
ofile->close();
delete ofile;
myIsFile = Standard_False;