Patch level : 10.0 patch ???

Files correlati     : lvlib2
Ricompilazione Demo : [ ]
Commento            :
Classi per la gestione di lvanamag (&LV047) e lvclifo (&LV020)


git-svn-id: svn://10.65.10.50/branches/R_10_00@22172 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca83 2011-05-27 06:28:37 +00:00
parent 22cfe94f8f
commit 20c57478ad
2 changed files with 411 additions and 0 deletions

304
lv/lvlib2.cpp Executable file
View File

@ -0,0 +1,304 @@
#include "lvlib2.h"
/////////////////////////
//// TLVanamag ////
/////////////////////////
bool TLVanamag::read(const char* chiave)
{
TModule_table tabmod("&LV047");
tabmod.put("CODTAB", chiave);
int err = tabmod.read();
if (err != NOERR)
zero();
else
*this = tabmod.curr();
return err == NOERR;
}
bool TLVanamag::rewrite_write()
{
TLocalisamfile tabmod(LF_TABMOD);
TRectype& rec = tabmod.curr();
rec = *this;
int err = rec.rewrite_write(tabmod);
return err == NOERR;
}
const TString& TLVanamag::chiave() const
{
return get("CODTAB");
}
const int TLVanamag::riempi_c_xs() const
{
return get_int("I0");
}
const int TLVanamag::riempi_c_m() const
{
return get_int("I1");
}
const int TLVanamag::riempi_c_xl() const
{
return get_int("I2");
}
const int TLVanamag::normale_xs() const
{
return get_int("I3");
}
const int TLVanamag::normale_m() const
{
return get_int("I4");
}
const int TLVanamag::normale_xl() const
{
return get_int("I5");
}
const int TLVanamag::riempi_s_xs() const
{
return get_int("I6");
}
const int TLVanamag::riempi_s_m() const
{
return get_int("I7");
}
const int TLVanamag::riempi_s_xl() const
{
return get_int("I8");
}
const int TLVanamag::precedenza() const
{
return get_int("I9");
}
const int TLVanamag::tipo_articolo() const
{
return get_int("I10");
}
const TString& TLVanamag::descr_etichette() const
{
return get("S0");
}
void TLVanamag::set_chiave(const char* chiave)
{
put("CODTAB", chiave);
}
void TLVanamag::set_riempi_c_xs(const int qta)
{
put("I0", qta);
}
void TLVanamag::set_riempi_c_m(const int qta)
{
put("I1", qta);
}
void TLVanamag::set_riempi_c_xl(const int qta)
{
put("I2", qta);
}
void TLVanamag::set_normale_xs(const int qta)
{
put("I3", qta);
}
void TLVanamag::set_normale_m(const int qta)
{
put("I4", qta);
}
void TLVanamag::set_normale_xl(const int qta)
{
put("I5", qta);
}
void TLVanamag::set_riempi_s_xs(const int qta)
{
put("I6", qta);
}
void TLVanamag::set_riempi_s_m(const int qta)
{
put("I7", qta);
}
void TLVanamag::set_riempi_s_xl(const int qta)
{
put("I8", qta);
}
void TLVanamag::set_precedenza(const int prec)
{
put("I9", prec);
}
void TLVanamag::set_tipo_articolo(const int tpart)
{
put("I10", tpart);
}
void TLVanamag::set_descr_etichette(const char* descr)
{
put("S0", descr);
}
//costruttore
TLVanamag::TLVanamag(const TRectype& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVanamag::TLVanamag(const char* chiave)
: TRectype(LF_TABMOD)
{
read(chiave);
}
TLVanamag::TLVanamag(const TLVanamag& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVanamag::TLVanamag()
: TRectype(LF_TABMOD)
{
zero();
}
////////////////////////
//// TLVclifo ////
////////////////////////
bool TLVclifo::read(const char* chiave)
{
TModule_table tabmod("&LV020");
tabmod.put("CODTAB", chiave);
int err = tabmod.read();
if (err != NOERR)
zero();
else
*this = tabmod.curr();
return err == NOERR;
}
bool TLVclifo::rewrite_write()
{
TLocalisamfile tabmod(LF_TABMOD);
TRectype& rec = tabmod.curr();
rec = *this;
int err = rec.rewrite_write(tabmod);
return err == NOERR;
}
const TString& TLVclifo::chiave() const
{
return get("CODTAB");
}
const char TLVclifo::tipocf() const
{
return get("CODTAB")[0];
}
const long TLVclifo::codcf() const
{
return atol(get("CODTAB").mid(1));
}
const char TLVclifo::tipo_imballo() const
{
return get("S0")[0];
}
const char TLVclifo::riempimento() const
{
return get("S1")[0];
}
const char TLVclifo::art_sep() const
{
return get_bool("B0");
}
void TLVclifo::set_chiave(const char tipocf, const long codcf)
{
TString8 codtab;
codtab << tipocf << codcf;
put("CODTAB", codtab);
}
void TLVclifo::set_tipo_imballo(const char c)
{
put("S0", c);
}
void TLVclifo::set_riempimento(const char c)
{
put("S1", c);
}
void TLVclifo::set_art_sep(const bool b)
{
put("B0", b);
}
//costruttore
TLVclifo::TLVclifo(const TRectype& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVclifo::TLVclifo(const char* chiave)
: TRectype(LF_TABMOD)
{
read(chiave);
}
TLVclifo::TLVclifo(const TLVclifo& r)
: TRectype(r)
{
CHECK(r.num() == LF_TABMOD, "Tipo record errato");
}
TLVclifo::TLVclifo(const char tipocf, const long codcf)
: TRectype(LF_TABMOD)
{
TString8 codtab;
codtab << tipocf, codcf;
read(codtab);
}
TLVclifo::TLVclifo()
: TRectype(LF_TABMOD)
{
zero();
}

107
lv/lvlib2.h Executable file
View File

@ -0,0 +1,107 @@
#ifndef __LVLIB2_H
#define __LVLIB2_H
#ifndef __ISAM_H
#include <isam.h>
#endif
#ifndef __RECSET_H
#include <recset.h>
#endif
#ifndef __TABMOD_H
#include <tabmod.h>
#endif
/////////////////////////
//// TLVANAMAG ////
/////////////////////////
//Classe TLVanamag
class TLVanamag : public TRectype
{
private:
bool read(const char* chiave);
public:
TLVanamag & operator =(const TLVanamag& ris) { TRectype::operator =(ris); return *this; }
TLVanamag & operator =(const TRectype& ris) { TRectype::operator =(ris); return *this; }
//metodi get
const TString& chiave() const;
const int riempi_c_xs() const;
const int riempi_c_m() const;
const int riempi_c_xl() const;
const int normale_xs() const;
const int normale_m() const;
const int normale_xl() const;
const int riempi_s_xs() const;
const int riempi_s_m() const;
const int riempi_s_xl() const;
const int precedenza() const;
const int tipo_articolo() const;
const TString& descr_etichette() const;
//metodi set
void set_chiave(const char* chiave);
void set_riempi_c_xs(const int qta);
void set_riempi_c_m(const int qta);
void set_riempi_c_xl(const int qta);
void set_normale_xs(const int qta);
void set_normale_m(const int qta);
void set_normale_xl(const int qta);
void set_riempi_s_xs(const int qta);
void set_riempi_s_m(const int qta);
void set_riempi_s_xl(const int qta);
void set_precedenza(const int qta);
void set_tipo_articolo(const int qta);
void set_descr_etichette(const char* descr);
bool rewrite_write();
//costruttore
TLVanamag(const TRectype& r);
TLVanamag(const char* chiave);
TLVanamag(const TLVanamag& r);
TLVanamag();
virtual ~TLVanamag() {}
};
//Classe TLVclifo
class TLVclifo : public TRectype
{
private:
bool read(const char* chiave);
public:
TLVclifo & operator =(const TLVclifo& ris) { TRectype::operator =(ris); return *this; }
TLVclifo & operator =(const TRectype& ris) { TRectype::operator =(ris); return *this; }
//metodi get
const TString& chiave() const;
const char tipocf() const;
const long codcf() const;
const char tipo_imballo() const;
const char riempimento() const;
const char art_sep() const;
//metodi set
void set_chiave(const char tipocf, const long codcf);
void set_tipo_imballo(const char c);
void set_riempimento(const char c);
void set_art_sep(const bool b);
bool rewrite_write();
//costruttore
TLVclifo(const TRectype& r);
TLVclifo(const char* chiave);
TLVclifo(const TLVclifo& r);
TLVclifo(const char tipocf, const long codcf);
TLVclifo();
virtual ~TLVclifo() {}
};
#endif