From 29cfcac9e8780cdaee327dede6b9648128559e54 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 20 Jul 1998 13:15:59 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : real.* Aggiunto real::print_on e segnalato /= ZERO recarray.* Corretta gestione cambio ditta git-svn-id: svn://10.65.10.50/trunk@6853 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/real.cpp | 6 ++++++ include/real.h | 10 ++++++++++ include/recarray.cpp | 25 +++++++++++++++---------- include/recarray.h | 13 ++++++++----- include/relapp.cpp | 5 +++-- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/include/real.cpp b/include/real.cpp index 6ebe66b49..e9c1ecc50 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -83,6 +83,7 @@ real& real::operator *= (long double b) real& real::operator /= (long double b) { + CHECK(b != 0.0, "Disivision by zero"); _dec /= b; return *this; } @@ -1513,6 +1514,11 @@ char *real ::stringa (int len, int dec, char pad) const return __string; } +void real::print_on(ostream& out) const +{ + out << string(); +} + /////////////////////////////////////////////////////////// // Distrib // Oggetto per dividere un real in varie sue percentuali diff --git a/include/real.h b/include/real.h index ef3ef4660..b40be0583 100755 --- a/include/real.h +++ b/include/real.h @@ -24,6 +24,11 @@ class real : public TObject // @cmember:(INTERNAL) Numero reale long double _dec; + // @access Protected Member +protected: + // @cmember Permette di stampare l'oggetto + virtual void print_on(ostream& out) const; + // @access Protected Member protected: // @cmember Duplica il numero reale (vedi classe ) @@ -152,6 +157,11 @@ class real : public TObject // @cmember:(INTERNAL) Numero reale DEC _dec; + // @access Protected Member +protected: + // @cmember Permette di stampare l'oggetto + virtual void print_on(ostream& out) const; + // @access Protected Member protected: diff --git a/include/recarray.cpp b/include/recarray.cpp index 9dd28cdaf..c09dac084 100755 --- a/include/recarray.cpp +++ b/include/recarray.cpp @@ -32,7 +32,8 @@ void TRecord_array::set_key(TRectype* r) CHECK(r != NULL, "TRecord_array can't have a null key"); CHECK(r->num() == _file, "Bad key record"); - _data.add(r, 0); // Setta il nuovo campo chiave + if (_data.objptr(0) != r) + _data.add(r, 0); // Setta il nuovo campo chiave if (rows() > 0) { const RecDes* recd = r->rec_des(); // Descrizione del record della testata @@ -172,7 +173,7 @@ void TRecord_array::pack() { _data.pack(); - for (int i = _data.size()-1; i > 0; i--) + for (int i = _data.last(); i > 0; i--) { TRectype* r = (TRectype*)_data.objptr(i); if (r != NULL) @@ -402,20 +403,20 @@ int TRecord_array::remove() const TFile_cache::TFile_cache(TLocalisamfile *f , int key) : _file(NULL), _key(key) { - _code << f->num(); + _filecode << f->num(); init_file(f); } TFile_cache::TFile_cache(int num, int key) : _file(NULL), _key(key), _last_firm(-883) { - _code << num; + _filecode << num; } TFile_cache::TFile_cache(const char* tab, int key) : _file(NULL), _key(key), _last_firm(-883) { - _code = tab; + _filecode = tab; } TFile_cache::~TFile_cache() @@ -431,10 +432,10 @@ void TFile_cache::init_file(TLocalisamfile* f) if (f == NULL) { - int logicnum = atoi(_code); + int logicnum = atoi(_filecode); if (logicnum == 0) { - _file = new TTable(_code); + _file = new TTable(_filecode); logicnum = _file->num(); } else @@ -448,7 +449,7 @@ void TFile_cache::init_file(TLocalisamfile* f) if (_file != NULL) { TDir dir; - dir.get(_file->num()); + dir.get(_file->num(), _nolock, _nordir, _sysdirop); // Se e' un file comune metti a -1, altrimenti alla ditta corrente _last_firm = dir.is_com() ? -1 : prefix().get_codditta(); } @@ -523,12 +524,11 @@ int TFile_cache::io_result() return _error; } -int TFile_cache::fill() +long TFile_cache::fill() { test_firm(); TLocalisamfile& f = file(); - TRectype& curr = f.curr(); const RecDes* recd = curr.rec_des(); // Descrizione del record della testata const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave @@ -552,6 +552,11 @@ int TFile_cache::fill() return _cache.items(); } + +void TFile_cache::destroy() +{ + _cache.destroy(); +} TLocalisamfile& TFile_cache::file() { diff --git a/include/recarray.h b/include/recarray.h index c4da4b647..abcb19e08 100755 --- a/include/recarray.h +++ b/include/recarray.h @@ -144,8 +144,8 @@ public: class TFile_cache : public TObject { - TToken_string _code; + TString16 _filecode; TLocalisamfile* _file; int _key; long _last_firm; @@ -165,10 +165,13 @@ protected: public: int io_result(); const int key_number() const - {return _key;} - long items() - {return _cache.items();} - int fill(); + { return _key; } + + long items() const + { return _cache.items(); } + + long fill(); + void destroy(); TFile_cache(TLocalisamfile *f,int key = 1); TFile_cache(int num, int key = 1); diff --git a/include/relapp.cpp b/include/relapp.cpp index c0667adbc..4fe5d3c59 100755 --- a/include/relapp.cpp +++ b/include/relapp.cpp @@ -767,11 +767,12 @@ int TRelation_application::write(const TMask& m) const int max = m.fields(); for (int i = 0; i < max; i++) { - if (m.fld(i).is_sheet()) { + if (m.fld(i).is_sheet()) + { TSheet_field& f = (TSheet_field& )m.fld(i); if (f.record() && !f.external_record()) err|=f.record()->write(FALSE); - } + } } return err; }