b311480e |
1 | // Created on: 1992-11-04 |
2 | // Created by: Gilles DEBARBOUILLE |
3 | // Copyright (c) 1992-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 | |
42cf5bc1 |
17 | |
18 | #include <Standard_Type.hxx> |
7fd59977 |
19 | #include <TCollection_AsciiString.hxx> |
20 | #include <TColStd_HSequenceOfHAsciiString.hxx> |
42cf5bc1 |
21 | #include <Units_Quantity.hxx> |
22 | #include <Units_ShiftedToken.hxx> |
23 | #include <Units_ShiftedUnit.hxx> |
24 | #include <Units_Token.hxx> |
7fd59977 |
25 | |
92efcf78 |
26 | IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedUnit,Units_Unit) |
27 | |
7fd59977 |
28 | //======================================================================= |
29 | //function : Units_ShiftedUnit |
30 | //purpose : |
31 | //======================================================================= |
7fd59977 |
32 | Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname, |
33 | const Standard_CString asymbol, |
34 | const Standard_Real avalue, |
35 | const Standard_Real amove, |
36 | const Handle(Units_Quantity)& aquantity) |
37 | : Units_Unit(aname,asymbol,avalue,aquantity) |
38 | { |
39 | themove = amove; |
40 | } |
41 | |
42 | //======================================================================= |
43 | //function : Units_ShiftedUnit |
44 | //purpose : |
45 | //======================================================================= |
46 | |
47 | Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname, |
48 | const Standard_CString asymbol) |
49 | : Units_Unit(aname,asymbol) |
50 | {} |
51 | |
52 | //======================================================================= |
53 | //function : Units_ShiftedUnit |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname) |
58 | : Units_Unit(aname) |
59 | {} |
60 | |
61 | //======================================================================= |
62 | //function : Move |
63 | //purpose : |
64 | //======================================================================= |
65 | |
66 | void Units_ShiftedUnit::Move(const Standard_Real amove) |
67 | { |
68 | themove = amove; |
69 | } |
70 | |
71 | //======================================================================= |
72 | //function : Move |
73 | //purpose : |
74 | //======================================================================= |
75 | |
76 | Standard_Real Units_ShiftedUnit::Move() const |
77 | { |
78 | return themove; |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : Token |
83 | //purpose : |
84 | //======================================================================= |
85 | |
86 | Handle(Units_Token) Units_ShiftedUnit::Token() const |
87 | { |
88 | TCollection_AsciiString string = SymbolsSequence()->Value(1)->String(); |
89 | return new Units_ShiftedToken(string.ToCString()," ",Value(),themove,Quantity()->Dimensions()); |
90 | } |
91 | |
92 | //======================================================================= |
93 | //function : Dump |
94 | //purpose : |
95 | //======================================================================= |
96 | |
97 | //void Units_ShiftedUnit::Dump(const Standard_Integer ashift, |
98 | // const Standard_Integer alevel) const |
99 | void Units_ShiftedUnit::Dump(const Standard_Integer , |
100 | const Standard_Integer ) const |
101 | { |
102 | Standard_Integer index; |
103 | TCollection_AsciiString string; |
104 | |
105 | // int i; |
04232180 |
106 | // for(i=0; i<ashift; i++)std::cout<<" "; |
7fd59977 |
107 | for(index=1;index<=thesymbolssequence->Length();index++) |
108 | { |
109 | string = thesymbolssequence->Value(index)->String(); |
04232180 |
110 | if(index != 1) std::cout << " or " ; |
111 | std::cout<<"\""<<string.ToCString()<<"\""; |
7fd59977 |
112 | } |
04232180 |
113 | std::cout<< " Name: " <<Name().ToCString()<<" (= *" << thevalue << " SI + " << themove << ")"<<std::endl; |
7fd59977 |
114 | } |
115 | |