00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef LIBLOOKDB_LKMONEY_H
00019 #define LIBLOOKDB_LKMONEY_H
00020
00021
00022
00023 #include "looktypes.h"
00024 #include "lktypebase.h"
00025
00026 #include "lkstring.h"
00027
00028 namespace look {
00029
00030
00031
00032
00033
00034 class LookFloat;
00035 class LookInteger;
00036
00038
00048 class LOOKTYPES_DLL LookMoney : public LookTypeBase
00049 {
00050 public:
00051
00052
00053
00054 LookMoney( long thePence = 0 );
00055
00056
00057 ~LookMoney( void );
00058
00059
00060 LookMoney( const LookMoney &theOther );
00061
00062
00063 LookMoney& operator=( const LookMoney &theOther );
00064 LookMoney& operator=( long thePence );
00065
00066
00067 operator long( void ) const;
00068
00069
00070 LookTypeBase* GetNewCopy( void ) const;
00071
00072
00073 long GetTypeID( void ) const;
00074
00075
00076 void SetPence( long thePence );
00077 long GetPence( void ) const;
00078
00079
00080 void SetPence( double thePence );
00081
00082
00083
00084
00085 void SetPounds( double thePounds );
00086 double GetPounds( void ) const;
00087
00088
00089 bool Set( const LookString& theString );
00090 LookString GetSimpleString( void ) const;
00091 LookString GetFullString( void ) const;
00092
00093
00094 bool operator==(const LookMoney &theValue) const;
00095 bool operator!=(const LookMoney &theValue) const;
00096 bool operator<=(const LookMoney &theValue) const;
00097 bool operator>=(const LookMoney &theValue) const;
00098 bool operator<(const LookMoney &theValue) const;
00099 bool operator>(const LookMoney &theValue) const;
00100
00101
00102 LookMoney operator+(const LookMoney &theValue) const;
00103 LookMoney& operator+=(const LookMoney &theValue);
00104
00105 LookMoney operator-(const LookMoney &theValue) const;
00106 LookMoney& operator-=(const LookMoney &theValue);
00107
00108
00109
00110 LookMoney operator*(const LookInteger& theMultiplier) const;
00111 LookMoney& operator*=(const LookInteger& theMultiplier);
00112
00113 LookMoney operator*(const LookFloat& theMultiplier) const;
00114 LookMoney& operator*=(const LookFloat& theMultiplier);
00115
00116
00117
00119
00130 enum RoundingScheme
00131 {
00132 Nearest = 0,
00133 TowardsZero,
00134 AwayFromZero,
00135 Up,
00136 Down
00137 };
00138
00140 static RoundingScheme GetRoundingScheme( void );
00142 static void SetRoundingScheme( RoundingScheme theRoundingScheme );
00143
00144 protected:
00145
00146
00148 long itsPence;
00149
00151
00157 static RoundingScheme itsRoundingScheme;
00158
00159 };
00160
00161
00162 }
00163 #endif