mask.* Aggiunta creazione campi albero dinamica
maskfld.* Migliorata gestione resizing campi e procedura di "Gestione" multirec.* Resa indipendente dalle dimensione degli array C git-svn-id: svn://10.65.10.50/trunk@6579 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ebdec7ba39
commit
2eb4a2460d
@ -302,7 +302,7 @@ TOperable_field& TMask::focus_field() const
|
||||
{
|
||||
if (is_open())
|
||||
{
|
||||
const short focus = get_focus_id(win());
|
||||
const short focus = low_get_focus_id(win());
|
||||
if (focus > 0 )
|
||||
((TMask *)this)->_focus = id2pos(focus);
|
||||
}
|
||||
@ -1718,6 +1718,21 @@ TMemo_field& TMask::add_memo(
|
||||
return *f;
|
||||
}
|
||||
|
||||
TTree_field& TMask::add_tree (
|
||||
short id, // @parm Numero identificatore del campo da aggiungere
|
||||
int page, // @parm Pagina nel quale aggiungere il campo
|
||||
int x, // @parm Coordinata x (in caratteri)
|
||||
int y, // @parm Coordinata y (in caratteri)
|
||||
int dx, // @parm Larghezza del campo sulla maschera
|
||||
int dy, // @parm Altezza del campo sulla maschera
|
||||
const char* flags)// @parm Flag di controllo del campo (default "")
|
||||
{
|
||||
TTree_field* f = new TTree_field(this);
|
||||
f->construct(id, "", x, y, dy, _pagewin[page], flags, dx);
|
||||
add_field(f);
|
||||
return *f;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Salva i valori dei campi della maschera sul file di salvataggio
|
||||
|
@ -203,6 +203,8 @@ public:
|
||||
TZoom_field& add_zoom (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int width = 0);
|
||||
// @cmember Aggiunge runtime un campo lista alla maschera
|
||||
TList_field& add_list (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", const char* codes = NULL, const char* items = NULL);
|
||||
// @cmember Aggiunge runtime un campo albero
|
||||
TTree_field& add_tree (short id, int page, int x, int y, int dx, int dy, const char* flags = "");
|
||||
|
||||
// @cmember Ritorna il numero di campi della maschera
|
||||
int fields() const
|
||||
|
@ -1,19 +1,16 @@
|
||||
#include <applicat.h>
|
||||
#include <colors.h>
|
||||
#include <controls.h>
|
||||
#include <defmask.h>
|
||||
#include <execp.h>
|
||||
#include <mailbox.h>
|
||||
#include <mask.h>
|
||||
#include <prefix.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
#include <tabutil.h>
|
||||
#include <text.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <validate.h>
|
||||
#include <xvtility.h>
|
||||
#include <text.h>
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -179,8 +176,6 @@ void TMask_field::set_focus() const
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// Certified 100%
|
||||
@ -941,11 +936,9 @@ void TOperable_field::highlight() const
|
||||
|
||||
bool TOperable_field::handler(KEY k)
|
||||
{
|
||||
bool ok;
|
||||
bool ok = TRUE;
|
||||
if (_handler)
|
||||
ok = _handler(*this, k);
|
||||
else
|
||||
ok = TRUE;
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -2149,32 +2142,32 @@ bool TBrowse::do_link(bool insert)
|
||||
if (_insert[0] == 'M')
|
||||
{
|
||||
TString nm(_insert.mid(1));
|
||||
// if (nm.compare("batb", 4, TRUE) == 0) // Programma gestione tabelle
|
||||
if (nm.compare("tb", 2, TRUE) == 0) // Programma gestione tabelle
|
||||
{
|
||||
// app = format("ba3 -0 %s", (const char*)nm.mid(4));
|
||||
const char* module = ((TTable&)_cursor->file()).module();
|
||||
TString prg("ba3 -0");
|
||||
if (strcmp(module,"ba")!=0)
|
||||
app = "ba3 -0 ";
|
||||
if (stricmp(module,"ba") !=0 )
|
||||
{
|
||||
TConfig c(CONFIG_STUDIO);
|
||||
prg = c.get("TabPrg",module);
|
||||
if (prg.empty())
|
||||
prg = "ba3 -0";
|
||||
app = c.get("TabPrg",module);
|
||||
if (app.empty())
|
||||
app = "ba3 -0 ";
|
||||
}
|
||||
|
||||
// Obbligatorio usare la format globale
|
||||
app.format("%s %s", (const char*)prg,(const char*)nm.mid(2));
|
||||
nm.ltrim(2);
|
||||
app << nm;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Programma generico di browse/edit (caduto in disuso)
|
||||
app = "ba3 -3 ";
|
||||
app << nm << ' ' << _cursor->file().num();
|
||||
}
|
||||
else // Programma generico di browse/edit
|
||||
// Obbligatorio usare la format globale
|
||||
app = format("ba3 -3 %s %d", (const char*)nm, _cursor->file().num());
|
||||
}
|
||||
else
|
||||
{
|
||||
app = &_insert[1];
|
||||
app = _insert.mid(1);
|
||||
}
|
||||
if (app.find('#') != -1)
|
||||
if (app.find('#') >= 0)
|
||||
{
|
||||
TString w(app);
|
||||
app = "";
|
||||
@ -2195,67 +2188,66 @@ bool TBrowse::do_link(bool insert)
|
||||
app << *f;
|
||||
}
|
||||
}
|
||||
TMailbox mail;
|
||||
|
||||
TFilename msg; msg.temp("msg");
|
||||
app << " /i" << msg;
|
||||
|
||||
if (insert)
|
||||
{
|
||||
TMessage msg(app, MSG_AI, "");
|
||||
mail.send(msg);
|
||||
TConfig ini(msg, "Transaction");
|
||||
ini.set("Action", "RUN");
|
||||
}
|
||||
else
|
||||
{
|
||||
TToken_string body;
|
||||
TConfig ini(msg, "Transaction");
|
||||
ini.set("Action", "MODIFY");
|
||||
|
||||
TString paragraph; paragraph << _cursor->file().num();
|
||||
ini.set_paragraph(paragraph);
|
||||
|
||||
body.add(_cursor->key());
|
||||
_inp_fn.restart();
|
||||
for (const char* i = _inp_id.get(0); i; i = _inp_id.get())
|
||||
{
|
||||
TString inp_id(i);
|
||||
TString16 field_name(_inp_fn.get());
|
||||
TString s(field_name);
|
||||
TString s(_inp_fn.get());
|
||||
const int pos = s.find(",");
|
||||
|
||||
if (pos >= 0)
|
||||
s.cut(pos);
|
||||
|
||||
s << "=";
|
||||
if (inp_id[0] == '"')
|
||||
{
|
||||
inp_id.ltrim(1);
|
||||
inp_id.rtrim(1);
|
||||
s << inp_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
const short id = field().atodlg(inp_id);
|
||||
const TEditable_field & f = field(id);
|
||||
|
||||
TFieldref fldref(field_name, 0);
|
||||
s << fldref.read(*_cursor->relation());
|
||||
TFieldref fldref(s, 0);
|
||||
inp_id = fldref.read(*_cursor->relation());
|
||||
}
|
||||
body.add(s);
|
||||
ini.set(s, inp_id);
|
||||
}
|
||||
TMessage msg(app, MSG_ED, body);
|
||||
mail.send(msg);
|
||||
}
|
||||
|
||||
TExternal_app a(app);
|
||||
int err = a.run();
|
||||
field().mask().set_focus();
|
||||
|
||||
if (err == 0 && mail.check())
|
||||
if (msg.not_empty())
|
||||
{
|
||||
TMessage* rcv = mail.next_s(insert ? MSG_AI : MSG_LN);
|
||||
if (rcv != NULL)
|
||||
_rec = atol(rcv->body());
|
||||
if (_rec > 0)
|
||||
TConfig ini(msg, "Transaction");
|
||||
_rec = ini.get_long("Record");
|
||||
if (_rec >= 0)
|
||||
{
|
||||
_cursor->file().readat(_rec);
|
||||
ok = _cursor->ok();
|
||||
if (ok) do_output();
|
||||
if (ok)
|
||||
do_output();
|
||||
#ifdef DBG
|
||||
else yesnofatal_box("Selezione da programma esterno errata");
|
||||
else
|
||||
yesnofatal_box("Selezione da programma esterno errata");
|
||||
#endif
|
||||
}
|
||||
::remove(msg);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -2438,11 +2430,6 @@ bool TBrowse::check(CheckTime t)
|
||||
const int ne = do_input(TRUE);
|
||||
if (ne || chk == CHECK_REQUIRED)
|
||||
{
|
||||
/* Guy: vecchio modo
|
||||
_cursor->setkey();
|
||||
_cursor->file().read(_isequal);
|
||||
passed = _cursor->ok();
|
||||
*/
|
||||
passed = _cursor->test() == NOERR;
|
||||
|
||||
if (t != FINAL_CHECK)
|
||||
@ -2768,6 +2755,12 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
||||
return TEditable_field::parse_item(scanner);
|
||||
}
|
||||
|
||||
// Filtro magico sulle ditte esistenti
|
||||
HIDDEN bool firm_filter(const TRelation* rel)
|
||||
{
|
||||
const long firm = rel->curr().get_long("CODDITTA");
|
||||
return prefix().exist(firm);
|
||||
}
|
||||
|
||||
void TEdit_field::create(WINDOW parent)
|
||||
{
|
||||
@ -2786,6 +2779,17 @@ void TEdit_field::create(WINDOW parent)
|
||||
|
||||
if (_browse && !enabled_default())
|
||||
((TField_control*)_ctl)->show_button(FALSE);
|
||||
|
||||
if (_browse && validate_func() == 24)
|
||||
{
|
||||
TCursor* cursor = browse()->cursor();
|
||||
if (cursor)
|
||||
{
|
||||
const int logicnum = cursor->file().num();
|
||||
if (logicnum == LF_NDITTE)
|
||||
cursor->set_filterfunction(firm_filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char* TEdit_field::reformat(const char* str) const
|
||||
@ -3388,7 +3392,9 @@ void TReal_field::create(WINDOW w)
|
||||
TEdit_field::create(w);
|
||||
|
||||
if (_flags.firm)
|
||||
TMask_field::set(main_app().get_firm());
|
||||
{
|
||||
TMask_field::set(prefix().get_codditta());
|
||||
}
|
||||
else
|
||||
if (automagic())
|
||||
TMask_field::set(TDate(TODAY).year());
|
||||
@ -3467,7 +3473,7 @@ bool TReal_field::on_key(KEY key)
|
||||
{
|
||||
const long f = atol(n);
|
||||
if (f > 0 && prefix().exist(f))
|
||||
main_app().set_firm(f);
|
||||
prefix().set_codditta(f);
|
||||
}
|
||||
}
|
||||
set_window_data(raw2win(n));
|
||||
@ -4228,9 +4234,9 @@ extern "C"
|
||||
void TField_window::update()
|
||||
{
|
||||
const WINDOW me = win();
|
||||
const WINDOW pa = parent();
|
||||
if (CAMPI_SCAVATI)
|
||||
{
|
||||
const WINDOW pa = parent();
|
||||
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
|
||||
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
|
||||
xi_draw_3d_rect(pa, &rct, TRUE, 2,
|
||||
@ -4275,6 +4281,31 @@ void TWindowed_field::show(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
void TWindowed_field::highlight() const
|
||||
{
|
||||
if (_win && active())
|
||||
{
|
||||
WINDOW w = _win->win();
|
||||
xvt_scr_set_focus_vobj(w);
|
||||
xvt_vobj_raise(w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RCT& TWindowed_field::get_rect(RCT& r) const
|
||||
{
|
||||
if (_win)
|
||||
xvt_vobj_get_outer_rect(_win->win(), &r);
|
||||
else
|
||||
xvt_rect_set_empty(&r);
|
||||
return r;
|
||||
}
|
||||
|
||||
void TWindowed_field::set_rect(const RCT&)
|
||||
{
|
||||
CHECK(NULL, "Can't resize windowed field by now!");
|
||||
}
|
||||
|
||||
void TWindowed_field::parse_head(TScanner& scanner)
|
||||
{
|
||||
_ctl_data._width = scanner.integer();
|
||||
@ -4289,10 +4320,10 @@ TField_window* TWindowed_field::create_window(int x, int y, int dx, int dy, WIND
|
||||
|
||||
void TWindowed_field::create(WINDOW parent)
|
||||
{
|
||||
_dlg = _ctl_data._dlg;
|
||||
_win = create_window(_ctl_data._x, _ctl_data._y,
|
||||
_ctl_data._width, _ctl_data._size,
|
||||
parent);
|
||||
_dlg = _ctl_data._dlg;
|
||||
_win = create_window(_ctl_data._x, _ctl_data._y,
|
||||
_ctl_data._width, _ctl_data._size,
|
||||
parent);
|
||||
}
|
||||
|
||||
TWindowed_field::~TWindowed_field()
|
||||
|
@ -150,8 +150,8 @@ public:
|
||||
// @cmember Ritorna la finestra padre
|
||||
virtual WINDOW parent() const;
|
||||
|
||||
RCT& get_rect(RCT& r) const;
|
||||
void set_rect(const RCT& r);
|
||||
virtual RCT& get_rect(RCT& r) const;
|
||||
virtual void set_rect(const RCT& r);
|
||||
|
||||
// @cmember Ritorna l'identificatore del controllo
|
||||
virtual short dlg() const;
|
||||
@ -1442,6 +1442,7 @@ class TWindowed_field : public TOperable_field
|
||||
protected: // TMask_field
|
||||
virtual void parse_head(TScanner& scanner);
|
||||
virtual void create(WINDOW parent);
|
||||
virtual void highlight() const;
|
||||
|
||||
protected:
|
||||
virtual TField_window* create_window(int x, int y, int dx, int dy,
|
||||
@ -1452,6 +1453,8 @@ public: // TMask_field
|
||||
virtual WINDOW parent() const { return win().parent(); }
|
||||
virtual void enable(bool on = TRUE);
|
||||
virtual void show(bool on = TRUE);
|
||||
virtual RCT& get_rect(RCT& r) const;
|
||||
virtual void set_rect(const RCT& r);
|
||||
|
||||
public:
|
||||
TField_window& win() const { CHECK(_win, "NULL Window in field"); return *_win; }
|
||||
@ -1477,6 +1480,7 @@ public:
|
||||
|
||||
void hide_leaves(bool yes = TRUE);
|
||||
void show_leaves(bool yes = TRUE) { hide_leaves(!yes); }
|
||||
bool select_current();
|
||||
|
||||
TTree_field(TMask* m) : TWindowed_field(m) { }
|
||||
virtual ~TTree_field() { }
|
||||
|
@ -27,7 +27,7 @@ void TMultiple_rectype::load_rows_file(int logicnum)
|
||||
_files.add( r, index);
|
||||
}
|
||||
((TRecord_array &)_files[index]).read(rec); // rilegge
|
||||
_changed[index]=FALSE;
|
||||
_changed.reset(index);
|
||||
}
|
||||
|
||||
int TMultiple_rectype::find(int logicnum, const char * fieldname, const char * s, int from, bool reverse) const
|
||||
@ -70,7 +70,7 @@ int TMultiple_rectype::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
|
||||
if (re)
|
||||
{
|
||||
for (int i = _nfiles - 1; err == NOERR && i >= 0 ; i--)
|
||||
for (int i = _files.last(); err == NOERR && i >= 0 ; i = _files.pred(i))
|
||||
{
|
||||
TRecord_array * r = (TRecord_array *) _files.objptr(i);
|
||||
if (r && !_changed[i])
|
||||
@ -109,7 +109,7 @@ int TMultiple_rectype::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
if (err != NOERR)
|
||||
err = TRectype::rewrite(f);
|
||||
}
|
||||
for (int i = _nfiles - 1; err == NOERR && i >= 0 ; i--)
|
||||
for (int i = _files.last(); err == NOERR && i >= 0 ; i = _files.pred(i))
|
||||
{
|
||||
TRecord_array * r = (TRecord_array *)_files.objptr(i);
|
||||
if (r && !_changed[i])
|
||||
@ -129,37 +129,32 @@ void TMultiple_rectype::remove_body(int logicnum)
|
||||
|
||||
int TMultiple_rectype::log2ind(int logicnum) const
|
||||
{
|
||||
if (logicnum == 0)
|
||||
if (logicnum <= 0)
|
||||
return 0;
|
||||
for (int i = _nfiles - 1; i >= 0 ; i--)
|
||||
if (_logicnums[i] == logicnum)
|
||||
for (int i = _logicnums.last(); i >= 0 ; i--)
|
||||
if (lognum(i) == logicnum)
|
||||
return i;
|
||||
NFCHECK("Can't find file %d in multiple record", logicnum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TRecord_array & TMultiple_rectype::body(int logicnum) const
|
||||
TRecord_array& TMultiple_rectype::body(int logicnum) const
|
||||
{
|
||||
const int index = log2ind(logicnum);
|
||||
|
||||
if (_files.objptr(index) == NULL || _changed[index])
|
||||
((TMultiple_rectype *) this)->load_rows_file(_logicnums[index]);
|
||||
return (TRecord_array &) _files[index];
|
||||
if (_files.objptr(index) == NULL || _changed[index])
|
||||
((TMultiple_rectype*) this)->load_rows_file(lognum(index));
|
||||
return (TRecord_array&) _files[index];
|
||||
}
|
||||
|
||||
void TMultiple_rectype::renum_key()
|
||||
{
|
||||
for (int i = _nfiles - 1; i >= 0 ; i--)
|
||||
for (int i = _files.last(); i >= 0 ; i = _files.pred(i))
|
||||
{
|
||||
const int logicnum = _logicnums[i];
|
||||
TRecord_array * b = (TRecord_array *) _files.objptr(i);
|
||||
if (b)
|
||||
{
|
||||
TRectype * rec = new TRectype(b->key());
|
||||
|
||||
set_body_key(*rec);
|
||||
b->set_key(rec); // Aggiorna righe
|
||||
}
|
||||
TRecord_array& b = (TRecord_array&)_files[i];
|
||||
TRectype* rec = new TRectype(b.key());
|
||||
set_body_key(*rec);
|
||||
b.set_key(rec); // Aggiorna righe
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,17 +179,14 @@ void TMultiple_rectype::zero(char c)
|
||||
{
|
||||
reset_fields(*this);
|
||||
TAuto_variable_rectype::zero(c);
|
||||
for (int i = _nfiles - 1; i >= 0 ; i--)
|
||||
if (_files.objptr(i) != NULL)
|
||||
((TRecord_array &)_files[i]).destroy_rows();
|
||||
for (int i = _files.last(); i >= 0 ; i = _files.pred(i))
|
||||
((TRecord_array &)_files[i]).destroy_rows();
|
||||
}
|
||||
|
||||
int TMultiple_rectype::readat(TBaseisamfile& f, TRecnotype nrec, word lockop)
|
||||
{
|
||||
int err = NOERR;
|
||||
|
||||
_nuovo = FALSE;
|
||||
err = TRectype::readat(f, nrec, lockop);
|
||||
int err = TRectype::readat(f, nrec, lockop);
|
||||
synchronize_bodies();
|
||||
return err;
|
||||
}
|
||||
@ -224,16 +216,16 @@ int TMultiple_rectype::read(TBaseisamfile & f, word op, word lockop)
|
||||
|
||||
void TMultiple_rectype::synchronize_bodies()
|
||||
{
|
||||
for (int i = _nfiles - 1; i >= 0 ; i--)
|
||||
for (int i = _logicnums.last(); i >= 0 ; i--)
|
||||
{
|
||||
if (_nuovo)
|
||||
{
|
||||
TRecord_array * b = (TRecord_array *) _files.objptr(i);
|
||||
if (b != NULL)
|
||||
{
|
||||
_changed[i] = FALSE;
|
||||
_changed.reset(i);
|
||||
b->destroy_rows();
|
||||
TRectype * r = new_body_record(_logicnums[i]);
|
||||
TRectype * r = new_body_record(lognum(i));
|
||||
set_body_key(*r);
|
||||
b->set_key(r);
|
||||
}
|
||||
@ -241,10 +233,10 @@ void TMultiple_rectype::synchronize_bodies()
|
||||
else
|
||||
{
|
||||
if (_autoload[i])
|
||||
load_rows_file(_logicnums[i]);
|
||||
load_rows_file(lognum(i));
|
||||
else
|
||||
if (_files.objptr(i) != NULL)
|
||||
_changed[i] = TRUE;
|
||||
_changed.set(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,16 +246,14 @@ TMultiple_rectype & TMultiple_rectype::copy(const TMultiple_rectype& r)
|
||||
{
|
||||
// copia..
|
||||
TAuto_variable_rectype::operator=((TAuto_variable_rectype&)r);
|
||||
_files = r._files;
|
||||
_nuovo=r._nuovo;
|
||||
_nfiles=r._nfiles; // file delle righe
|
||||
for (int i = _nfiles - 1; i >= 0; i--)
|
||||
{
|
||||
_logicnums[i] = r._logicnums[i];
|
||||
_changed[i] = r._changed[i];
|
||||
_autoload[i] = r._autoload[i];
|
||||
}
|
||||
_numfields=r._numfields;
|
||||
|
||||
_nuovo = r._nuovo;
|
||||
_files = r._files;
|
||||
_logicnums = r._logicnums;
|
||||
_changed = r._changed;
|
||||
_autoload = r._autoload;
|
||||
_numfields = r._numfields;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -282,9 +272,9 @@ int TMultiple_rectype::remove(TBaseisamfile & f) const
|
||||
{
|
||||
int err = NOERR;
|
||||
|
||||
for (int i = _nfiles - 1; err == NOERR && i >= 0 ; i--)
|
||||
for (int i = _files.last(); err == NOERR && i >= 0 ; i = _files.pred(i))
|
||||
{
|
||||
TRecord_array & r = body(_logicnums[i]);
|
||||
TRecord_array & r = body(lognum(i));
|
||||
err = r.remove();
|
||||
}
|
||||
if (err == NOERR)
|
||||
@ -294,14 +284,14 @@ int TMultiple_rectype::remove(TBaseisamfile & f) const
|
||||
|
||||
// @doc INTERNAL
|
||||
TMultiple_rectype::TMultiple_rectype(int hfn)
|
||||
: TAuto_variable_rectype(hfn), _nuovo(TRUE), _nfiles(0)
|
||||
: TAuto_variable_rectype(hfn), _nuovo(TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
void TMultiple_rectype::enable_autoload(int logicnum,bool on)
|
||||
{
|
||||
const int index = log2ind(logicnum);
|
||||
_autoload[index] = on;
|
||||
_autoload.set(index, on);
|
||||
}
|
||||
|
||||
TRectype & TMultiple_rectype::insert_row(int row, int logicnum)
|
||||
@ -330,22 +320,20 @@ bool TMultiple_rectype::autoload_enabled(int logicnum)
|
||||
}
|
||||
|
||||
// @cmember Aggiunge il corpo lgicnum
|
||||
void TMultiple_rectype::add_file(int logicnum, const char * numfield)
|
||||
void TMultiple_rectype::add_file(int logicnum, const char* numfield)
|
||||
{
|
||||
CHECK(_nfiles < maxfiles, "Too many files added");
|
||||
_logicnums[_nfiles] = logicnum;
|
||||
_autoload[_nfiles] = FALSE;
|
||||
_numfields.add(numfield, _nfiles++);
|
||||
_logicnums.add_long(logicnum);
|
||||
_numfields.add(numfield);
|
||||
}
|
||||
|
||||
TMultiple_rectype::TMultiple_rectype(const TBaseisamfile* file)
|
||||
:TAuto_variable_rectype(file), _nuovo(TRUE), _nfiles(0)
|
||||
:TAuto_variable_rectype(file), _nuovo(TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
// @ cmember costruttore dal record
|
||||
TMultiple_rectype::TMultiple_rectype(const TRectype & rec)
|
||||
:TAuto_variable_rectype(rec), _nuovo(TRUE), _nfiles(0)
|
||||
:TAuto_variable_rectype(rec), _nuovo(TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,6 @@
|
||||
#ifndef __MULTIREC_H
|
||||
#define __MULTIREC_H
|
||||
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RECARRAY_H
|
||||
#include <recarray.h>
|
||||
#endif
|
||||
@ -13,29 +9,27 @@
|
||||
#include <varrec.h>
|
||||
#endif
|
||||
|
||||
class TMultiple_rectype ;
|
||||
class TMultiple_rectype;
|
||||
//**************************************
|
||||
// classe per il controllo dei record composti da una testata e N file di righe
|
||||
// è implementato come un TRectype che contiene anche un TRecord_array
|
||||
//
|
||||
class TMultiple_rectype : public TAuto_variable_rectype
|
||||
{
|
||||
enum { maxfiles = 20};
|
||||
// @cmember Array di TRecord array per le righe
|
||||
TArray _files; //
|
||||
// @cmember flag indicatore di record nuovo
|
||||
bool _nuovo;
|
||||
// @cmember numero di file righe
|
||||
short _nfiles;
|
||||
// @cmember file delle righe
|
||||
int _logicnums[maxfiles];
|
||||
TPointer_array _logicnums;
|
||||
// @cmember Indicazione di record array non più corrispondente alla testata
|
||||
bool _changed[maxfiles];
|
||||
TBit_array _changed;
|
||||
// @cmember Indicazione autoload
|
||||
bool _autoload[maxfiles];
|
||||
TBit_array _autoload;
|
||||
// @cmember Array di nomi di campo "numeratore" delle righe
|
||||
TString_array _numfields;
|
||||
|
||||
int lognum(int index) const { return _logicnums.get_int(index); }
|
||||
|
||||
protected:
|
||||
const TArray & files() const { return _files;}
|
||||
@ -50,7 +44,7 @@ protected:
|
||||
// @cmember renumera le chiavi di tutti i corpi in base alla testata
|
||||
virtual void renum_key();
|
||||
// @cmember Genera il record del corpo
|
||||
virtual TRectype * new_body_record(int logicnum = 0) { return new TRectype(logicnum ? logicnum : _logicnums[0]); }
|
||||
virtual TRectype * new_body_record(int logicnum = 0) { return new TRectype(logicnum ? logicnum : lognum(0)); }
|
||||
// @cmember Crea e carica il record array del corpo
|
||||
virtual void load_rows_file(int logicnum);
|
||||
// @cmember Ritorna l'indice di <p _files> del numero logico passato
|
||||
@ -80,7 +74,6 @@ public:
|
||||
// @cmember restituisce il record di testata
|
||||
TAuto_variable_rectype& head() { return *this; } // Ritorna la testata del documento
|
||||
|
||||
|
||||
// @cmember restituisce il record array del corpo
|
||||
TRecord_array & body(int logicnum = 0) const;
|
||||
// @cmember restituisce il numero di record nel corpo
|
||||
|
Loading…
x
Reference in New Issue
Block a user