|
||||
File indexing completed on 2024-11-15 09:48:38
0001 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _Standard_DefineException_HeaderFile 0015 #define _Standard_DefineException_HeaderFile 0016 0017 #include <Standard_Type.hxx> 0018 0019 //! Defines an exception class \a C1 that inherits an exception class \a C2. 0020 /*! \a C2 must be Standard_Failure or its ancestor. 0021 The macro defines empty constructor, copy constructor and static methods Raise() and NewInstance(). 0022 Since Standard_Failure implements class manipulated by handle, DEFINE_STANDARD_RTTI macro is also 0023 added to enable RTTI. 0024 0025 When using DEFINE_STANDARD_EXCEPTION in your code make sure you also insert a macro 0026 DEFINE_STANDARD_HANDLE(C1,C2) before it. 0027 */ 0028 0029 #define DEFINE_STANDARD_EXCEPTION(C1,C2) \ 0030 \ 0031 class C1 : public C2 { \ 0032 void Throw () const Standard_OVERRIDE { throw *this; } \ 0033 public: \ 0034 C1() : C2() {} \ 0035 C1(Standard_CString theMessage) : C2(theMessage) {} \ 0036 C1(Standard_CString theMessage, Standard_CString theStackTrace) \ 0037 : C2 (theMessage, theStackTrace) {} \ 0038 static void Raise(const Standard_CString theMessage = "") { \ 0039 Handle(C1) _E = new C1; \ 0040 _E->Reraise(theMessage); \ 0041 } \ 0042 static void Raise(Standard_SStream& theMessage) { \ 0043 Handle(C1) _E = new C1; \ 0044 _E->Reraise (theMessage); \ 0045 } \ 0046 static Handle(C1) NewInstance(Standard_CString theMessage = "") { return new C1(theMessage); } \ 0047 static Handle(C1) NewInstance(Standard_CString theMessage, Standard_CString theStackTrace) { return new C1(theMessage, theStackTrace); } \ 0048 DEFINE_STANDARD_RTTI_INLINE(C1,C2) \ 0049 }; 0050 0051 //! Obsolete macro, kept for compatibility with old code 0052 #define IMPLEMENT_STANDARD_EXCEPTION(C1) 0053 0054 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |