46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#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);
 | 
						|
  
 | 
						|
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(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);
 | 
						|
  
 | 
						|
  // returns the maximum ID used (<= n. of fields in file)                                       
 | 
						|
  long  max_id() const { return _id_max; }               
 | 
						|
  
 | 
						|
  // must be passed the basename of archive
 | 
						|
  TMemo_file(const char* archive);
 | 
						|
  ~TMemo_file();
 | 
						|
};                       
 | 
						|
 | 
						|
#endif 
 |