const Storage_Position& ShapeSectionPos,
Standard_IStream& IS)
{
- if(!IS.eof()) {
-#if defined(WNT) || defined(HAVE_IOSTREAM)
+ if (!IS.eof())
+ {
const std::streamoff endPos = IS.rdbuf()->pubseekoff(0L, std::ios_base::end, std::ios_base::in);
-#else
- const Storage_Position endPos = IS.rdbuf()->seekoff(0L, unsafe_ios::end, unsafe_ios::in);
-#endif
#ifdef DATATYPE_MIGRATION_DEB
cout << "endPos = " << endPos <<endl;
#endif
// get the error message
Standard_SStream ss;
- ss << "** Exception ** " << E << ends ;
-#ifdef USE_STL_STREAM
+ ss << "** Exception ** " << E << ends;
Tcl_SetResult(interp,(char*)(ss.str().c_str()),TCL_VOLATILE);
-#else
- Tcl_SetResult(interp,(char*)(ss.str()),TCL_VOLATILE);
-#endif
code = TCL_ERROR;
}
Draw_Interpretor& Draw_Interpretor::Append(const Standard_SStream& s)
{
-#ifdef USE_STL_STREAM
return Append (s.str().c_str());
-#else
- // Note: use dirty tricks -- unavoidable with old streams
- TCollection_AsciiString aStr (((Standard_SStream&)AReason).str(), AReason.pcount());
- ((Standard_SStream&)AReason).freeze (false);
- return Append (aStr.ToCString());
-#endif
}
//=======================================================================
#include <Standard_Stream.hxx>
#include <Standard_SStream.hxx>
-#if defined(HAVE_IOS) || defined(WNT)
-# include <ios>
-#elif defined(HAVE_IOS_H)
-# include <ios.h>
-#endif
-
#include <Draw_Display.hxx>
#include <Draw_Appli.hxx>
#include <Draw_Number.hxx>
#include <Draw_VMap.hxx>
#include <Draw_ProgressIndicator.hxx>
+#include <ios>
+
#ifdef WNT
extern Draw_Viewer dout;
#endif
return d->IsInstance(STANDARD_TYPE(Draw_Number));
}
-static void numsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
+static void numsave (const Handle(Draw_Drawable3D)& theDrawable,
+ ostream& theStream)
{
- Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(d);
-#if (defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX)) || ( defined(WNT) && !defined(USE_OLD_STREAMS))
- ios::fmtflags F = OS.flags();
- OS.setf(ios::scientific);
- OS.precision(15);
- OS.width(30);
-#else
- long form = OS.setf(ios::scientific);
- int prec = OS.precision(15);
- int w = OS.width(30);
-#endif
- OS << N->Value()<<"\n";
- #if (defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX)) || (defined(WNT)&& !defined(USE_OLD_STREAMS))
- OS.setf(F);
-#else
- OS.setf(form);
- OS.precision(prec);
- OS.width(w);
-#endif
+ Handle(Draw_Number) aNum = Handle(Draw_Number)::DownCast (theDrawable);
+ ios::fmtflags aFlags = theStream.flags();
+ theStream.setf (ios::scientific);
+ theStream.precision (15);
+ theStream.width (30);
+ theStream << aNum->Value() << "\n";
+ theStream.setf (aFlags);
}
static Handle(Draw_Drawable3D) numrestore (istream& is)
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;
}
//=======================================================================
Message_PrinterOStream::Message_PrinterOStream (const Message_Gravity theTraceLevel)
-: myStream (&cout),
+: myStream (&std::cout),
myIsFile (Standard_False),
myUseUtf8 (Standard_False)
{
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;
}
}
ostr->flush();
if ( myIsFile )
{
- ofstream* ofile = (ofstream*)ostr;
+ std::ofstream* ofile = (std::ofstream* )ostr;
ofile->close();
delete ofile;
myIsFile = Standard_False;
void Standard_Failure::Reraise (const Standard_SStream& AReason)
{
-#ifdef USE_STL_STREAM
SetMessageString(AReason.str().c_str());
-#else
- // Note: use dirty tricks -- unavoidable with old streams
- ((Standard_SStream&)AReason) << ends;
- SetMessageString(((Standard_SStream&)AReason).str());
- ((Standard_SStream&)AReason).freeze (false);
-#endif
Reraise();
}
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// Purpose: Defines Standard_SStream as typedef to C++ string stream.
-
#ifndef _Standard_SStream_HeaderFile
#define _Standard_SStream_HeaderFile
#include <Standard_Stream.hxx>
+#include <sstream>
-#ifdef USE_STL_STREAM
-
- #include <sstream>
-
- typedef std::stringstream Standard_SStream;
-
-#else /* USE_STL_STREAM */
-
- #ifdef WNT
- #include <strstrea.h>
- #else
- #include <strstream.h>
- #endif
-
- typedef strstream Standard_SStream;
-
-#endif /* USE_STL_STREAM */
+//! Defines Standard_SStream as typedef to C++ string stream.
+typedef std::stringstream Standard_SStream;
-#endif
+#endif // _Standard_SStream_HeaderFile
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// Purpose: Includes standard header files containing definition of streams;
-// defines macro USE_STL_STREAM if C++ standard STL streams are used
-// as opposed to obsolete non-standard streams.
-// Macro USE_OLD_STREAMS may be defined externally to command using
-// old streams on WNT; otherwise new streams are used whenever available.
-// Macro NO_USING_STD may be defined externally to avoid "using"
-// declaratiions for types from std namespace.
-
#ifndef _Standard_Stream_HeaderFile
#define _Standard_Stream_HeaderFile
#include <Standard_Macro.hxx>
-#ifdef USE_STL_STREAM
-#undef USE_STL_STREAM
-#endif
-
-// Unix variant
-#ifndef WNT
-
-#ifdef HAVE_IOSTREAM
- #include <iostream>
- #define USE_STL_STREAM
-#elif defined (HAVE_IOSTREAM_H)
- #include <iostream.h>
-#else
- #error "check config.h file or compilation options: either HAVE_IOSTREAM or HAVE_IOSTREAM_H should be defined"
-#endif
-
-#ifdef HAVE_IOMANIP
- #include <iomanip>
-#elif defined (HAVE_IOMANIP_H)
- #include <iomanip.h>
-#endif
-
-#ifdef HAVE_FSTREAM
- #include <fstream>
-#elif defined (HAVE_FSTREAM_H)
- #include <fstream.h>
-#endif
-
-// Windows variant
-#else /* WNT */
-
-// Macro USE_OLD_STREAMS may be defined externally to command
-// using old streams on Windows NT; otherwise new streams are used
-#ifndef USE_OLD_STREAMS
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #define USE_STL_STREAM
-#else
- #include <iostream.h>
- #include <iomanip.h>
- #include <fstream.h>
-#endif /* USE_OLD_STREAMS */
-
-#endif /* WNT */
+#include <iostream>
+#include <iomanip>
+#include <fstream>
// "using" declaration for STL types is still necessary
-// as OCCT code contains too much of this staff without std: prefix
-#if defined(USE_STL_STREAM) && ! defined(NO_USING_STD)
+// as OCCT code contains too much of this staff without std:: prefix
using std::istream;
using std::ostream;
using std::ofstream;
using std::setprecision;
using std::hex;
using std::dec;
-#endif
-#endif /* _Standard_Stream_HeaderFile */
+#endif // _Standard_Stream_HeaderFile
// if (Type == TopAbs_COMPOUND) Stream<<"ASSEMBLY";
// else
TopAbs::Print(S.ShapeType(), Stream);
-
-#ifdef USE_STL_STREAM
TCollection_AsciiString aName (Stream.str().c_str());
-#else
- Stream << ends;
- TCollection_AsciiString aName (Stream.str());
-#endif
TDataStd_Name::Set(L, TCollection_ExtendedString(aName));
}
}
{
if (aNode.getNodeType() == LDOM_Node::TEXT_NODE) {
LDOMString aData = aNode.getNodeValue();
- #ifdef USE_STL_STREAM
std::stringstream aStream (std::string(aData.GetString()));
- #else
- istrstream aStream (Standard_CString(aData.GetString()));
- #endif
myShapeSet.Clear();
myShapeSet.Read (aStream);
break;