Aggiunto costruttore con puntatore a file a TRecord_cache e TFile_cache
git-svn-id: svn://10.65.10.50/trunk@5369 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
eefb4851ac
commit
8cd6b12aaa
@ -399,6 +399,13 @@ int TRecord_array::remove() const
|
||||
// TFile_cache
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TFile_cache::TFile_cache(TLocalisamfile *f , int key)
|
||||
: _file(NULL), _key(key)
|
||||
{
|
||||
_code.format("%d", f->num());
|
||||
init_file(f);
|
||||
}
|
||||
|
||||
TFile_cache::TFile_cache(int num, int key)
|
||||
: _file(NULL), _key(key)
|
||||
{
|
||||
@ -417,10 +424,12 @@ TFile_cache::~TFile_cache()
|
||||
delete _file;
|
||||
}
|
||||
|
||||
void TFile_cache::init_file()
|
||||
void TFile_cache::init_file(TLocalisamfile* f)
|
||||
{
|
||||
CHECK(_file == NULL, "File already initialized");
|
||||
|
||||
if (f==NULL)
|
||||
{
|
||||
int logicnum = atoi(_code);
|
||||
if (logicnum == 0)
|
||||
{
|
||||
@ -428,11 +437,15 @@ void TFile_cache::init_file()
|
||||
logicnum = _file->num();
|
||||
}
|
||||
else
|
||||
{
|
||||
_file = new TLocalisamfile(logicnum);
|
||||
}
|
||||
}
|
||||
else
|
||||
_file = f;
|
||||
|
||||
TDir dir;
|
||||
dir.get(logicnum);
|
||||
|
||||
dir.get(_file->num());
|
||||
// Se e' un file comune metti a -1, altrimenti alla ditta corrente
|
||||
_last_firm = dir.is_com() ? -1 : prefix().get_codditta();
|
||||
}
|
||||
@ -571,6 +584,10 @@ const TString& TDecoder::decode(long code)
|
||||
// TRecord_cache
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TRecord_cache::TRecord_cache(TLocalisamfile *f, int key )
|
||||
: TFile_cache(f, key)
|
||||
{ }
|
||||
|
||||
TRecord_cache::TRecord_cache(int num, int key)
|
||||
: TFile_cache(num, key)
|
||||
{ }
|
||||
|
@ -155,7 +155,7 @@ protected:
|
||||
TAssoc_array _cache;
|
||||
|
||||
protected:
|
||||
void init_file();
|
||||
void init_file(TLocalisamfile* f=NULL);
|
||||
void test_firm();
|
||||
|
||||
const TObject& query(const char* chiave);
|
||||
@ -170,6 +170,7 @@ public:
|
||||
{return _cache.items();}
|
||||
int fill();
|
||||
|
||||
TFile_cache(TLocalisamfile *f,int key = 1);
|
||||
TFile_cache(int num, int key = 1);
|
||||
TFile_cache(const char* table, int key = 1);
|
||||
virtual ~TFile_cache();
|
||||
@ -203,6 +204,7 @@ public:
|
||||
virtual const TRectype& get(const char* chiave);
|
||||
|
||||
TRecord_cache(int num, int key = 1);
|
||||
TRecord_cache(TLocalisamfile *f, int key = 1);
|
||||
TRecord_cache(const char* table, int key = 1);
|
||||
virtual ~TRecord_cache() { }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user