Aggiunto get_keys per ficcare l'assocarray in un tstringarray

git-svn-id: svn://10.65.10.50/trunk@2147 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1995-11-14 11:11:56 +00:00
parent dc9dc4d6fb
commit 0b5adc807d
2 changed files with 27 additions and 0 deletions

View File

@ -218,3 +218,26 @@ THash_object* TAssoc_array::get_hashobj()
return (THash_object*)arr->objptr(_col++); return (THash_object*)arr->objptr(_col++);
} }
// mette chiavi e opzionalmente valori (come stringa) nel
// TString_array passato
int TAssoc_array::get_keys(TString_array& kl, bool add_values)
{
kl.destroy(); restart();
THash_object* o = NULL;
TString tmp(80);
while (o = get_hashobj())
{
TToken_string* tt = new TToken_string(o->key());
if (add_values)
{
tmp = "";
tmp << o->obj();
tt->add(tmp);
}
kl.add(tt);
}
restart();
return kl.items();
}

View File

@ -109,6 +109,10 @@ public:
// @cmember Azzera il numero di righe e colonne della tabella hash // @cmember Azzera il numero di righe e colonne della tabella hash
void restart() void restart()
{ _row = 0; _col = 0; } { _row = 0; _col = 0; }
// mette chiavi e opzionalmente valori (come stringa) nel
// TString_array passato
int get_keys(TString_array& kl, bool add_values = FALSE);
// @cmember Costruttore // @cmember Costruttore
TAssoc_array() : _cnt(0), _row(0), _col(0) TAssoc_array() : _cnt(0), _row(0), _col(0)