42cf5bc1 |
1 | // Created on: 1992-05-18 |
2 | // Created by: Stephan GARNAUD (ARM) |
3 | // Copyright (c) 1992-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _OSD_Error_HeaderFile |
18 | #define _OSD_Error_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TCollection_AsciiString.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <OSD_WhoAmI.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | class OSD_OSDError; |
29 | class TCollection_AsciiString; |
30 | |
31 | |
32 | //! Accurate management of OSD specific errors. |
33 | class OSD_Error |
34 | { |
35 | public: |
36 | |
37 | DEFINE_STANDARD_ALLOC |
38 | |
39 | |
40 | //! Initializes Error to be without any Error. |
41 | //! This is only used by OSD, not by programmer. |
42 | Standard_EXPORT OSD_Error(); |
43 | |
44 | //! Raises OSD_Error with accurate error message. |
45 | Standard_EXPORT void Perror(); |
46 | |
47 | //! Instantiates error |
48 | //! This is only used by OSD methods to instantiates an error code. |
49 | //! No description is done for the programmer. |
50 | Standard_EXPORT void SetValue (const Standard_Integer Errcode, const Standard_Integer From, const TCollection_AsciiString& Message); |
51 | |
52 | //! Returns an accurate error code. |
53 | //! To test these values, you must include "OSD_ErrorList.hxx" |
54 | Standard_EXPORT Standard_Integer Error() const; |
55 | |
56 | //! Returns TRUE if an error occurs |
57 | //! This is a way to test if a system call succeeded or not. |
58 | Standard_EXPORT Standard_Boolean Failed() const; |
59 | |
60 | //! Resets error counter to zero |
61 | //! This allows the user to ignore an error (WARNING). |
62 | Standard_EXPORT void Reset(); |
63 | |
64 | |
65 | |
66 | |
67 | protected: |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | private: |
74 | |
75 | |
76 | |
77 | TCollection_AsciiString myMessage; |
78 | Standard_Integer myErrno; |
79 | OSD_WhoAmI myCode; |
80 | Standard_Integer extCode; |
81 | |
82 | |
83 | }; |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | #endif // _OSD_Error_HeaderFile |