Riportate sul main trunk le modifiche alle funzioni di autosave
git-svn-id: svn://10.65.10.50/trunk@5966 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0c0abd6589
commit
e0cfd918cb
@ -137,16 +137,17 @@ void TRecord_text::add(const TString& c, int pos)
|
||||
_array.add(c, pos);
|
||||
}
|
||||
//////////////////////////////////////// TFile_text ////////////////////////////////////////
|
||||
TTracciato_record* TFile_text::t_rec(const char* type)
|
||||
TTracciato_record* TFile_text::t_rec(const char* type) const
|
||||
{
|
||||
return (TTracciato_record*)_tracciati_record.objptr(type);
|
||||
}
|
||||
|
||||
TTracciato_record* TFile_text::t_rec(int mainfile)
|
||||
TTracciato_record* TFile_text::t_rec(int mainfile) const
|
||||
{
|
||||
TTracciato_record *trrd;
|
||||
_tracciati_record.restart();
|
||||
while (trrd=(TTracciato_record *)_tracciati_record.get())
|
||||
TAssoc_array &tr= ((TFile_text *)this)->_tracciati_record;
|
||||
tr.restart();
|
||||
while (trrd=(TTracciato_record *)tr.get())
|
||||
{
|
||||
if (trrd->relation() && trrd->relation()->lfile().num()==mainfile)
|
||||
break;
|
||||
@ -597,13 +598,13 @@ bool TFile_text::_autoload(TRecord_text& rec, TCursor& cur , TTracciato_record&
|
||||
return can_write(rec,rel);
|
||||
}
|
||||
|
||||
int TFile_text::autosave(int mainfile, const TRecord_text& rec)
|
||||
int TFile_text::autosave(const TRecord_text& rec, int mainfile )
|
||||
{
|
||||
const TString& type = rec.type();//prendo il tracciato record del tipo del record_text
|
||||
TTracciato_record* tr = t_rec(type);
|
||||
if (tr)
|
||||
if (tr->relation())
|
||||
if (tr->relation()->lfile().num()==mainfile)
|
||||
if (mainfile==0 || tr->relation()->lfile().num()==mainfile)
|
||||
return _autosave(*(tr->relation()),rec, *tr);
|
||||
return NOERR; // l'assenza del tracciato non significa un errore
|
||||
}
|
||||
@ -618,7 +619,7 @@ int TFile_text::autosave(TRelation& rel, const TRecord_text& rec)
|
||||
int TFile_text::autosave(int mainfile)
|
||||
{
|
||||
CHECK(_current,"Record corrente non settato");
|
||||
return autosave(mainfile,*_current);
|
||||
return autosave(*_current,mainfile);
|
||||
}
|
||||
|
||||
//Carico la relazione con i dati del record text
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
// @cmember Restituisce la relazione associata al tracciato
|
||||
TRelation * relation() const {return _rel;}
|
||||
// @cmember Setta la relazione associata al tracciato
|
||||
void set_relation(TRelation * rel) {_rel = rel;}
|
||||
void set_relation(TRelation * rel) ;
|
||||
void add(const TTracciato_campo& tc, int pos = -1);//aggiunge tracciato campo all'array
|
||||
void add(TTracciato_campo* tc, int pos = -1);//aggiunge tracciato campo all'array
|
||||
TTracciato_campo& get(int n);//ritorna il tracciato campo n dell'array (se non c'e' lo crea)
|
||||
@ -209,10 +209,10 @@ public:
|
||||
void set_curr(TRecord_text& rec) {_current = &rec;}//setta il record corrente a rec
|
||||
void set_curr(TRecord_text* rec) {_current = rec;}//setta il record corrente a rec
|
||||
// @cmember ritorna il tracciato record del tipo passato
|
||||
TTracciato_record* t_rec(const char* type);
|
||||
TTracciato_record* t_rec(const char* type) const ;
|
||||
// @cmember ritorna il tracciato record relativo alla relazione del file passato
|
||||
// NB: si assume che ogni tracciato sia relativo ad una relazione diversa
|
||||
TTracciato_record* t_rec(int mainfile);
|
||||
TTracciato_record* t_rec(int mainfile) const ;
|
||||
const int items_tr() const {return _tracciati_record.items();}//ritorna il numero di tracciati record nel file
|
||||
TAssoc_array& tracciati() {return _tracciati_record;}//ritorna un riferimento all'assoc_array dei tracciati record
|
||||
// @cmember caricamento automatico del record_text dalla relazione
|
||||
@ -230,11 +230,11 @@ public:
|
||||
//caricamento automatico della relazione dal record_text corrente
|
||||
int autosave(TRelation& rel) {return autosave(rel, *_current); };
|
||||
//caricamento automatico della relazione definita nel tracciato dal record_text
|
||||
int autosave(int mainfile, const TRecord_text& rec);
|
||||
int autosave(const TRecord_text& rec, int mainfile=0);
|
||||
//caricamento automatico della relazione definita nel tracciato dal record_text
|
||||
int autosave(int mainfile);
|
||||
int read(TRecord_text & rec);//legge da file di testo il record_text
|
||||
int read(){return read(*_current);}//legge da file di testo il record_text corrente
|
||||
int read() {return read(*_current);}//legge da file di testo il record_text corrente
|
||||
//carica nel record_text il campo alla posizione <ncampo> con il valore <val> già formattato
|
||||
void add_field(TRecord_text& rec, const int ncampo, const char* val);
|
||||
//scarica dal record_text il campo alla posizione <ncampo>
|
||||
|
Loading…
x
Reference in New Issue
Block a user