campo-sirio/at/at5100.cpp
cris ca0ec635c3 modifiche cristina al 4/9/1996
git-svn-id: svn://10.65.10.50/trunk@3512 c028cbd2-c16b-5b4b-a496-9718f37d4682
1996-09-04 14:26:11 +00:00

156 lines
3.3 KiB
C++
Executable File

// trasferimenti
#include <applicat.h>
#include <config.h>
#include <mask.h>
#include <relation.h>
#include <urldefid.h>
#include "atfield.cpp"
#include "lf.h"
// nomi delle variabili in .ini per i campi
#define FIELD "FIELD"
#define LEN "LEN"
#define DEC "DEC"
#define FLAGS "FLAGS"
// nomi delle variabili in .ini per HEADER
#define HEADER "HEADER"
#define NOMEFILE "NOMEFILE"
#define LUNGHEZZA "LUNGHEZZA"
#define RECORDSEP "RECORDSEP"
#define FIELDSEP "FIELDSEP"
class TTransfer_app : public TApplication
{
TMask* _msk;
TRelation* _rel;
protected:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m) ;
virtual TMask& get_mask() { return *_msk; }
virtual TRelation* get_relation() const { return _rel; }
virtual void scarica();
public:
TTransfer_app() {}
};
HIDDEN inline TTransfer_app& app() { return (TTransfer_app&) main_app(); }
bool TTransfer_app::create()
{
_msk = new TMask("at5100a");
_rel = new TRelation(LF_SOGGETTI);
/*
_rel->add("CTD", "CODTAB==CATDON",1,0,ALIAS_CTD);
_donaz = new TLocalisamfile(LF_DONAZ);
_contsan = new TLocalisamfile(LF_CONTSAN);
_sdonazioni = new TRecord_array(LF_DONAZ,DON_PROGDON);
_scontrolli = new TRecord_array(LF_CONTSAN,CON_PROGCON);
_asoggetti = new TAssoc_array();
_msk->set_handler(F_INS_CONTROLLI,ins_controlli_handler);
TSheet_field& ss = (TSheet_field&)_msk->field(F_SOGGETTI);
ss.set_notify(soggetti_notify);
//ss.sheet_mask().set_handler(F_S_CODICE,codice_handler);
ss.sheet_mask().set_handler(F_S_NOME,nome_handler);
*/
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
}
bool TTransfer_app::destroy()
{
delete _rel;
delete _msk;
/*
delete _donaz;
delete _contsan;
delete _sdonazioni;
delete _scontrolli;
delete _asoggetti;
*/
return TRUE;
}
bool TTransfer_app::menu(MENU_TAG m)
{
TMask& msk = get_mask();
const TDate oggi(TODAY);
KEY tasto;
do
{
tasto = msk.run();
switch (tasto)
{
case K_ESC: // annulla
msk.reset();
break;
case K_ENTER: // registra
{
TTransfer_app::scarica();
msk.reset();
}
break;
}
}
while (tasto != K_QUIT);
return FALSE;
}
void TTransfer_app::scarica()
{
TArray arr_exprs; // array delle TExpr corrispondenti ai campi da scaricare
TArray arr_fields; // array dei TField_text (campi indicati in .ini)
TConfig ini("esporta.ini");
TString_array campi;
int i = ini.list_paragraphs(campi);
int poshead = campi.find("HEADER");
campi.remove(poshead,TRUE);
for ( int k = 0; k < campi.items(); k++ )
{
const char* campo = campi.row(k);
TString_array vl;
int i = ini.list_variables(vl, TRUE, campo);
//for ( int j = 0; j < vl.items(); j++ )
int pos = vl.find(FIELD);
TExpr* espressione = vl.row(pos).get(1);
arr_exprs.add(espressione)
TToken_string variabile = vl.row(pos);
int pos = vl.find(LEN);
TToken_string variabile = vl.row(pos);
int pos = vl.find(DEC);
TToken_string variabile = vl.row(pos);
}
/*
TText_field campo()
arr_fields.add();
*/
}
}
int at5100(int argc, char* argv[])
{
TTransfer_app a;
a.run(argc, argv, "Scarico dati");
return 0;
}