b311480e |
1 | -- Created on: 1994-06-01 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class FloatFormat from StepSelect inherits FileModifier from StepSelect |
18 | |
19 | ---Purpose : This class gives control out format for floatting values : |
20 | -- ZeroSuppress or no, Main Format, Format in Range (for values |
21 | -- around 1.), as StepWriter allows to manage it. |
22 | -- Formats are given under C-printf form |
23 | |
24 | uses CString, AsciiString from TCollection, HSequenceOfInteger from TColStd, |
25 | CheckIterator, StepWriter , ContextWrite |
26 | |
27 | is |
28 | |
29 | Create returns mutable FloatFormat; |
30 | ---Purpose : Creates a new FloatFormat, with standard options : |
31 | -- ZeroSuppress, Main Format = %E, |
32 | -- Format between 0.001 and 1000. = %f |
33 | |
34 | SetDefault (me : mutable; digits : Integer = 0); |
35 | ---Purpose : Sets FloatFormat to default value (see Create) but if <digits> |
36 | -- is given positive, it commands Formats (main and range) to |
37 | -- ensure <digits> significant digits to be displayed |
38 | |
39 | SetZeroSuppress (me : mutable; mode : Boolean); |
40 | ---Purpose : Sets ZeroSuppress mode to a new value |
41 | |
42 | SetFormat (me : mutable; format : CString = "%E"); |
43 | ---Purpose : Sets Main Format to a new value |
44 | -- Remark : SetFormat, SetZeroSuppress and SetFormatForRange are |
45 | -- independant |
46 | |
47 | SetFormatForRange (me : mutable; format : CString = "%f"; |
48 | Rmin : Real = 0.1; Rmax : Real = 1000.0); |
49 | ---Purpose : Sets Format for Range to a new value with its range of |
50 | -- application. |
51 | -- To cancel it, give format as "" (empty string) |
52 | -- Remark that if the condition (0. < Rmin < Rmax) is not |
53 | -- verified, this secondary format will be ignored. |
54 | -- Moreover, this secondary format is intended to be used in a |
55 | -- range around 1. |
56 | |
57 | |
58 | Format (me; zerosup : out Boolean; |
59 | mainform : out AsciiString from TCollection; |
60 | hasrange : out Boolean; |
61 | forminrange : out AsciiString from TCollection; |
62 | rangemin, rangemax : out Real); |
63 | ---Purpose : Returns all recorded parameters : |
64 | -- zerosup : ZeroSuppress status |
65 | -- mainform : Main Format (which applies out of the range, or |
66 | -- for every real if no range is set) |
67 | -- hasrange : True if a FormatInRange is set, False else |
68 | -- (following parameters do not apply if it is False) |
69 | -- forminrange : Secondary Format (it applies inside the range) |
70 | -- rangemin, rangemax : the range in which the secondary format |
71 | -- applies |
72 | |
73 | |
74 | Perform (me; ctx : in out ContextWrite; |
75 | writer : in out StepWriter); |
76 | ---Purpose : Sets the Floatting Formats of StepWriter to the recorded |
77 | -- parameters |
78 | |
79 | Label (me) returns AsciiString from TCollection; |
80 | ---Purpose : Returns specific Label : for instance, |
81 | -- "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]" |
82 | |
83 | fields |
84 | |
85 | thezerosup : Boolean; |
86 | themainform : AsciiString from TCollection; |
87 | theformrange : AsciiString from TCollection; |
88 | therangemin : Real; |
89 | therangemax : Real; |
90 | |
91 | end FloatFormat; |
92 | |