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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
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>
26 IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedUnit,Units_Unit)
28 //=======================================================================
29 //function : Units_ShiftedUnit
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)
42 //=======================================================================
43 //function : Units_ShiftedUnit
45 //=======================================================================
47 Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname,
48 const Standard_CString asymbol)
49 : Units_Unit(aname,asymbol),
53 //=======================================================================
54 //function : Units_ShiftedUnit
56 //=======================================================================
58 Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname)
63 //=======================================================================
66 //=======================================================================
68 void Units_ShiftedUnit::Move(const Standard_Real amove)
73 //=======================================================================
76 //=======================================================================
78 Standard_Real Units_ShiftedUnit::Move() const
83 //=======================================================================
86 //=======================================================================
88 Handle(Units_Token) Units_ShiftedUnit::Token() const
90 TCollection_AsciiString string = SymbolsSequence()->Value(1)->String();
91 return new Units_ShiftedToken(string.ToCString()," ",Value(),themove,Quantity()->Dimensions());
94 //=======================================================================
97 //=======================================================================
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
104 Standard_Integer index;
105 TCollection_AsciiString string;
108 // for(i=0; i<ashift; i++)std::cout<<" ";
109 for(index=1;index<=thesymbolssequence->Length();index++)
111 string = thesymbolssequence->Value(index)->String();
112 if(index != 1) std::cout << " or " ;
113 std::cout<<"\""<<string.ToCString()<<"\"";
115 std::cout<< " Name: " <<Name().ToCString()<<" (= *" << thevalue << " SI + " << themove << ")"<<std::endl;