1 -- Created on: 2001-01-18
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 Msg from Message
18 ---Purpose: This class provides a tool for constructing the parametrized message
19 -- basing on resources loaded by Message_MsgFile tool.
21 -- A Message is created from a keyword: this keyword identifies the
22 -- message in a message file that should be previously loaded by call
23 -- to Message_MsgFile::LoadFile().
25 -- The text of the message can contain placeholders for the parameters
26 -- which are to be filled by the proper values when the message
27 -- is prepared. Most of the format specifiers used in C can be used,
28 -- for instance, %s for string, %d for integer etc. In addition,
29 -- specifier %f is supported for double numbers (for compatibility
30 -- with previous versions).
32 -- User fills the parameter fields in the text of the message by
33 -- calling corresponding methods Arg() or operators "<<".
35 -- The resulting message, filled with all parameters, can be obtained
36 -- by method Get(). If some parameters were not filled, the text
37 -- UNKNOWN is placed instead.
41 AsciiString from TCollection,
42 HAsciiString from TCollection,
43 ExtendedString from TCollection,
44 HExtendedString from TCollection,
45 SequenceOfInteger from TColStd
49 Create returns Msg from Message;
50 ---Purpose : Empty constructor
52 Create (theMsg: Msg from Message) returns Msg from Message;
53 ---Purpose : Copy constructor
55 Create (theKey: CString) returns Msg from Message;
56 ---Purpose : Create a message using a corresponding entry in Message_MsgFile
58 Create (theKey: ExtendedString from TCollection) returns Msg from Message;
59 ---Purpose : Create a message using a corresponding entry in Message_MsgFile
61 Set (me: in out; theMsg: CString);
62 ---Purpose : Set a message body text -- can be used as alternative to
63 -- using messages from resource file
65 Set (me: in out; theMsg: ExtendedString from TCollection);
66 ---Purpose : Set a message body text -- can be used as alternative to
67 -- using messages from resource file
71 Arg (me: in out; theString : CString)
72 returns Msg from Message;
74 ---C++: alias operator <<
75 ---Purpose : Set a value for %..s conversion
77 Arg (me: in out; theString : AsciiString from TCollection)
78 returns Msg from Message;
81 ---C++: alias operator <<
82 ---Purpose : Set a value for %..s conversion
84 Arg (me: in out; theString : HAsciiString from TCollection)
85 returns Msg from Message;
88 ---C++: alias operator <<
89 ---Purpose : Set a value for %..s conversion
91 Arg (me: in out; theString : ExtendedString from TCollection)
92 returns Msg from Message;
94 ---C++: alias operator <<
95 ---Purpose : Set a value for %..s conversion
97 Arg (me: in out; theString : HExtendedString from TCollection)
98 returns Msg from Message;
101 ---C++: alias operator <<
102 ---Purpose : Set a value for %..s conversion
104 Arg (me: in out; theInt : Integer)
105 returns Msg from Message;
107 ---C++: alias operator <<
108 ---Purpose : Set a value for %..d, %..i, %..o, %..u, %..x or %..X conversion
110 Arg (me: in out; theReal : Real)
111 returns Msg from Message;
113 ---C++: alias operator <<
114 ---Purpose : Set a value for %..f, %..e, %..E, %..g or %..G conversion
116 Original (me) returns ExtendedString from TCollection;
118 ---C++: return const &
119 ---Purpose : Returns the original message text
121 Value (me) returns ExtendedString from TCollection;
123 ---C++: return const &
124 ---Purpose : Returns current state of the message text with
125 -- parameters to the moment
127 IsEdited (me) returns Boolean;
129 ---Purpose : Tells if Value differs from Original
132 returns ExtendedString from TCollection;
133 ---C++: return const &
134 ---C++: alias "operator const TCollection_ExtendedString& () { return Get(); }"
135 ---Purpose : Return the resulting message string with all parameters
136 -- filled. If some parameters were not yet filled by calls
137 -- to methods Arg (or <<), these parameters are filled by
142 getFormat (me: in out; theType : Integer;
143 theFormat : in out AsciiString from TCollection)
144 returns Integer is private;
146 replaceText (me: in out; theFirst : Integer;
148 theStr : ExtendedString from TCollection) is private;
152 myOriginal : ExtendedString from TCollection;
153 myMessageBody : ExtendedString from TCollection;
154 mySeqOfFormats : SequenceOfInteger from TColStd;