- funzione maxstrlen statica per la gestione della lunghezza delle parti del codice
- set_sheetcolum per settare la maschera - abilitazione/disab globale della gestione codice a livelli git-svn-id: svn://10.65.10.50/trunk@4903 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8f7c1b5de6
commit
7b01cc1b0f
@ -534,7 +534,7 @@ bool TMetachar::has_mandchars(const char * pattern)
|
||||
}
|
||||
|
||||
// stabilisce la lunghezza della stringa di metacaratteri
|
||||
int TMetachar::maxstrlen(const char * pattern) const
|
||||
int TMetachar::maxstrlen(const char * pattern)
|
||||
{
|
||||
int i=0,l=0;
|
||||
bool next_literal=FALSE;
|
||||
@ -575,35 +575,9 @@ TMetachar::~TMetachar ()
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *TCodice_livelli::code_format(int levnum) const
|
||||
{
|
||||
if (levnum<0) {
|
||||
levnum=max(last_level(),1);
|
||||
}
|
||||
((TCodart_livelli *)this)->add_metachar(levnum);
|
||||
return ((TMetachar*)_metachars.objptr(levnum-1))->language();
|
||||
}
|
||||
|
||||
|
||||
bool TCodice_livelli::fit_to_format(const char *codepart,int levnum) const
|
||||
{
|
||||
if (levnum<0) {
|
||||
levnum=max(last_level(),1);
|
||||
}
|
||||
((TCodart_livelli *)this)->add_metachar(levnum);
|
||||
return ((TMetachar*)_metachars.objptr(levnum-1))->recognized(codepart);
|
||||
}
|
||||
|
||||
|
||||
void TCodice_livelli::add_metachar(int levnum)
|
||||
{
|
||||
if (_metachars.objptr(levnum-1)==NULL)
|
||||
_metachars.add(new TMetachar(picture(levnum)),levnum-1);
|
||||
}
|
||||
|
||||
// **************************
|
||||
// classe codice a livelli
|
||||
|
||||
TCodice_livelli:: TCodice_livelli(const char *tabname,const char *tabgrp)
|
||||
{
|
||||
TTable _tabformato(tabname);
|
||||
@ -615,8 +589,8 @@ TCodice_livelli:: TCodice_livelli(const char *tabname,const char *tabgrp)
|
||||
_enabled[i]=(e==NOERR);
|
||||
if (_enabled[i]) {
|
||||
_name[i]=_tabformato.get("S0");
|
||||
_code_lenght[i]=atoi(_tabformato.get("I0"));
|
||||
_picture[i]=_tabformato.get("S1");
|
||||
_code_lenght[i]=TMetachar::maxstrlen(_picture[i]);
|
||||
_last_level=i+1;
|
||||
} else {
|
||||
_name[i]="";
|
||||
@ -628,10 +602,41 @@ TCodice_livelli:: TCodice_livelli(const char *tabname,const char *tabgrp)
|
||||
_gruppi = new TDecoder(tabgrp);
|
||||
}
|
||||
|
||||
const char *TCodice_livelli::code_format(int levnum) const
|
||||
{
|
||||
if (levnum<0) {
|
||||
levnum=max(last_level(),1);
|
||||
}
|
||||
((TCodice_livelli *)this)->add_metachar(levnum);
|
||||
return ((TMetachar*)_metachars.objptr(levnum-1))->language();
|
||||
}
|
||||
|
||||
|
||||
bool TCodice_livelli::fit_to_format(const char *codepart,int levnum) const
|
||||
{
|
||||
if (levnum<0) {
|
||||
levnum=max(last_level(),1);
|
||||
}
|
||||
((TCodice_livelli *)this)->add_metachar(levnum);
|
||||
return ((TMetachar*)_metachars.objptr(levnum-1))->recognized(codepart);
|
||||
}
|
||||
|
||||
|
||||
void TCodice_livelli::add_metachar(int levnum)
|
||||
{
|
||||
if (_metachars.objptr(levnum-1)==NULL)
|
||||
_metachars.add(new TMetachar(picture(levnum)),levnum-1);
|
||||
}
|
||||
|
||||
const bool TCodice_livelli::enabled() const
|
||||
{
|
||||
return _lev_enabled && enabled(1);
|
||||
}
|
||||
|
||||
const bool TCodice_livelli::enabled(int levnum) const
|
||||
{
|
||||
if (levnum<=MANY_MAG_LEV && levnum>0)
|
||||
return(_enabled[levnum-1]);
|
||||
return(_enabled[levnum-1] && _lev_enabled);
|
||||
else
|
||||
return(FALSE) ;
|
||||
}
|
||||
@ -706,9 +711,24 @@ const TString & TCodice_livelli::group_descr(const char * code, int levnum) cons
|
||||
}
|
||||
|
||||
|
||||
void TCodice_livelli::set_sheetcolumn(TSheet_field &fld_righe,int field, int lev) const
|
||||
{
|
||||
if (enabled(lev)) {
|
||||
fld_righe.sheet_mask().field(field).show();
|
||||
fld_righe.set_column_header(fld_righe.cid2index(field),name(lev));
|
||||
fld_righe.sheet_mask().field(field).set_prompt(name(lev));
|
||||
} else {
|
||||
fld_righe.sheet_mask().field(field).hide();
|
||||
fld_righe.delete_column(fld_righe.cid2index(field));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TCodart_livelli ::TCodart_livelli() :
|
||||
TCodice_livelli("FCA","GCA")
|
||||
{
|
||||
TConfig mgconfig(CONFIG_DITTA, "mg");
|
||||
_lev_enabled=mgconfig.get_bool("GESLIVART");
|
||||
// imposta il riconoscimento dei caratteri del formato dell'ultima parte dell'articolo
|
||||
TString80 format("");
|
||||
TTable _tabfca("FCA");
|
||||
@ -722,10 +742,11 @@ TCodart_livelli ::~TCodart_livelli()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TCodgiac_livelli ::TCodgiac_livelli() :
|
||||
TCodice_livelli("FCG","GCG")
|
||||
{
|
||||
TConfig mgconfig(CONFIG_DITTA, "mg");
|
||||
_lev_enabled=mgconfig.get_bool("GESLIVGIAC");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user