1 -- Created on: 2007-06-28
2 -- Created by: OCC Team
3 -- Copyright (c) 2007-2012 OPEN CASCADE SAS
5 -- The content of this file is subject to the Open CASCADE Technology Public
6 -- License Version 6.5 (the "License"). You may not use the content of this file
7 -- except in compliance with the License. Please obtain a copy of the License
8 -- at http://www.opencascade.org and read it completely before using this file.
10 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 -- The Original Code and all software distributed under the License is
14 -- distributed on an "AS IS" basis, without warranty of any kind, and the
15 -- Initial Developer hereby disclaims all such warranties, including without
16 -- limitation, any warranties of merchantability, fitness for a particular
17 -- purpose or non-infringement. Please see the License for the specific terms
18 -- and conditions governing the rights and limitations under the License.
21 class Messenger from Message inherits TShared from MMgt
23 ---Purpose: Messenger is API class providing general-purpose interface for
24 -- libraries that may issue text messages without knowledge
25 -- of how these messages will be further processed.
27 -- The messenger contains a sequence of "printers" which can be
28 -- customized by the application, and dispatches every received
29 -- message to all the printers.
31 -- For convenience, a number of operators << are defined with left
32 -- argument being Handle(Message_Messenger); thus it can be used
33 -- with syntax similar to C++ streams.
34 -- Note that all these operators use trace level Warning.
39 PrinterOStream from Message,
40 SequenceOfPrinters from Message,
42 AsciiString from TCollection,
43 ExtendedString from TCollection
47 Create returns Messenger from Message;
48 ---Purpose: Empty constructor; initializes by single printer directed to cout.
49 -- Note: the default messenger is not empty but directed to cout
50 -- in order to protect against possibility to forget defining printers.
51 -- If printing to cout is not needed, clear messenger by GetPrinters().Clear()
53 Create (thePrinter: Printer from Message)
54 returns Messenger from Message;
55 ---Purpose: Create messenger with single printer
57 AddPrinter (me: mutable; thePrinter: Printer from Message)
58 returns Boolean from Standard;
59 ---Purpose: Add a printer to the messenger.
60 -- The printer will be added only if it is not yet in the list.
61 -- Returns True if printer has been added.
63 RemovePrinter (me: mutable; thePrinter: Printer from Message)
64 returns Boolean from Standard;
65 ---Purpose: Removes specified printer from the messenger.
66 -- Returns True if this printer has been found in the list
69 RemovePrinters (me: mutable; theType: Type from Standard)
70 returns Integer from Standard;
71 ---Purpose: Removes printers of specified type (including derived classes)
72 -- from the messenger.
73 -- Returns number of removed printers.
76 returns SequenceOfPrinters from Message;
78 ---C++: return const &
79 ---Purpose: Returns current sequence of printers
81 ChangePrinters(me: mutable)
82 returns SequenceOfPrinters from Message;
85 ---Purpose: Returns sequence of printers
86 -- The sequence can be modified.
88 Send (me; theString : CString from Standard;
89 theGravity: Gravity from Message = Message_Warning;
90 putEndl: Boolean from Standard = Standard_True);
91 ---Purpose: Dispatch a message to all the printers in the list.
92 -- Three versions of string representations are accepted for
93 -- convenience, by default all are converted to ExtendedString.
94 -- The parameter putEndl specifies whether the new line should
95 -- be started after this message (default) or not (may have
96 -- sense in some conditions).
98 Send (me; theString : AsciiString from TCollection;
99 theGravity: Gravity from Message = Message_Warning;
100 putEndl: Boolean from Standard = Standard_True);
101 ---Purpose: See above
103 Send (me; theString : ExtendedString from TCollection;
104 theGravity: Gravity from Message = Message_Warning;
105 putEndl: Boolean from Standard = Standard_True);
106 ---Purpose: See above
110 myPrinters: SequenceOfPrinters from Message;