b311480e |
1 | -- Created on: 2001-01-06 |
2 | -- Created by: OCC Team |
3 | -- Copyright (c) 2001-2012 OPEN CASCADE SAS |
4 | -- |
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. |
9 | -- |
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. |
12 | -- |
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. |
19 | |
7fd59977 |
20 | |
21 | |
22 | class PrinterOStream from Message inherits Printer from Message |
23 | |
24 | ---Purpose: Implementation of a message printer associated with an ostream |
25 | -- The ostream may be either externally defined one (e.g. cout), |
26 | -- or file stream maintained internally (depending on constructor). |
27 | |
28 | uses |
29 | |
30 | Address from Standard, |
31 | OStream from Standard, |
32 | Gravity from Message, |
33 | AsciiString from TCollection, |
34 | ExtendedString from TCollection |
35 | |
36 | is |
37 | |
38 | Create (theTraceLevel: Gravity from Message = Message_Info) |
39 | returns PrinterOStream from Message; |
40 | ---Purpose: Empty constructor, defaulting to cout |
41 | |
42 | Create (theFileName: CString; theDoAppend: Boolean; |
43 | theTraceLevel: Gravity from Message = Message_Info) |
44 | returns PrinterOStream from Message; |
45 | ---Purpose: Create printer for output to a specified file. |
46 | -- The option theDoAppend specifies whether file should be |
47 | -- appended or rewritten. |
48 | -- For specific file names (cout, cerr) standard streams are used |
49 | |
50 | Close (me: mutable); |
51 | ---C++: alias ~ |
52 | ---Purpose: Flushes the output stream and destroys it if it has been |
53 | -- specified externally with option doFree (or if it is internal |
54 | -- file stream) |
55 | |
56 | GetTraceLevel (me) returns Gravity from Message; |
57 | ---C++: inline |
58 | ---Purpose: Return trace level used for filtering messages; |
59 | -- messages with lover gravity will be ignored. |
60 | |
61 | SetTraceLevel (me: mutable; theTraceLevel: Gravity from Message); |
62 | ---C++: inline |
63 | ---Purpose: Set trace level used for filtering messages. |
64 | -- By default, trace level is Message_Info, so that |
65 | -- all messages are output |
66 | |
67 | GetUseUtf8 (me) returns Boolean; |
68 | ---Purpose: Returns option to convert non-Ascii symbols to UTF8 encoding |
69 | ---C++: inline |
70 | |
71 | SetUseUtf8 (me: mutable; useUtf8: Boolean); |
72 | ---Purpose: Sets option to convert non-Ascii symbols to UTF8 encoding |
73 | ---C++: inline |
74 | |
75 | GetStream (me) returns OStream; |
76 | ---Purpose: Returns reference to the output stream |
77 | ---C++: return & |
78 | ---C++: inline |
79 | |
80 | Send (me; theString : CString; theGravity: Gravity from Message; |
81 | putEndl: Boolean = Standard_True) is redefined; |
82 | ---Purpose: Puts a message to the current stream |
83 | -- if its gravity is equal or greater |
84 | -- to the trace level set by SetTraceLevel() |
85 | |
86 | Send (me; theString : AsciiString from TCollection; |
87 | theGravity: Gravity from Message; |
88 | putEndl: Boolean = Standard_True) is redefined; |
89 | ---Purpose: Puts a message to the current stream |
90 | -- if its gravity is equal or greater |
91 | -- to the trace level set by SetTraceLevel() |
92 | |
93 | Send (me; theString : ExtendedString from TCollection; |
94 | theGravity: Gravity from Message; |
95 | putEndl: Boolean = Standard_True) is redefined; |
96 | ---Purpose: Puts a message to the current stream |
97 | -- if its gravity is equal or greater |
98 | -- to the trace level set by SetTraceLevel() |
99 | -- Non-Ascii symbols are converted to UTF-8 if UseUtf8 |
100 | -- option is set, else replaced by symbols '?' |
101 | |
102 | fields |
103 | |
104 | myTraceLevel: Gravity from Message; |
105 | myStream: Address from Standard; -- pointer to OStream |
106 | myIsFile: Boolean from Standard; |
107 | myUseUtf8: Boolean from Standard; |
108 | |
109 | end PrinterOStream; |