42cf5bc1 |
1 | // Created on: 2001-01-06 |
2 | // Created by: OCC Team |
3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _Message_Printer_HeaderFile |
17 | #define _Message_Printer_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Type.hxx> |
21 | |
22 | #include <Message_Gravity.hxx> |
25e59720 |
23 | #include <Standard_Transient.hxx> |
42cf5bc1 |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_CString.hxx> |
26 | class TCollection_ExtendedString; |
27 | class TCollection_AsciiString; |
28 | |
29 | |
30 | class Message_Printer; |
25e59720 |
31 | DEFINE_STANDARD_HANDLE(Message_Printer, Standard_Transient) |
42cf5bc1 |
32 | |
33 | //! Abstract interface class defining printer as output context for text messages |
34 | //! |
35 | //! The message, besides being text string, has associated gravity |
36 | //! level, which can be used by printer to decide either to process a message or ignore it. |
25e59720 |
37 | class Message_Printer : public Standard_Transient |
42cf5bc1 |
38 | { |
983fd6c0 |
39 | DEFINE_STANDARD_RTTIEXT(Message_Printer, Standard_Transient) |
42cf5bc1 |
40 | public: |
41 | |
42cf5bc1 |
42 | //! Return trace level used for filtering messages; |
43 | //! messages with lover gravity will be ignored. |
983fd6c0 |
44 | Message_Gravity GetTraceLevel() const { return myTraceLevel; } |
45 | |
42cf5bc1 |
46 | //! Set trace level used for filtering messages. |
47 | //! By default, trace level is Message_Info, so that all messages are output |
983fd6c0 |
48 | void SetTraceLevel (const Message_Gravity theTraceLevel) { myTraceLevel = theTraceLevel; } |
49 | |
42cf5bc1 |
50 | //! Send a string message with specified trace level. |
fa8a4628 |
51 | //! The last Boolean argument is deprecated and unused. |
52 | //! Default implementation redirects to send(). |
53 | Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString, |
54 | const Message_Gravity theGravity) const; |
42cf5bc1 |
55 | |
56 | //! Send a string message with specified trace level. |
fa8a4628 |
57 | //! The last Boolean argument is deprecated and unused. |
58 | //! Default implementation redirects to send(). |
59 | Standard_EXPORT virtual void Send (const Standard_CString theString, |
60 | const Message_Gravity theGravity) const; |
42cf5bc1 |
61 | |
62 | //! Send a string message with specified trace level. |
fa8a4628 |
63 | //! The last Boolean argument is deprecated and unused. |
64 | //! Default implementation redirects to send(). |
65 | Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString, |
66 | const Message_Gravity theGravity) const; |
42cf5bc1 |
67 | |
42cf5bc1 |
68 | protected: |
69 | |
42cf5bc1 |
70 | //! Empty constructor with Message_Info trace level |
71 | Standard_EXPORT Message_Printer(); |
72 | |
fa8a4628 |
73 | //! Send a string message with specified trace level. |
74 | //! This method must be redefined in descentant. |
75 | Standard_EXPORT virtual void send (const TCollection_AsciiString& theString, |
76 | const Message_Gravity theGravity) const = 0; |
77 | |
983fd6c0 |
78 | protected: |
42cf5bc1 |
79 | |
983fd6c0 |
80 | Message_Gravity myTraceLevel; |
42cf5bc1 |
81 | |
82 | }; |
83 | |
42cf5bc1 |
84 | #endif // _Message_Printer_HeaderFile |