b311480e |
1 | -- Created on: 2007-06-28 |
2 | -- Created by: OCC Team |
973c2be1 |
3 | -- Copyright (c) 2007-2014 OPEN CASCADE SAS |
b311480e |
4 | -- |
973c2be1 |
5 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
6 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | -- |
973c2be1 |
13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | class Messenger from Message inherits TShared from MMgt |
17 | |
18 | ---Purpose: Messenger is API class providing general-purpose interface for |
19 | -- libraries that may issue text messages without knowledge |
20 | -- of how these messages will be further processed. |
21 | -- |
22 | -- The messenger contains a sequence of "printers" which can be |
23 | -- customized by the application, and dispatches every received |
24 | -- message to all the printers. |
25 | -- |
26 | -- For convenience, a number of operators << are defined with left |
27 | -- argument being Handle(Message_Messenger); thus it can be used |
28 | -- with syntax similar to C++ streams. |
29 | -- Note that all these operators use trace level Warning. |
30 | |
31 | uses |
32 | |
33 | Printer from Message, |
34 | PrinterOStream from Message, |
35 | SequenceOfPrinters from Message, |
36 | Gravity from Message, |
37 | AsciiString from TCollection, |
38 | ExtendedString from TCollection |
39 | |
40 | is |
41 | |
42 | Create returns Messenger from Message; |
43 | ---Purpose: Empty constructor; initializes by single printer directed to cout. |
44 | -- Note: the default messenger is not empty but directed to cout |
45 | -- in order to protect against possibility to forget defining printers. |
46 | -- If printing to cout is not needed, clear messenger by GetPrinters().Clear() |
47 | |
48 | Create (thePrinter: Printer from Message) |
49 | returns Messenger from Message; |
50 | ---Purpose: Create messenger with single printer |
51 | |
52 | AddPrinter (me: mutable; thePrinter: Printer from Message) |
53 | returns Boolean from Standard; |
54 | ---Purpose: Add a printer to the messenger. |
55 | -- The printer will be added only if it is not yet in the list. |
56 | -- Returns True if printer has been added. |
57 | |
58 | RemovePrinter (me: mutable; thePrinter: Printer from Message) |
59 | returns Boolean from Standard; |
60 | ---Purpose: Removes specified printer from the messenger. |
61 | -- Returns True if this printer has been found in the list |
62 | -- and removed. |
63 | |
64 | RemovePrinters (me: mutable; theType: Type from Standard) |
65 | returns Integer from Standard; |
66 | ---Purpose: Removes printers of specified type (including derived classes) |
67 | -- from the messenger. |
68 | -- Returns number of removed printers. |
69 | |
70 | Printers(me) |
71 | returns SequenceOfPrinters from Message; |
72 | ---C++: inline |
73 | ---C++: return const & |
74 | ---Purpose: Returns current sequence of printers |
75 | |
76 | ChangePrinters(me: mutable) |
77 | returns SequenceOfPrinters from Message; |
78 | ---C++: inline |
79 | ---C++: return & |
80 | ---Purpose: Returns sequence of printers |
81 | -- The sequence can be modified. |
82 | |
83 | Send (me; theString : CString from Standard; |
84 | theGravity: Gravity from Message = Message_Warning; |
85 | putEndl: Boolean from Standard = Standard_True); |
86 | ---Purpose: Dispatch a message to all the printers in the list. |
87 | -- Three versions of string representations are accepted for |
88 | -- convenience, by default all are converted to ExtendedString. |
89 | -- The parameter putEndl specifies whether the new line should |
90 | -- be started after this message (default) or not (may have |
91 | -- sense in some conditions). |
92 | |
93 | Send (me; theString : AsciiString from TCollection; |
94 | theGravity: Gravity from Message = Message_Warning; |
95 | putEndl: Boolean from Standard = Standard_True); |
96 | ---Purpose: See above |
97 | |
98 | Send (me; theString : ExtendedString from TCollection; |
99 | theGravity: Gravity from Message = Message_Warning; |
100 | putEndl: Boolean from Standard = Standard_True); |
101 | ---Purpose: See above |
102 | |
103 | fields |
104 | |
105 | myPrinters: SequenceOfPrinters from Message; |
106 | |
107 | end Messenger; |