Correzzione nell'assegnamento di una stringa in base alla PICTURE

git-svn-id: svn://10.65.10.50/trunk@5304 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
sauro 1997-09-30 07:23:00 +00:00
parent c6943590d1
commit f8b98a8f16
2 changed files with 13 additions and 3 deletions

View File

@ -80,6 +80,11 @@ const TString& TRecord_text::row(int pos) const
return _array.row(pos);
}
TString& TRecord_text::row(int pos)
{
return _array.row(pos);
}
void TRecord_text::add(const TString& c, int pos)
{
_array.add(c, pos);
@ -464,13 +469,14 @@ int TFile_text::autosave(TRelation& rel, const TRecord_text& rec)
TTracciato_record& tr = t_rec(type);
TArray& a_tc = tr.tracciati_campo();
int items = a_tc.items();
TString valore;
for (int i = 0; i < items; i++)
{
const TTracciato_campo& tc = tr.get(i);
const TFieldref& field = tc.field();
if (field.name().not_empty())
{
const TString& valore = rec.row(i);
valore = rec.row(i);
field.write(valore, rel);//faccio una write sulla relazione del fieldref
}
}
@ -558,7 +564,10 @@ TString& TFile_text::format_field(TTracciato_campo& tc, TString& campo)
int pos = tc.position();
int length = tc.length();
if (!tc.picture().blank())
campo.picture(tc.picture(), campo);
{ TString tmp;
tmp.picture(tc.picture(), campo);
campo=tmp;
}
if (length > campo.len())
{
if (tc.align() == 'R')

View File

@ -101,6 +101,7 @@ public:
const TString& type() const {return _type;}
void set_type(const TString& type) {_type = type;}
const TString& row(int pos) const;//ritorna il campo dell'array della posizione <pos>
TString& row(int pos);
void add(const TString& c, int pos = -1);//scrive il campo <c> nell'array alla posizione <pos>
const int items() const {return _array.items();}//ritorna il numero di elementi dell'array
virtual bool destroy(int index = -1, bool pack = FALSE) {return _array.destroy(index, pack);}