e37b4da06e
git-svn-id: svn://10.65.10.50/trunk@3867 c028cbd2-c16b-5b4b-a496-9718f37d4682
93 lines
3.6 KiB
C++
Executable File
93 lines
3.6 KiB
C++
Executable File
#ifndef __RELATION_H
|
|
#include <relation.h>
|
|
#endif
|
|
|
|
class TEffetto;
|
|
|
|
/////////////////////////////////////////////////
|
|
// classe per gestire le righe di un effetto
|
|
////////////////////////////////////////////////
|
|
class TRiga_effetto : public TRectype
|
|
{
|
|
TEffetto * _eff;
|
|
protected:
|
|
TObject* dup() const // duplica l'oggetto corrente
|
|
{ return new TRiga_effetto(*this); }
|
|
public:
|
|
int numeror() const // restituisce il numero della riga
|
|
{ return get_int("NRIGATR");}
|
|
void set_numeror(int numero) // setta il valore del numero di riga con quello passato
|
|
{ put("NRIGATR", numero);}
|
|
void set_eff(TEffetto * eff) // setta l'effetto con quello passato
|
|
{ _eff = eff; }
|
|
const TEffetto & eff() const
|
|
{ CHECK(_eff, "Effetto nullo"); return *_eff;}
|
|
TRiga_effetto(TEffetto* eff);
|
|
TRiga_effetto(const TRiga_effetto& rec, TEffetto* eff);
|
|
virtual ~TRiga_effetto() {}
|
|
};
|
|
|
|
/////////////////////////////////////////////////
|
|
// classe per gestire gli effetti
|
|
////////////////////////////////////////////////
|
|
class TEffetto:public TRectype
|
|
{
|
|
TRecord_array _righe,_cess;
|
|
protected:
|
|
|
|
long get_next_key(const long codcf) const; // ritorna la prossima chiave
|
|
|
|
public:
|
|
long renum(long numeff = 0); // rinumera le chiavi
|
|
|
|
const TRectype& head() const
|
|
{ return *this; } // Ritorna la testata dell'effetto
|
|
TRectype& head()
|
|
{ return *this; }
|
|
|
|
TRecord_array& righe() {return _righe;}
|
|
TRecord_array& cess() {return _cess;}
|
|
TRectype& row_c(int i, bool create=FALSE)
|
|
{ return _cess.row(i,create); } // ritorna la riga i dei cessionari
|
|
TRectype& row_r(int i, bool create=FALSE)
|
|
{ return _righe.row(i,create); } // ritorna la riga i delle righe
|
|
|
|
int rows_r() const // ritorna il numero delle righe presenti
|
|
{ return _righe.rows(); } // nelle righe effetto
|
|
int rows_c() const // ritorna il numero delle righe presenti
|
|
{ return _cess.rows(); } // nei cessionari
|
|
|
|
bool destroy_row_r(int n, bool pack = FALSE) // elimina l'elemento riga nella posizione n
|
|
{ return _righe.destroy_row(n, pack); } // nelle righe effetto
|
|
void destroy_rows_r() // elimina tutti gli elementi riga
|
|
{ _righe.destroy_rows(); } // nelle righe effetto
|
|
|
|
bool destroy_row_c(int n, bool pack = FALSE) // elimina l'elemento riga nella posizione n
|
|
{ return _cess.destroy_row(n, pack); } // nei cessionari
|
|
void destroy_rows_c() // elimina tutti gli elementi riga
|
|
{ _cess.destroy_rows(); } // nei cessionari
|
|
int read(const TRectype& rec);
|
|
int read(char tipodist, long ndist, long nrigadist);
|
|
int write(bool force=FALSE);
|
|
int rewrite()
|
|
{ return write(TRUE); }
|
|
int remove()const;
|
|
long numero() const // metodi per ritornare i campi chiave
|
|
{ return get_long("NPROGTR"); } // del file EFFETTI
|
|
long codicec() const
|
|
{ return get_long("CODCF"); }
|
|
TDate datasc() const
|
|
{ return get_date("DATASCAD"); }
|
|
char tipodist() const
|
|
{ return get_char("TIPODIST"); }
|
|
long ndist() const
|
|
{ return get_long("NDIST"); }
|
|
long nrgdist() const
|
|
{ return get_long("NRIGADIST"); }
|
|
void set_key4(TRectype& rec,char tipodist, long ndist, long nrigadist); //setta i campi per la quarta chiave del file
|
|
void set_key(TRectype& rec,long numeff) const; //setta i campi per la chiave
|
|
TEffetto();
|
|
TEffetto(TRectype& rec);
|
|
virtual ~TEffetto() {}
|
|
};
|