1995-06-12 10:49:19 +00:00
|
|
|
#ifndef __MEMO_H
|
|
|
|
#define __MEMO_H
|
|
|
|
|
|
|
|
#ifndef __TEXT_H
|
|
|
|
#include <text.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// quick and dirty memofile class
|
|
|
|
// to be used with isamfiles
|
|
|
|
// memo field is a long integer, memo file is <isamname>.mem
|
|
|
|
|
|
|
|
class TMemo_file : public TObject
|
|
|
|
{
|
|
|
|
bool _dirty;
|
|
|
|
FILE* _fp;
|
|
|
|
long _current;
|
|
|
|
TFilename _fname;
|
|
|
|
bool _isnew;
|
|
|
|
long _id_max;
|
|
|
|
long _next_ofs;
|
|
|
|
|
|
|
|
bool _find_id(long id);
|
1995-06-12 16:05:26 +00:00
|
|
|
|
1995-06-12 10:49:19 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
// retrieves text with specified ID (or last one passed);
|
|
|
|
// returns TRUE if successful
|
|
|
|
bool get_field(TTextfile& t, long id = -1l);
|
|
|
|
// sets field to specified text; if not present
|
|
|
|
// returns new ID; if error returns -1, otherwise 0
|
|
|
|
long set_field(const TTextfile& t, long id = -1l);
|
|
|
|
// removes field and pakkettates file
|
|
|
|
bool remove_field(long id);
|
|
|
|
// calls editor to edit text (specified as mem into config)
|
|
|
|
bool edit_field(long id = -1l);
|
1995-06-12 16:05:26 +00:00
|
|
|
|
1995-06-12 10:49:19 +00:00
|
|
|
// returns the maximum ID used (<= n. of fields in file)
|
|
|
|
long max_id() const { return _id_max; }
|
1995-06-12 16:05:26 +00:00
|
|
|
|
1995-06-12 10:49:19 +00:00
|
|
|
// must be passed the basename of archive
|
|
|
|
TMemo_file(const char* archive);
|
|
|
|
~TMemo_file();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|