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