Patch level :2.2 282
Files correlati :cg7.exe Ricompilazione Demo : [ ] Commento :modificata la write dei TFiletext per gestire eventuali record con 'buchi' nei valori dei campi git-svn-id: svn://10.65.10.50/trunk@13641 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
46a28b4028
commit
d832dfd5f9
@ -143,8 +143,11 @@ TTracciato_campo& TTracciato_record::get(int n)
|
||||
}
|
||||
//////////////////////////////////////// TRecord_text ////////////////////////////////////////
|
||||
const TString& TRecord_text::row(int pos) const
|
||||
{
|
||||
return _array.row(pos);
|
||||
{
|
||||
const TString* str = (const TString*)_array.objptr(pos);
|
||||
if (str != NULL)
|
||||
return *str;
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
TString& TRecord_text::row(int pos)
|
||||
@ -573,15 +576,19 @@ int TFile_text::write(TRecord_text& rec)
|
||||
|
||||
const TString& type = rec.type();
|
||||
TTracciato_record& tr = *t_rec(type);
|
||||
|
||||
const int items = rec.items();
|
||||
if (_typepos>=0)
|
||||
rec.add(type,_typepos);
|
||||
|
||||
const TArray& tac = tr.tracciati_campo();
|
||||
|
||||
if (_fixedlen) // campi a lunghezza fissa
|
||||
{
|
||||
for (int i = 0; i < items; i++)
|
||||
FOR_EACH_ARRAY_ITEM(tac, i, obj)
|
||||
{
|
||||
TTracciato_campo& tc = tr.get(i);
|
||||
campo = rec.row(i);
|
||||
const TTracciato_campo& tc = tr.get(i);
|
||||
campo = rec.get(i);
|
||||
format_textfield(tc, campo);
|
||||
buffer.overwrite(campo, tc.position());
|
||||
}
|
||||
@ -606,10 +613,11 @@ int TFile_text::write(TRecord_text& rec)
|
||||
else
|
||||
{
|
||||
buffer.separator(_fieldsep);
|
||||
for (int i = 0; i < items; i++)
|
||||
FOR_EACH_ARRAY_ITEM(tac, i, obj)
|
||||
{
|
||||
TTracciato_campo& tc = tr.get(i);
|
||||
campo = format_textfield(tc, rec.row(i));
|
||||
const TTracciato_campo& tc = tr.get(i);
|
||||
campo = rec.get(i);
|
||||
format_textfield(tc, campo);
|
||||
buffer.add(campo);
|
||||
}
|
||||
CHECK(_write_file, "Impossibile scrivere su un file chiuso.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user