Salome HOME
updated copyright message
[modules/kernel.git] / src / DSC / DSC_User / test_DSC_Exception.cxx
index 67e99e7df54f170b605944aadec350dd74765ece..a23032e7986aad1b2f0a0c8cf5270c3c6a69c0d1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 class A {
 
 public:
-  DSC_EXCEPTION(Exp1);
-  DSC_EXCEPTION(Exp2);
+  DSC_EXCEPTION(Exp1)
+  DSC_EXCEPTION(Exp2)
 
   A() {};
   virtual ~A() {};
   // La salome exception ne permet pas de passer une chaine ""
-  void lanceException1_1() throw(Exp1) { throw Exp1("_");}
-  void lanceException1_2() throw(Exp1) { throw Exp1("Ceci est l'exception 1_2");}
-  void lanceException1_3() throw(Exp1) { throw Exp1(LOC("Ceci est l'exception 1_3"));}
-  void lanceException1_4() throw(Exp1) { throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_4" )); }
-  void lanceException1_5() throw(Exp1) 
+  void lanceException1_1() { throw Exp1("_");}
+  void lanceException1_2() { throw Exp1("Ceci est l'exception 1_2");}
+  void lanceException1_3() { throw Exp1(LOC("Ceci est l'exception 1_3"));}
+  void lanceException1_4() { throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_4" )); }
+  void lanceException1_5() { 
     int a=1;
     throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_5 avec la valeur A : " << a )); }
-  void lanceException1_6() throw(Exp1) {
+  void lanceException1_6() {
     Exp1 exp1(LOC(OSS() << "Ceci est l'exeption 1_6"));
     std::cout << "Affichage de exp1.what() dans lanceException1_6() " << exp1.what() << std::endl;
     throw Exp1(exp1); 
   }
-  void lanceException1_7() throw(Exp1) {
+  void lanceException1_7() {
     throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_7"));
    }
 };
 
-DSC_EXCEPTION_CXX(A,Exp1);
-DSC_EXCEPTION_CXX(A,Exp2);
+DSC_EXCEPTION_CXX(A,Exp1)
+DSC_EXCEPTION_CXX(A,Exp2)
 
 
 int main() {
@@ -78,7 +78,7 @@ int main() {
     a.lanceException1_2();
   }
   // Essai par valeur (ne pas faire çà !)
-  catch (  A::Exp1  ex ) {
+  catch (  A::Exp1&  ex ) {
     std::cout << "Exception 1 bien reçue" << std::endl;
     std::cout << ex.what() << std::endl;
   } catch ( const DSC_Exception & dscE ) {
@@ -126,7 +126,7 @@ int main() {
   try {
     a.lanceException1_6();
   }
-  catch ( SALOME_Exception ex ) {
+  catch ( SALOME_Exception& ex ) {
     std::cout << "Exception SALOME bien reçue" << std::endl;
     std::cout << ex.what() << std::endl;
   } catch ( ...) {
@@ -155,4 +155,4 @@ int main() {
     std::cout << "Exception ... reçue mais aurait dû recevoir Exception DSC" << std::endl;
   }
 
-};
+}