Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:16

0001 // Created on: 2001-01-06
0002 // Created by: OCC Team
0003 // Copyright (c) 2001-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Message_Printer_HeaderFile
0017 #define _Message_Printer_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <Message_Gravity.hxx>
0023 #include <Standard_Transient.hxx>
0024 #include <Standard_SStream.hxx>
0025 
0026 class TCollection_ExtendedString;
0027 class TCollection_AsciiString;
0028 
0029 
0030 class Message_Printer;
0031 DEFINE_STANDARD_HANDLE(Message_Printer, Standard_Transient)
0032 
0033 //! Abstract interface class defining printer as output context for text messages
0034 //!
0035 //! The message, besides being text string, has associated gravity
0036 //! level, which can be used by printer to decide either to process a message or ignore it.
0037 class Message_Printer : public Standard_Transient
0038 {
0039   DEFINE_STANDARD_RTTIEXT(Message_Printer, Standard_Transient)
0040 public:
0041 
0042   //! Return trace level used for filtering messages;
0043   //! messages with lover gravity will be ignored.
0044   Message_Gravity GetTraceLevel() const { return myTraceLevel; }
0045 
0046   //! Set trace level used for filtering messages.
0047   //! By default, trace level is Message_Info, so that all messages are output
0048   void SetTraceLevel (const Message_Gravity theTraceLevel) { myTraceLevel = theTraceLevel; }
0049 
0050   //! Send a string message with specified trace level.
0051   //! The last Boolean argument is deprecated and unused.
0052   //! Default implementation redirects to send().
0053   Standard_EXPORT virtual void Send (const TCollection_ExtendedString& theString,
0054                                      const Message_Gravity theGravity) const;
0055   
0056   //! Send a string message with specified trace level.
0057   //! The last Boolean argument is deprecated and unused.
0058   //! Default implementation redirects to send().
0059   Standard_EXPORT virtual void Send (const Standard_CString theString,
0060                                      const Message_Gravity theGravity) const;
0061   
0062   //! Send a string message with specified trace level.
0063   //! The last Boolean argument is deprecated and unused.
0064   //! Default implementation redirects to send().
0065   Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString,
0066                                      const Message_Gravity theGravity) const;
0067 
0068   //! Send a string message with specified trace level.
0069   //! Stream is converted to string value.
0070   //! Default implementation calls first method Send().
0071   Standard_EXPORT virtual void SendStringStream (const Standard_SStream& theStream, const Message_Gravity theGravity) const;
0072 
0073   //! Send a string message with specified trace level.
0074   //! The object is converted to string in format: <object kind> : <object pointer>.
0075   //! Default implementation calls first method Send().
0076   Standard_EXPORT virtual void SendObject (const Handle(Standard_Transient)& theObject, const Message_Gravity theGravity) const;
0077 
0078 protected:
0079 
0080   //! Empty constructor with Message_Info trace level
0081   Standard_EXPORT Message_Printer();
0082 
0083   //! Send a string message with specified trace level.
0084   //! This method must be redefined in descendant.
0085   Standard_EXPORT virtual void send (const TCollection_AsciiString& theString,
0086                                      const Message_Gravity theGravity) const = 0;
0087 
0088 protected:
0089 
0090   Message_Gravity myTraceLevel;
0091 
0092 };
0093 
0094 #endif // _Message_Printer_HeaderFile