campo-sirio/ve/clifor.cpp
alex 1df67d66c8 Patch level :
Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Riportata la verione 98.01.04 sul main trunk


git-svn-id: svn://10.65.10.50/trunk@6986 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-08-25 18:07:30 +00:00

126 lines
2.9 KiB
C++
Executable File

#include "clifor.h"
TOccasionale::TOccasionale() : TRectype(LF_OCCAS)
{
_cod = new TRecfield(*this, OCC_CFPI);
}
TOccasionale::TOccasionale(const TRectype& r) : TRectype(r)
{
_cod = new TRecfield(*this, OCC_CFPI);
}
TRectype & TOccasionale::operator = (const TRectype& r)
{
return TRectype::operator=(r);
}
TOccasionale::~TOccasionale()
{
delete _cod;
}
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;
}
TRectype& TCli_for::vendite() const
{
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);
TRectype& vr = ((TCli_for *)this)->_ven_rec; // fool const
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;
}
return (TRectype &) _ven_rec;
}
int TCli_for::read(const TRectype & rec, word op, word lockop)
{
_ven_rec.zero();
int err = TMultiple_rectype::read(rec, op, lockop);
return err;
}
int TCli_for::read(char tipo, long codice, word op, word lockop)
{
int err = NOERR;
_ven_rec.zero();
zero();
if (tipo > ' ' && codice > 0L)
{
put(CLI_TIPOCF, tipo);
put(CLI_CODCF, codice);
err = TMultiple_rectype::read(op, lockop);
}
return err;
}
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);
if (tipo > ' ' && codice > 0L)
read(tipo, codice);
}
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);
read(rec);
}
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;
}