Merge pull request #2985 from jhsrennie/osx-cmd
[vuplus_xbmc] / xbmc / Temperature.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "utils/Archive.h"
23
24 class CTemperature : public IArchivable
25 {
26 public:
27   CTemperature();
28   CTemperature(const CTemperature& temperature);
29
30   static CTemperature CreateFromFahrenheit(double value);
31   static CTemperature CreateFromKelvin(double value);
32   static CTemperature CreateFromCelsius(double value);
33   static CTemperature CreateFromReaumur(double value);
34   static CTemperature CreateFromRankine(double value);
35   static CTemperature CreateFromRomer(double value);
36   static CTemperature CreateFromDelisle(double value);
37   static CTemperature CreateFromNewton(double value);
38
39   bool operator >(const CTemperature& right) const;
40   bool operator >=(const CTemperature& right) const;
41   bool operator <(const CTemperature& right) const;
42   bool operator <=(const CTemperature& right) const;
43   bool operator ==(const CTemperature& right) const;
44   bool operator !=(const CTemperature& right) const;
45
46   const CTemperature& operator =(const CTemperature& right);
47   const CTemperature& operator +=(const CTemperature& right);
48   const CTemperature& operator -=(const CTemperature& right);
49   const CTemperature& operator *=(const CTemperature& right);
50   const CTemperature& operator /=(const CTemperature& right);
51   CTemperature operator +(const CTemperature& right) const;
52   CTemperature operator -(const CTemperature& right) const;
53   CTemperature operator *(const CTemperature& right) const;
54   CTemperature operator /(const CTemperature& right) const;
55
56   bool operator >(double right) const;
57   bool operator >=(double right) const;
58   bool operator <(double right) const;
59   bool operator <=(double right) const;
60   bool operator ==(double right) const;
61   bool operator !=(double right) const;
62
63   const CTemperature& operator +=(double right);
64   const CTemperature& operator -=(double right);
65   const CTemperature& operator *=(double right);
66   const CTemperature& operator /=(double right);
67   CTemperature operator +(double right) const;
68   CTemperature operator -(double right) const;
69   CTemperature operator *(double right) const;
70   CTemperature operator /(double right) const;
71
72   CTemperature& operator ++();
73   CTemperature& operator --();
74   CTemperature operator ++(int);
75   CTemperature operator --(int);
76
77   virtual void Archive(CArchive& ar);
78
79   typedef enum _STATE
80   {
81     invalid=0,
82     valid
83   } STATE;
84
85   void SetState(CTemperature::STATE state);
86   bool IsValid() const;
87
88   double ToFahrenheit() const;
89   double ToKelvin() const;
90   double ToCelsius() const;
91   double ToReaumur() const;
92   double ToRankine() const;
93   double ToRomer() const;
94   double ToDelisle() const;
95   double ToNewton() const;
96
97   double ToLocale() const;
98   CStdString ToString() const;
99
100 protected:
101   CTemperature(double value);
102
103 protected:
104   double m_value; // we store as fahrenheit
105   STATE m_state;
106 };
107