guy 6d79069eb6 Gestione tasti rapidi.
git-svn-id: svn://10.65.10.50/trunk@52 c028cbd2-c16b-5b4b-a496-9718f37d4682
1994-08-23 13:52:36 +00:00

133 lines
3.2 KiB
C++
Executable File

#ifndef __FILES_H
#define __FILES_H
#ifndef __OBJECT_H
#include <object.h>
#endif
#ifndef __EXTCTYPE_H
#include <extctype.h>
#endif
#ifndef __RECTYPES_H
#include <rectypes.h>
#endif
// @C
// Classe TFile : public TObject
//
// Il file. I suoi metodi comprendono tutte le procedure per l'accesso
// fisico di basso livello ai file.
//
// @END
class TFile : public TObject
{
// @DPRIV
SecDef* _file;
int _len;
int _base;
public:
// @FPUB
void open(const char* name, TFilelock lockmode = _manulock);
bool verify(const char* name);
void create(const char* name, TRecnotype nrecord = 10);
void chsize(const char* name, TRecnotype nrecord);
void close();
void unlink(const char* name);
void read(char* record, TRecnotype recnum, TReclock lock = _nolock);
void write(char* record, TRecnotype recnum, TReclock lock = _nolock);
int status() const ;
int& base() { return _base; }
int& len() { return _len; }
bool ok() const { return status() == NOERR; }
bool error() const { return status() != NOERR; }
TFile(int lenrec = 0, int base = 0);
virtual ~TFile();
};
// @C
// Classe TDir : public TObject
//
// @END
class TDir : public TObject
{
// @DPRIV
FileDes* _dir;
int _num;
public:
// @FPUB
void get(int nfile, TReclock lock = _nolock, TDirtype dirtype = _nordir, TDirop op = _nordirop);
void put(int nfile, TDirtype dirtype = _nordir, TDirop op = _nordirop);
void zero();
void set_eox(const RecNoType eox);
void set_len(const UINT16 len);
void set (const char * name, const RecNoType eod, const RecNoType flag, const char * des, const char * calc);
const char* name() const;
const char* des() const;
const char* expr() const;
TRecnotype& eod() const;
TRecnotype& eox() const;
TRecnotype& flags() const;
word& len();
int status(TDirtype dirtype = _nordir) const ;
int num() const { return _num;}
int items(TDirtype dirtype = _nordir) const;
FileDes* filedesc() const { return _dir; }
TDir();
virtual ~TDir();
};
// @C
// Classe TTrec : public TObject
//
// @END
class TTrec : public TSortable
{
// @DPRIV
RecDes* _rec;
int _num;
protected:
int compare(const TSortable& a) const;
public:
// @FPUB
void get(int nfile, TDirtype dirtype = _nordir);
void put(int nfile, TDirtype dirtype = _nordir);
void zero();
void rehash();
int status(TDirtype dirtype = _nordir) const ;
int num() const { return _num;}
int field(const char* fieldname) const;
RecDes* rec() const { return _rec;}
TTrec& operator =(const TTrec& b);
int fields() const { return _rec->NFields; }
int keys() const { return _rec->NKeys; }
void set_fields(int nfields) { _rec->NFields = nfields;}
void set_keys(int nkeys) { _rec->NKeys = nkeys;}
const char* fielddef(int fld) const; // ritorna una token string
const char* keydef(int key) const;
int len() const { return _rec->Fd[fields() - 1].RecOff +
_rec->Fd[fields() - 1].Len; }
#ifndef FOXPRO
void update_keydef(int key, const char* desc); //desc e' una token string
void update_fielddef(int nfld, const char* desc); //desc e' una token string
virtual void print_on(ostream& out) const;
virtual void read_from(istream& in);
#endif
TTrec();
virtual ~TTrec();
};
#endif // __FILES_H