Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / tools / assoc_mem / value.h
blob96f0fed46c59469c4ebd1b04a99b81ac74f3dbb6
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef NL_VALUE_H_
18 #define NL_VALUE_H_
20 #include <string>
22 class IValue {
23 public:
24 virtual ~IValue() { }
26 virtual void getValue(IValue &) = 0;
27 virtual void setValue(IValue &) = 0;
29 virtual bool operator==(IValue *) const = 0 ;
30 virtual bool operator<(IValue &) = 0;
31 virtual bool operator>(IValue &) = 0;
34 template<class T> class CValue : public IValue {
35 private:
36 T _Value;
37 public:
38 CValue();
39 CValue(T);
40 CValue(const CValue<T> &);
41 virtual void getValue(IValue &);
42 virtual void setValue(IValue &);
44 // virtual CValue<T> &operator=(T);
46 virtual bool operator==(IValue *) const;
47 bool operator<(IValue &);
48 bool operator>(IValue &);
50 virtual T getValue();
51 virtual void setValue(T);
54 template<class T> CValue<T>::CValue()
58 template<class T> CValue<T>::CValue(T value)
60 _Value = value;
63 template<class T> CValue<T>::CValue(const CValue<T> &value)
65 _Value = value.getValue();
68 template<class T> void CValue<T>::getValue(IValue &value)
70 ( (CValue<T> &)value)._Value = _Value;
73 template<class T> void CValue<T>::setValue(IValue &value)
75 _Value = ( ( (CValue<T> &)value ).getValue() );
78 template<class T> bool CValue<T>::operator==(IValue *value) const
80 return ( _Value == ( ( (CValue<T> *)value )->getValue() ) );
83 template<class T> bool CValue<T>::operator<(IValue &value)
85 if ( _Value < ( ( (CValue<T> &)value ).getValue() ) )
86 return true;
87 else
88 return false;
91 template<class T> bool CValue<T>::operator>(IValue &value)
93 if ( _Value > ( ( (CValue<T> &)value ).getValue() ) )
94 return true;
95 else
96 return false;
99 template<class T> void CValue<T>::setValue(T value)
101 _Value = value;
104 template<class T> T CValue<T>::getValue()
106 return _Value;
109 #endif