Warnings on vc14 were eliminated
[occt.git] / src / BinTools / BinTools_CurveSet.cxx
old mode 100755 (executable)
new mode 100644 (file)
index f22baea..7f89e62
@@ -1,47 +1,42 @@
 // Created on: 2004-05-20
 // Created by: Sergey ZARITCHNY
-// Copyright (c) 2004-2012 OPEN CASCADE SAS
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 
-
-#include <BinTools_CurveSet.ixx>
 #include <BinTools.hxx>
+#include <BinTools_CurveSet.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <Geom_Circle.hxx>
-#include <Geom_Line.hxx>
+#include <Geom_Curve.hxx>
 #include <Geom_Ellipse.hxx>
-#include <Geom_Parabola.hxx>
 #include <Geom_Hyperbola.hxx>
-#include <Geom_BezierCurve.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Line.hxx>
 #include <Geom_OffsetCurve.hxx>
-
-#include <gp_Lin.hxx>
+#include <Geom_Parabola.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <gp_Circ.hxx>
 #include <gp_Elips.hxx>
-#include <gp_Parab.hxx>
 #include <gp_Hypr.hxx>
-
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <Standard_Failure.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Parab.hxx>
 #include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
 
 #define LINE      1
 #define CIRCLE    2
@@ -316,7 +311,6 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_Off
 void BinTools_CurveSet::WriteCurve(const Handle(Geom_Curve)& C,
                                    Standard_OStream& OS)
 {
-  Standard_SStream aMsg;
   Handle(Standard_Type) TheType = C->DynamicType();
   try {
     OCC_CATCH_SIGNALS
@@ -348,15 +342,14 @@ void BinTools_CurveSet::WriteCurve(const Handle(Geom_Curve)& C,
       OS << Handle(Geom_OffsetCurve)::DownCast(C);
     }
     else {
-      aMsg << "UNKNOWN CURVE TYPE" <<endl;
-      Standard_Failure::Raise(aMsg);
+      throw Standard_Failure("UNKNOWN CURVE TYPE");
     }
   }
-   catch(Standard_Failure) {
+   catch(Standard_Failure const& anException) {
+     Standard_SStream aMsg;
      aMsg << "EXCEPTION in BinTools_CurveSet::WriteCurve(..)" << endl;
-     Handle(Standard_Failure) anExc = Standard_Failure::Caught();
-     aMsg << anExc << endl;
-     Standard_Failure::Raise(aMsg);
+     aMsg << anException << endl;
+     throw Standard_Failure(aMsg.str().c_str());
    }  
 }
 
@@ -618,7 +611,6 @@ static Standard_IStream& operator>>(Standard_IStream& IS,
 Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS,
                                                Handle(Geom_Curve)& C)
 {
-  Standard_SStream aMsg;
   try {
     OCC_CATCH_SIGNALS
     const Standard_Byte ctype = (Standard_Byte) IS.get();
@@ -700,16 +692,16 @@ Standard_IStream& BinTools_CurveSet::ReadCurve(Standard_IStream& IS,
     default:
       {
        C = NULL;
-       aMsg << "UNKNOWN CURVE TYPE" << endl;
-       Standard_Failure::Raise(aMsg);
+       throw Standard_Failure("UNKNOWN CURVE TYPE");
       }
     }
   }
-  catch(Standard_Failure) {
+  catch(Standard_Failure const& anException) {
     C = NULL;
+    Standard_SStream aMsg;
     aMsg <<"EXCEPTION in BinTools_CurveSet::ReadCurve(..)" << endl;
-    Handle(Standard_Failure) anExc = Standard_Failure::Caught();
-    Standard_Failure::Raise(aMsg);
+    aMsg << anException << endl;
+    throw Standard_Failure(aMsg.str().c_str());
   }
   return IS;
 }
@@ -726,10 +718,10 @@ void  BinTools_CurveSet::Read(Standard_IStream& IS)
   if (IS.fail() || strcmp(buffer,"Curves")) {
     Standard_SStream aMsg;
     aMsg << "BinTools_CurveSet::Read:  Not a Curve table"<<endl;
-#ifdef DEB
+#ifdef OCCT_DEBUG
     cout <<"CurveSet buffer: " << buffer << endl;
 #endif
-    Standard_Failure::Raise(aMsg);
+    throw Standard_Failure(aMsg.str().c_str());
     return;
   }