0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / Units / Units_ShiftedUnit.cxx
CommitLineData
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 26IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedUnit,Units_Unit)
27
7fd59977 28//=======================================================================
29//function : Units_ShiftedUnit
30//purpose :
31//=======================================================================
7fd59977 32Units_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
47Units_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
57Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname)
58 : Units_Unit(aname)
59{}
60
61//=======================================================================
62//function : Move
63//purpose :
64//=======================================================================
65
66void Units_ShiftedUnit::Move(const Standard_Real amove)
67{
68 themove = amove;
69}
70
71//=======================================================================
72//function : Move
73//purpose :
74//=======================================================================
75
76Standard_Real Units_ShiftedUnit::Move() const
77{
78 return themove;
79}
80
81//=======================================================================
82//function : Token
83//purpose :
84//=======================================================================
85
86Handle(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
99void Units_ShiftedUnit::Dump(const Standard_Integer ,
100 const Standard_Integer ) const
101{
102 Standard_Integer index;
103 TCollection_AsciiString string;
104
105// int i;
106// for(i=0; i<ashift; i++)cout<<" ";
107 for(index=1;index<=thesymbolssequence->Length();index++)
108 {
109 string = thesymbolssequence->Value(index)->String();
110 if(index != 1) cout << " or " ;
111 cout<<"\""<<string.ToCString()<<"\"";
112 }
113 cout<< " Name: " <<Name().ToCString()<<" (= *" << thevalue << " SI + " << themove << ")"<<endl;
114}
115