1 // Created on: 2001-01-06
2 // Created by: OCC Team
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Message_Printer_HeaderFile
17 #define _Message_Printer_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <Message_Gravity.hxx>
23 #include <MMgt_TShared.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_CString.hxx>
26 class TCollection_ExtendedString;
27 class TCollection_AsciiString;
30 class Message_Printer;
31 DEFINE_STANDARD_HANDLE(Message_Printer, MMgt_TShared)
33 //! Abstract interface class defining printer as output context for text messages
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.
37 class Message_Printer : public MMgt_TShared
43 //! Return trace level used for filtering messages;
44 //! messages with lover gravity will be ignored.
45 Message_Gravity GetTraceLevel() const;
47 //! Set trace level used for filtering messages.
48 //! By default, trace level is Message_Info, so that all messages are output
49 void SetTraceLevel (const Message_Gravity theTraceLevel);
51 //! Send a string message with specified trace level.
52 //! The parameter theToPutEol specified whether end-of-line should be added to the end of the message.
53 //! This method must be redefined in descentant.
54 Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const = 0;
56 //! Send a string message with specified trace level.
57 //! The parameter theToPutEol specified whether end-of-line should be added to the end of the message.
58 //! Default implementation calls first method Send().
59 Standard_EXPORT virtual void Send (const Standard_CString theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const;
61 //! Send a string message with specified trace level.
62 //! The parameter theToPutEol specified whether end-of-line should be added to the end of the message.
63 //! Default implementation calls first method Send().
64 Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const;
69 DEFINE_STANDARD_RTTI(Message_Printer,MMgt_TShared)
74 //! Empty constructor with Message_Info trace level
75 Standard_EXPORT Message_Printer();
77 Message_Gravity myTraceLevel;
88 #include <Message_Printer.lxx>
94 #endif // _Message_Printer_HeaderFile