File: Message_Messenger.hxx

package info (click to toggle)
oce 0.18.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 301,548 kB
  • sloc: cpp: 1,190,609; ansic: 67,225; sh: 11,630; tcl: 7,954; cs: 5,221; python: 2,867; java: 1,522; makefile: 342; xml: 292; perl: 37
file content (116 lines) | stat: -rw-r--r-- 4,049 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Message_Messenger_HeaderFile
#define _Message_Messenger_HeaderFile

#include <Standard.hxx>
#include <Standard_DefineHandle.hxx>
#include <Handle_Message_Messenger.hxx>

#include <Message_SequenceOfPrinters.hxx>
#include <MMgt_TShared.hxx>
#include <Handle_Message_Printer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Handle_Standard_Type.hxx>
#include <Standard_CString.hxx>
#include <Message_Gravity.hxx>
class Message_Printer;
class Standard_Type;
class Message_SequenceOfPrinters;
class TCollection_AsciiString;
class TCollection_ExtendedString;


//! Messenger is API class providing general-purpose interface for
//! libraries that may issue text messages without knowledge
//! of how these messages will be further processed.
//!
//! The messenger contains a sequence of "printers" which can be
//! customized by the application, and dispatches every received
//! message to all the printers.
//!
//! For convenience, a number of operators << are defined with left
//! argument being Handle(Message_Messenger); thus it can be used
//! with syntax similar to C++ streams.
//! Note that all these operators use trace level Warning.
class Message_Messenger : public MMgt_TShared
{

public:

  
  //! Empty constructor; initializes by single printer directed to cout.
  //! Note: the default messenger is not empty but directed to cout
  //! in order to protect against possibility to forget defining printers.
  //! If printing to cout is not needed, clear messenger by GetPrinters().Clear()
  Standard_EXPORT Message_Messenger();
  
  //! Create messenger with single printer
  Standard_EXPORT Message_Messenger(const Handle(Message_Printer)& thePrinter);
  
  //! Add a printer to the messenger.
  //! The printer will be added only if it is not yet in the list.
  //! Returns True if printer has been added.
  Standard_EXPORT   Standard_Boolean AddPrinter (const Handle(Message_Printer)& thePrinter) ;
  
  //! Removes specified printer from the messenger.
  //! Returns True if this printer has been found in the list
  //! and removed.
  Standard_EXPORT   Standard_Boolean RemovePrinter (const Handle(Message_Printer)& thePrinter) ;
  
  //! Removes printers of specified type (including derived classes)
  //! from the messenger.
  //! Returns number of removed printers.
  Standard_EXPORT   Standard_Integer RemovePrinters (const Handle(Standard_Type)& theType) ;
  
  //! Returns current sequence of printers
     const  Message_SequenceOfPrinters& Printers()  const;
  
  //! Returns sequence of printers
  //! The sequence can be modified.
      Message_SequenceOfPrinters& ChangePrinters() ;
  
  //! Dispatch a message to all the printers in the list.
  //! Three versions of string representations are accepted for
  //! convenience, by default all are converted to ExtendedString.
  //! The parameter putEndl specifies whether the new line should
  //! be started after this message (default) or not (may have
  //! sense in some conditions).
  Standard_EXPORT   void Send (const Standard_CString theString, const Message_Gravity theGravity = Message_Warning, const Standard_Boolean putEndl = Standard_True)  const;
  
  //! See above
  Standard_EXPORT   void Send (const TCollection_AsciiString& theString, const Message_Gravity theGravity = Message_Warning, const Standard_Boolean putEndl = Standard_True)  const;
  
  //! See above
  Standard_EXPORT   void Send (const TCollection_ExtendedString& theString, const Message_Gravity theGravity = Message_Warning, const Standard_Boolean putEndl = Standard_True)  const;




  DEFINE_STANDARD_RTTI(Message_Messenger)

protected:




private: 


  Message_SequenceOfPrinters myPrinters;


};


#include <Message_Messenger.lxx>





#endif // _Message_Messenger_HeaderFile