Patch level :4.0 649

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :errori di compilazione nel riporto


git-svn-id: svn://10.65.10.50/trunk@14998 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-03-07 10:33:45 +00:00
parent 5e9ba7c01e
commit e39a7792f0

View File

@ -11,101 +11,6 @@
#include <statbar.h>
///////////////////////////////////////////////////////////
// TTable name converter
///////////////////////////////////////////////////////////
class TTable_names : public TObject
{
TAssoc_array _names;
TArray _ids;
long _filled;
protected:
void fill();
void add_file(int logic, const TString& table);
public:
const TString& name(int logic_num);
int logic_num(const TString& name);
TTable_names() : _filled(-1) { }
} _table_names;
void TTable_names::add_file(int logic, const TString& table)
{
TString* id = new TString8;
id->format("%d", logic);
_names.add(table, id);
_ids.add(table, logic);
}
void TTable_names::fill()
{
if (_filled != prefix().get_codditta())
{
FileDes dir;
CGetFile(LF_DIR, &dir, _nolock, NORDIR);
const int nfiles = (int)dir.EOD;
TFilename n;
for (int logic = LF_USER; logic <= nfiles; logic++)
{
const FileDes& fd = prefix().get_filedes(logic);
n = fd.SysName; n = n.name(); n.upper();
if (_names.objptr(n) == NULL)
add_file(logic, n);
}
_filled = prefix().get_codditta();
}
}
int TTable_names::logic_num(const TString& n)
{
// Non cambiare: n puo' essere temporaneo e pieno di spazi!
TString80 name = n; name.trim();
if (isdigit(name[0]))
{
int num = atoi(name);
if (name.ends_with("@"))
num = -num;
return num;
}
if (name[0] == '%' && name.len() == 4)
return LF_TABCOM;
TString* str = (TString*)_names.objptr(name);
if (str == NULL)
{
fill();
str = (TString*)_names.objptr(name);
}
if (str == NULL && name.len() == 3)
return LF_TAB;
return str == NULL ? 0 : atoi(*str);
}
const TString& TTable_names::name(int logic_num)
{
TString* str = (TString*)_ids.objptr(logic_num);
if (str == NULL)
{
fill();
str = (TString*)_ids.objptr(logic_num);
}
return str == NULL ? (const TString&)EMPTY_STRING : *str;
}
const TString& logic2table(int logic_num)
{ return _table_names.name(logic_num); }
int table2logic(const TString& name)
{ return _table_names.logic_num(name); }
///////////////////////////////////////////////////////////
// Utility
///////////////////////////////////////////////////////////