51 lines
1018 B
C++
51 lines
1018 B
C++
|
#include <relapp.h>
|
||
|
|
||
|
#include "ba4.h"
|
||
|
#include "ba4700a.h"
|
||
|
|
||
|
class TContact_application : public TRelation_application
|
||
|
{
|
||
|
TMask* _msk;
|
||
|
TRelation* _rel;
|
||
|
|
||
|
protected:
|
||
|
virtual bool user_create() ;
|
||
|
virtual bool user_destroy() ;
|
||
|
virtual TMask* get_mask(int mode) { return _msk;}
|
||
|
virtual TRelation* get_relation() const { return _rel;}
|
||
|
virtual bool get_next_key(TToken_string& key);
|
||
|
|
||
|
public:
|
||
|
};
|
||
|
|
||
|
bool TContact_application::get_next_key(TToken_string& key)
|
||
|
{
|
||
|
TRecnotype n = 1;
|
||
|
TLocalisamfile& f = _rel->file();
|
||
|
if (f.last() == NOERR)
|
||
|
n += f.get_long("CONTACT");
|
||
|
key.format("%d|%ld", F_CONTACT, n);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool TContact_application::user_create()
|
||
|
{
|
||
|
_rel = new TRelation(LF_CONTACT) ;
|
||
|
_msk = new TMask("ba4700a") ;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool TContact_application::user_destroy()
|
||
|
{
|
||
|
delete _msk;
|
||
|
delete _rel;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
int ba4700(int argc, char* argv[])
|
||
|
{
|
||
|
TContact_application a;
|
||
|
a.run(argc, argv, TR("Contatti"));
|
||
|
return 0;
|
||
|
}
|