home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / word2x0a.zip / source / tblock.h < prev    next >
C/C++ Source or Header  |  1997-03-21  |  780b  |  47 lines

  1. /* $Id: tblock.h,v 1.2 1997/03/21 20:20:53 dps Exp $ */
  2. /* Dynamically grown text block */
  3.  
  4. #ifndef __tblock_h__
  5. #define __tblock_h__
  6.  
  7. class tblock
  8. {
  9. private:
  10.     struct block
  11.     {
  12.     int limit;
  13.     int pos;
  14.     char *text;
  15.     struct block *next;
  16.     };
  17.  
  18.     struct block dummy_block;
  19.     struct block *head;
  20.  
  21.     static const struct block dummy_init;
  22.     const block_size=1024;
  23.  
  24.     const char *collect(void) const;
  25.  
  26. public:
  27.     inline tblock(void)
  28.     {
  29.     dummy_block=dummy_init;
  30.     head=&dummy_block;
  31.     }
  32.     tblock(const tblock &);
  33.     
  34.     ~tblock(void);
  35.     void zero(void);
  36.     int add(char);
  37.     int add(const char *, int);
  38.     inline int add(const char *s)
  39.     {
  40.     return this->add(s, strlen(s));
  41.     }
  42.     tblock &operator=(const tblock &);
  43.     operator const char *();
  44. };
  45.  
  46. #endif
  47.