Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

rtkmoney.h

00001 /*<<<<<COPYRIGHT*/
00002 /*
00003  * RTK The report toolkit
00004  * Copyright (C) 2003 Francisco Santiago Capel Torres
00005 
00006  * rtkmoney.h Class to handle currency amounts
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  */
00019 /*>>>>>COPYRIGHT*/
00020 
00021 #ifndef RTKMONEY_H
00022 #define RTKMONEY_H
00023 
00024 
00029 #include <qstring.h>
00030 
00031 namespace RTK
00032 {
00033 
00034 class Money
00035 {
00036 public:
00037         Money(short int ndecimals =2);
00038         Money(long long amount, short int ndecimals =2);
00039         Money(long amount, short int ndecimals =2);
00040         Money(double amount, short int ndecimals =2);
00041                 
00042         QString toString() const;
00043         int toInt() const;
00044         double toDouble() const;
00045         long long toLong() const;
00046 
00047         bool operator==( const Money& other) const;
00048         bool operator!=( const Money& other) const;
00049         bool operator<( const Money& other) const;
00050         bool operator<=( const Money& other) const;
00051         bool operator>( const Money& other) const;
00052         bool operator>=( const Money& other) const;
00053         Money &operator+=( const Money& other);
00054         Money operator+( const Money& other) const;
00055         Money operator-( const Money& other) const;
00056         Money operator*( const Money& other) const;
00057         Money operator/( const Money& other) const;
00058 
00059 private:
00060         long long mAmount;
00061                 int mCentFactor;
00062         long long getAmount() const;
00063 };
00064 
00065 }; // namespace
00066 
00067 #endif

Generated on Tue Feb 22 14:44:37 2005 for RTK. Report ToolKit by  doxygen 1.3.9.1