1997-06-12 16:26:22 +00:00
|
|
|
#include "clifor.h"
|
|
|
|
|
|
|
|
TOccasionale::TOccasionale() : TRectype(LF_OCCAS)
|
1999-04-06 15:34:39 +00:00
|
|
|
{ }
|
1997-06-12 16:26:22 +00:00
|
|
|
TOccasionale::TOccasionale(const TRectype& r) : TRectype(r)
|
1999-04-06 15:34:39 +00:00
|
|
|
{ }
|
1997-06-12 16:26:22 +00:00
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
TOccasionale::TOccasionale(const TOccasionale& r) : TRectype(r)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TRectype& TOccasionale::operator=(const TRectype& r)
|
1997-06-12 16:26:22 +00:00
|
|
|
{
|
|
|
|
return TRectype::operator=(r);
|
|
|
|
}
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
TOccasionale& TOccasionale::operator=(const TOccasionale& r)
|
|
|
|
{
|
|
|
|
TRectype::operator=(r);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
1997-06-12 16:26:22 +00:00
|
|
|
TOccasionale::~TOccasionale()
|
1999-04-06 15:34:39 +00:00
|
|
|
{ }
|
1997-06-12 16:26:22 +00:00
|
|
|
|
|
|
|
int TCli_for::write_rewrite(TBaseisamfile& f, bool re) const
|
|
|
|
{
|
|
|
|
int err = TMultiple_rectype::write_rewrite(f, re);
|
|
|
|
|
|
|
|
if (err == NOERR)
|
|
|
|
{
|
|
|
|
TLocalisamfile v(LF_CFVEN);
|
|
|
|
TRectype & v_rec = vendite();
|
|
|
|
err = v.write(v_rec);
|
|
|
|
if (err == _isreinsert)
|
|
|
|
err = v.write(v_rec);
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
TRectype& TCli_for::vendite() const
|
1997-06-12 16:26:22 +00:00
|
|
|
{
|
|
|
|
const char t = tipo();
|
|
|
|
const long c = codice();
|
|
|
|
|
|
|
|
if (_ven_rec.empty() || t != *(const char *) (*_ven_tipo) || c != (long) *_ven_codice)
|
|
|
|
{
|
|
|
|
TLocalisamfile v(LF_CFVEN);
|
1998-08-25 18:07:30 +00:00
|
|
|
TRectype& vr = ((TCli_for *)this)->_ven_rec; // fool const
|
1997-06-12 16:26:22 +00:00
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
vr.zero();
|
|
|
|
vr.put(CFV_TIPOCF,t);
|
|
|
|
vr.put(CFV_CODCF, c);
|
|
|
|
const TRectype v_rec(vr);
|
|
|
|
if (vr.read(v) != NOERR)
|
|
|
|
vr = v_rec;
|
1997-06-12 16:26:22 +00:00
|
|
|
}
|
|
|
|
return (TRectype &) _ven_rec;
|
|
|
|
}
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
int TCli_for::read(const TRectype & rec, word op, word lockop)
|
1997-06-12 16:26:22 +00:00
|
|
|
{
|
|
|
|
_ven_rec.zero();
|
1998-08-25 18:07:30 +00:00
|
|
|
int err = TMultiple_rectype::read(rec, op, lockop);
|
1997-06-12 16:26:22 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
int TCli_for::read(char tipo, long codice, word op, word lockop)
|
|
|
|
{
|
1998-08-25 18:07:30 +00:00
|
|
|
int err = NOERR;
|
|
|
|
_ven_rec.zero();
|
1997-06-12 16:26:22 +00:00
|
|
|
zero();
|
1998-08-25 18:07:30 +00:00
|
|
|
if (tipo > ' ' && codice > 0L)
|
|
|
|
{
|
|
|
|
put(CLI_TIPOCF, tipo);
|
|
|
|
put(CLI_CODCF, codice);
|
|
|
|
err = TMultiple_rectype::read(op, lockop);
|
|
|
|
}
|
|
|
|
return err;
|
1997-06-12 16:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int TCli_for::remove(TBaseisamfile& f) const
|
|
|
|
{
|
|
|
|
TLocalisamfile v(LF_CFVEN);
|
|
|
|
|
|
|
|
const int err = vendite().remove(v);
|
|
|
|
if (err != NOERR && err != _iskeynotfound)
|
|
|
|
return err;
|
|
|
|
return TMultiple_rectype:: remove(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
TCli_for::TCli_for(char tipo, long codice) : TMultiple_rectype( LF_CLIFO ), _ven_rec(LF_CFVEN)
|
|
|
|
{
|
|
|
|
_tipo = new TRecfield(*this, CLI_TIPOCF);
|
|
|
|
_codice = new TRecfield(*this, CLI_CODCF);
|
|
|
|
_ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
|
|
|
_ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
|
|
|
add_file(LF_INDSP, IND_CODIND);
|
1998-08-25 18:07:30 +00:00
|
|
|
if (tipo > ' ' && codice > 0L)
|
|
|
|
read(tipo, codice);
|
1997-06-12 16:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TCli_for::TCli_for(const TRectype & rec) : TMultiple_rectype(rec), _ven_rec(LF_CFVEN)
|
|
|
|
{
|
|
|
|
_tipo = new TRecfield(*this, CLI_TIPOCF);
|
|
|
|
_codice = new TRecfield(*this, CLI_CODCF);
|
|
|
|
_ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
|
|
|
_ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
|
|
|
add_file(LF_INDSP, IND_CODIND);
|
1998-08-25 18:07:30 +00:00
|
|
|
read(rec);
|
1997-06-12 16:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TCli_for::TCli_for(const TCli_for & c) : TMultiple_rectype(c), _ven_rec(c._ven_rec)
|
|
|
|
{
|
|
|
|
_tipo = new TRecfield(*this, CLI_TIPOCF);
|
|
|
|
_codice = new TRecfield(*this, CLI_CODCF);
|
|
|
|
_ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
|
|
|
_ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
|
|
|
}
|
|
|
|
|
|
|
|
TCli_for::~TCli_for()
|
|
|
|
{
|
|
|
|
delete _tipo;
|
|
|
|
delete _codice;
|
|
|
|
delete _ven_tipo;
|
|
|
|
delete _ven_codice;
|
|
|
|
}
|
|
|
|
|