Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Message_Printer.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 //! Abstract interface class defining printer as output context for text messages
0030 //!
0031 //! The message, besides being text string, has associated gravity
0032 //! level, which can be used by printer to decide either to process a message or ignore it.
0033 class Message_Printer : public Standard_Transient
0034 {
0035   DEFINE_STANDARD_RTTIEXT(Message_Printer, Standard_Transient)
0036 public:
0037   //! Return trace level used for filtering messages;
0038   //! messages with lover gravity will be ignored.
0039   Message_Gravity GetTraceLevel() const { return myTraceLevel; }
0040 
0041   //! Set trace level used for filtering messages.
0042   //! By default, trace level is Message_Info, so that all messages are output
0043   void SetTraceLevel(const Message_Gravity theTraceLevel) { myTraceLevel = theTraceLevel; }
0044 
0045   //! Send a string message with specified trace level.
0046   //! The last Boolean argument is deprecated and unused.
0047   //! Default implementation redirects to send().
0048   Standard_EXPORT virtual void Send(const TCollection_ExtendedString& theString,
0049                                     const Message_Gravity             theGravity) const;
0050 
0051   //! Send a string message with specified trace level.
0052   //! The last Boolean argument is deprecated and unused.
0053   //! Default implementation redirects to send().
0054   Standard_EXPORT virtual void Send(const char* const     theString,
0055                                     const Message_Gravity theGravity) const;
0056 
0057   //! Send a string message with specified trace level.
0058   //! The last Boolean argument is deprecated and unused.
0059   //! Default implementation redirects to send().
0060   Standard_EXPORT virtual void Send(const TCollection_AsciiString& theString,
0061                                     const Message_Gravity          theGravity) const;
0062 
0063   //! Send a string message with specified trace level.
0064   //! Stream is converted to string value.
0065   //! Default implementation calls first method Send().
0066   Standard_EXPORT virtual void SendStringStream(const Standard_SStream& theStream,
0067                                                 const Message_Gravity   theGravity) const;
0068 
0069   //! Send a string message with specified trace level.
0070   //! The object is converted to string in format: <object kind> : <object pointer>.
0071   //! Default implementation calls first method Send().
0072   Standard_EXPORT virtual void SendObject(const occ::handle<Standard_Transient>& theObject,
0073                                           const Message_Gravity                  theGravity) const;
0074 
0075 protected:
0076   //! Empty constructor with Message_Info trace level
0077   Standard_EXPORT Message_Printer();
0078 
0079   //! Send a string message with specified trace level.
0080   //! This method must be redefined in descendant.
0081   Standard_EXPORT virtual void send(const TCollection_AsciiString& theString,
0082                                     const Message_Gravity          theGravity) const = 0;
0083 
0084 protected:
0085   Message_Gravity myTraceLevel;
0086 };
0087 
0088 #endif // _Message_Printer_HeaderFile