1 -- Created on: 2001-01-06
2 -- Created by: OCC Team
3 -- Copyright (c) 2001-2014 OPEN CASCADE SAS
5 -- This file is part of Open CASCADE Technology software library.
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.
13 -- Alternatively, this file may be used under the terms of Open CASCADE
14 -- commercial license or contractual agreement.
16 class PrinterOStream from Message inherits Printer from Message
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).
24 Address from Standard,
25 OStream from Standard,
27 AsciiString from TCollection,
28 ExtendedString from TCollection
32 Create (theTraceLevel: Gravity from Message = Message_Info)
33 returns PrinterOStream from Message;
34 ---Purpose: Empty constructor, defaulting to cout
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
46 ---Purpose: Flushes the output stream and destroys it if it has been
47 -- specified externally with option doFree (or if it is internal
50 GetTraceLevel (me) returns Gravity from Message;
52 ---Purpose: Return trace level used for filtering messages;
53 -- messages with lover gravity will be ignored.
55 SetTraceLevel (me: mutable; theTraceLevel: Gravity from Message);
57 ---Purpose: Set trace level used for filtering messages.
58 -- By default, trace level is Message_Info, so that
59 -- all messages are output
61 GetUseUtf8 (me) returns Boolean;
62 ---Purpose: Returns option to convert non-Ascii symbols to UTF8 encoding
65 SetUseUtf8 (me: mutable; useUtf8: Boolean);
66 ---Purpose: Sets option to convert non-Ascii symbols to UTF8 encoding
69 GetStream (me) returns OStream;
70 ---Purpose: Returns reference to the output stream
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()
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()
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 '?'
98 myTraceLevel: Gravity from Message;
99 myStream: Address from Standard; -- pointer to OStream
100 myIsFile: Boolean from Standard;
101 myUseUtf8: Boolean from Standard;