Warning, file /rolisteam/rolisteam/src/libraries/rwidgets/gmtoolbox/UnitConvertor/convertoroperator.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #include "convertoroperator.h"
0002 namespace GMTOOL
0003 {
0004     ConvertorOperator::ConvertorOperator(double a, double b, bool fraction, bool readOnly)
0005         : m_a(a), m_b(b), m_fraction(fraction), m_readOnly(readOnly)
0006     {
0007     }
0008 
0009     qreal ConvertorOperator::convert(qreal convert) const
0010     {
0011         if(m_fraction)
0012         {
0013             return (convert + m_b) / m_a;
0014         }
0015         return m_a * convert + m_b;
0016     }
0017 
0018     double ConvertorOperator::a() const { return m_a; }
0019 
0020     void ConvertorOperator::setA(double a)
0021     {
0022         if(m_readOnly)
0023             return;
0024         m_a= a;
0025     }
0026 
0027     bool ConvertorOperator::isReadOnly() const { return m_readOnly; }
0028 
0029     double ConvertorOperator::b() const { return m_b; }
0030 
0031     void ConvertorOperator::setB(double b)
0032     {
0033         if(m_readOnly)
0034             return;
0035         m_b= b;
0036     }
0037 
0038     bool ConvertorOperator::fraction() const { return m_fraction; }
0039 
0040     void ConvertorOperator::setFraction(bool fraction) { m_fraction= fraction; }
0041 
0042 } // namespace GMTOOL