0031939: Coding - correction of spelling errors in comments [part 3]
[occt.git] / src / Units / Units_ShiftedUnit.cxx
1 // Created on: 1992-11-04
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <Standard_Type.hxx>
19 #include <TCollection_AsciiString.hxx>
20 #include <TColStd_HSequenceOfHAsciiString.hxx>
21 #include <Units_Quantity.hxx>
22 #include <Units_ShiftedToken.hxx>
23 #include <Units_ShiftedUnit.hxx>
24 #include <Units_Token.hxx>
25
26 IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedUnit,Units_Unit)
27
28 //=======================================================================
29 //function : Units_ShiftedUnit
30 //purpose  : 
31 //=======================================================================
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        themove(0.0)
51 {}
52
53 //=======================================================================
54 //function : Units_ShiftedUnit
55 //purpose  : 
56 //=======================================================================
57
58 Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname)
59      : Units_Unit(aname),
60        themove(0.0)
61 {}
62
63 //=======================================================================
64 //function : Move
65 //purpose  : 
66 //=======================================================================
67
68 void Units_ShiftedUnit::Move(const Standard_Real amove)
69 {
70   themove = amove;
71 }
72
73 //=======================================================================
74 //function : Move
75 //purpose  : 
76 //=======================================================================
77
78 Standard_Real Units_ShiftedUnit::Move() const
79 {
80   return themove;
81 }
82
83 //=======================================================================
84 //function : Token
85 //purpose  : 
86 //=======================================================================
87
88 Handle(Units_Token) Units_ShiftedUnit::Token() const
89 {
90   TCollection_AsciiString string = SymbolsSequence()->Value(1)->String();
91   return new Units_ShiftedToken(string.ToCString()," ",Value(),themove,Quantity()->Dimensions());
92 }
93
94 //=======================================================================
95 //function : Dump
96 //purpose  : 
97 //=======================================================================
98
99 //void Units_ShiftedUnit::Dump(const Standard_Integer ashift,
100 //                           const Standard_Integer alevel) const
101 void Units_ShiftedUnit::Dump(const Standard_Integer ,
102                              const Standard_Integer ) const
103 {
104   Standard_Integer index;
105   TCollection_AsciiString string;
106
107 //  int i;
108 //  for(i=0; i<ashift; i++)std::cout<<"  ";
109   for(index=1;index<=thesymbolssequence->Length();index++)
110     {
111       string = thesymbolssequence->Value(index)->String();
112       if(index != 1) std::cout << " or " ;
113       std::cout<<"\""<<string.ToCString()<<"\"";
114     }
115   std::cout<< "         Name:  " <<Name().ToCString()<<"                (= *" << thevalue << " SI + " << themove << ")"<<std::endl;
116 }
117