summaryrefslogtreecommitdiff
path: root/support/word2x/tblock.h.orig
blob: 8aef3cd47134035661c77948e421a1e60c888472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* $Id: tblock.h,v 1.2 1997/03/21 20:20:53 dps Exp $ */
/* Dynamically grown text block */

#ifndef __tblock_h__
#define __tblock_h__

#include <strings.h>

class tblock
{
private:
    struct block
    {
	int limit;
	int pos;
	char *text;
	struct block *next;
    };

    struct block dummy_block;
    struct block *head;

    static const struct block dummy_init;
    static const int block_size=1024;

    const char *collect(void) const;

public:
    inline tblock(void)
    {
	dummy_block=dummy_init;
	head=&dummy_block;
    }
    tblock(const tblock &);
    
    ~tblock(void);
    void zero(void);
    int add(char);
    int add(const char *, int);
    inline int add(const char *s)
    {
	return this->add(s, strlen(s));
    }
    tblock &operator=(const tblock &);
    operator const char *();
};

#endif