Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

value.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           hbcivalue.h  -  description
00003                              -------------------
00004     begin                : Sat Aug 4 2001
00005     copyright            : (C) 2001 by fabian kaiser
00006     email                : fabian.kaiser@gmx.de
00007 
00008  ***************************************************************************
00009  *                                                                         *
00010  *   This library is free software; you can redistribute it and/or         *
00011  *   modify it under the terms of the GNU Lesser General Public            *
00012  *   License as published by the Free Software Foundation; either          *
00013  *   version 2.1 of the License, or (at your option) any later version.    *
00014  *                                                                         *
00015  *   This library is distributed in the hope that it will be useful,       *
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00018  *   Lesser General Public License for more details.                       *
00019  *                                                                         *
00020  *   You should have received a copy of the GNU Lesser General Public      *
00021  *   License along with this library; if not, write to the Free Software   *
00022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00023  *   MA  02111-1307  USA                                                   *
00024  *                                                                         *
00025  ***************************************************************************/
00026 
00027 
00028 #ifndef HBCIVALUE_H
00029 #define HBCIVALUE_H
00030 
00035 #ifdef __cplusplus
00036 #include <string>
00037 
00038 using namespace std;
00039 
00040 namespace HBCI {
00041 
00046 class DLLIMPORT Value {
00047 public:
00060     Value();
00061 
00068     Value(double value, const string &currency);
00069 
00113     Value(const string &strvalue);
00114 
00121     bool isValid() const { return _isvalid; };
00122 
00127     double getValue() const { return _value;};
00128 
00133     const string& getCurrency() const { return _currency;};
00134 
00142     string toString() const;
00143 
00150     string toReadableString() const;
00151 
00169     static unsigned int currencyPrecision(const string& c);
00170 
00171 private:
00175     double _value;
00176 
00179     string _currency;
00180 
00181     bool _isvalid;
00182 };
00183 
00189 inline bool operator<(const Value &v1, const Value &v2) {
00190     return v1.getValue()<v2.getValue();
00191 }
00192 
00198 inline bool operator>(const Value &v1, const Value &v2) {
00199     return v1.getValue()>v2.getValue();
00200 }
00201 
00202 
00205 inline bool operator==(const Value &v1, const Value &v2) {
00206     return (v1.getCurrency()==v2.getCurrency()) && 
00207         (v1.getValue()==v2.getValue());
00208 }
00209 
00210 } /* namespace HBCI */
00211 typedef struct HBCI::Value HBCI_Value;
00212 
00213 #else /* __cplusplus */
00214 typedef struct HBCI_Value HBCI_Value;
00215 #endif /* __cplusplus */
00216 
00217 
00218 #ifdef __cplusplus
00219 extern "C" {
00220 #endif
00221 
00227     extern HBCI_Value *HBCI_Value_new_double(double value, 
00228                                              const char *currency);
00234     extern int HBCI_Value_isValid(const HBCI_Value *v);
00239     extern double HBCI_Value_getValue(const HBCI_Value *v);
00245     extern const char* HBCI_Value_getCurrency(const HBCI_Value *v);
00254     extern char* HBCI_Value_toReadableString(const HBCI_Value *v);
00255 
00256 #ifdef __cplusplus
00257 }
00258 #endif
00259 
00260 #endif

Generated on Mon Jun 23 13:41:07 2003 for openhbci by doxygen1.2.17