Files correlati : Ricompilazione Demo : [ ] Commento : array.cpp Migliorata gestione [] quando non c'e' l'oggetto desiderato classes.h Aggiunta CLASS_CURRENCY_FIELD config.* Aggiunto metodo for_each_paragraph controls.cpp BOOLEAN trasformati in bool currency.* Reimplementati completamente i TCurrency date.* Migliorati operatori aritmetici sulle date default.url Modificati identificatori per gestire popup degli sheet isam.* Aggiunta gestione flag di modifica e ridotto uso __isam_string mask.* Reso pubblico il costruttore vuoto e read_mask Aggiunta gestione TCurrency_field maskfld.* Aggiornati TCurrency_field msksheet.cpp Usata read_mask per leggere la maschera degli sheet multirec.cpp Eliminato memory_leak causato da _fiels.remove prefix.cpp Riga vuota progind.cpp Corretto aggiornamento in assenza di barra rdoc.h Aggiunti campi IMPIANTO e LINEA real.cpp Allungata stringa fissa di lavoro da 24 a 64 relapp.cpp Migliorata gestione /I relation.cpp Corretta gestione indici dei cursori strings.cpp Corretto << dei TObject tabutil.* Eliminato uso TRecfield erratissimo varmask.* Aggiunto costruttore vuoto viswin.cpp Ridotta frequenza di update dell'icona in basso a sinistra window.cpp Corretto disegno in modo _pixmap xvtility.cpp Allungata stringa per status_bar git-svn-id: svn://10.65.10.50/trunk@7391 c028cbd2-c16b-5b4b-a496-9718f37d4682
79 lines
2.5 KiB
C++
Executable File
79 lines
2.5 KiB
C++
Executable File
#ifndef __CURRENCY_H
|
|
#define __CURRENCY_H
|
|
|
|
#ifndef __REAL_H
|
|
#include <real.h>
|
|
#endif
|
|
|
|
#ifndef __RECTYPES_H
|
|
class TRectype;
|
|
#endif
|
|
|
|
class TCurrency : public TSortable
|
|
{
|
|
real _num; // Valore assoluto
|
|
char _val[4]; // Codice valuta
|
|
real _exchange; // Cambio personalizzato
|
|
bool _price;
|
|
|
|
protected:
|
|
virtual int compare(const TSortable& s) const;
|
|
void copy(const TCurrency& cur);
|
|
|
|
public:
|
|
static const TString& get_base_val();
|
|
static const TString& get_firm_val();
|
|
static int get_base_dec(bool price = FALSE);
|
|
static int get_firm_dec(bool price = FALSE);
|
|
|
|
void set_price(bool p) { _price = p; }
|
|
bool is_price() const { return _price; }
|
|
|
|
void force_value(const char* newval, const real& newchange = ZERO);
|
|
void change_value(const char* newval, const real& newchange = ZERO);
|
|
void change_to_base_val() { change_value(get_base_val()); }
|
|
void change_to_firm_val() { change_value(get_firm_val()); }
|
|
|
|
const char* get_value() const { return _val; }
|
|
bool is_base_value() const;
|
|
bool same_value_as(const TCurrency& cur) const;
|
|
|
|
void set_num(const real& num) { _num = num; }
|
|
const real& get_num() const { return _num; }
|
|
|
|
const TCurrency& operator=(const TCurrency& cur) { copy(cur); return *this; }
|
|
|
|
TCurrency& operator += (const TCurrency& num);
|
|
TCurrency operator - (const TCurrency& num) const;
|
|
TCurrency& operator -= (const TCurrency& num);
|
|
TCurrency operator + (const TCurrency& num) const;
|
|
TCurrency& operator *= (const real& num);
|
|
TCurrency operator * (const real& num) const;
|
|
TCurrency& operator /= (const real& num);
|
|
TCurrency operator / (const real& num) const;
|
|
|
|
const char* string(bool dotted = FALSE) const;
|
|
void read(const TRectype& rec, const char* field, const char *val = NULL, const char *exchange = NULL);
|
|
void write(TRectype& rec, const char* field, const char *val = NULL, const char *exchange = NULL, bool forceval = FALSE) const;
|
|
int decimals() const;
|
|
|
|
TCurrency(bool price = FALSE) : _price(price) { _val[0] = '\0'; }
|
|
TCurrency(const TCurrency& cur) { copy(cur); }
|
|
TCurrency(const real& num, const char* val = "", const real& exchg = ZERO, bool price = FALSE);
|
|
virtual ~TCurrency() { }
|
|
};
|
|
|
|
class TPrice : public TCurrency
|
|
{
|
|
public:
|
|
const TPrice& operator=(const TPrice& cur) { copy(cur); return *this; }
|
|
|
|
TPrice() : TCurrency(TRUE) { }
|
|
TPrice(const TPrice& price) { copy(price); }
|
|
TPrice(const real& num, const char* val = "", const real& exc = ZERO)
|
|
: TCurrency(num, val, exc, TRUE) { }
|
|
virtual ~TPrice() { }
|
|
};
|
|
|
|
#endif
|