Fix keymap.
[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 <string>
23 #include "utils/Archive.h"
24
25 class CTemperature : public IArchivable
26 {
27 public:
28   CTemperature();
29   CTemperature(const CTemperature& temperature);
30
31   static CTemperature CreateFromFahrenheit(double value);
32   static CTemperature CreateFromKelvin(double value);
33   static CTemperature CreateFromCelsius(double value);
34   static CTemperature CreateFromReaumur(double value);
35   static CTemperature CreateFromRankine(double value);
36   static CTemperature CreateFromRomer(double value);
37   static CTemperature CreateFromDelisle(double value);
38   static CTemperature CreateFromNewton(double value);
39
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   bool operator !=(const CTemperature& right) const;
46
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   const CTemperature& operator /=(const CTemperature& right);
52   CTemperature operator +(const CTemperature& right) const;
53   CTemperature operator -(const CTemperature& right) const;
54   CTemperature operator *(const CTemperature& right) const;
55   CTemperature operator /(const CTemperature& right) const;
56
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   bool operator !=(double right) const;
63
64   const CTemperature& operator +=(double right);
65   const CTemperature& operator -=(double right);
66   const CTemperature& operator *=(double right);
67   const CTemperature& operator /=(double right);
68   CTemperature operator +(double right) const;
69   CTemperature operator -(double right) const;
70   CTemperature operator *(double right) const;
71   CTemperature operator /(double right) const;
72
73   CTemperature& operator ++();
74   CTemperature& operator --();
75   CTemperature operator ++(int);
76   CTemperature operator --(int);
77
78   virtual void Archive(CArchive& ar);
79
80   typedef enum _STATE
81   {
82     invalid=0,
83     valid
84   } STATE;
85
86   void SetState(CTemperature::STATE state);
87   bool IsValid() const;
88
89   double ToFahrenheit() const;
90   double ToKelvin() const;
91   double ToCelsius() const;
92   double ToReaumur() const;
93   double ToRankine() const;
94   double ToRomer() const;
95   double ToDelisle() const;
96   double ToNewton() const;
97
98   double ToLocale() const;
99   std::string ToString() const;
100
101 protected:
102   CTemperature(double value);
103
104 protected:
105   double m_value; // we store as fahrenheit
106   STATE m_state;
107 };
108