115 lines
2.2 KiB
C++
Executable File
115 lines
2.2 KiB
C++
Executable File
#include <relapp.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Test Relapp
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTestrel_application : public TRelation_application
|
|
{
|
|
const char* _maskname;
|
|
const char* _num;
|
|
|
|
TRelation* _rel;
|
|
TMask* _msk;
|
|
|
|
protected:
|
|
virtual bool user_create();
|
|
virtual bool user_destroy();
|
|
virtual TMask* get_mask(int mode) { return _msk; }
|
|
virtual bool changing_mask(int mode) { return FALSE;}
|
|
virtual TRelation* get_relation() const { return _rel; }
|
|
|
|
public:
|
|
TTestrel_application(const char* name, const char* num);
|
|
};
|
|
|
|
TTestrel_application::TTestrel_application(const char* name, const char* num)
|
|
: _maskname(name), _num(num),
|
|
_msk(NULL), _rel(NULL)
|
|
{}
|
|
|
|
|
|
bool TTestrel_application::user_create()
|
|
{
|
|
int id = atoi(_num);
|
|
if (id > 0) _rel = new TRelation(id);
|
|
else _rel = new TRelation(_num);
|
|
|
|
_msk = new TMask(_maskname);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool TTestrel_application::user_destroy()
|
|
{
|
|
delete _msk;
|
|
delete _rel;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Testmask
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTest_application : public TApplication
|
|
{
|
|
const char* _maskname;
|
|
|
|
protected:
|
|
bool create() { return menu(0); }
|
|
bool destroy() { return TRUE; }
|
|
bool menu(MENU_TAG);
|
|
|
|
public:
|
|
TTest_application(const char* name) : _maskname(name) {}
|
|
};
|
|
|
|
bool TTest_application::menu(MENU_TAG)
|
|
{
|
|
if (*_maskname)
|
|
{
|
|
TMask m(_maskname);
|
|
KEY k = m.run();
|
|
if (k == K_QUIT) stop_run();
|
|
}
|
|
else
|
|
{
|
|
TMask mr("ba3400a");
|
|
while (mr.run() == K_ENTER)
|
|
{
|
|
TMask m(mr.get(102));
|
|
KEY k = m.run();
|
|
// if (k == K_QUIT) stop_run();
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
int ba3400(int argc, char* argv[])
|
|
{
|
|
TApplication::check_parameters(argc, argv);
|
|
// if (argc < 3)
|
|
// {
|
|
// error_box("You should specify a mask");
|
|
// return 1;
|
|
// }
|
|
|
|
if (argc <= 3)
|
|
{
|
|
TTest_application a(argc == 2 ? "" : argv[2]);
|
|
a.run(argc, argv, "Testmask");
|
|
}
|
|
else
|
|
{
|
|
TTestrel_application a(argv[2], argv[3]);
|
|
a.run(argc, argv, "Gestione archivi");
|
|
}
|
|
return 0;
|
|
}
|
|
|