summaryrefslogtreecommitdiff
path: root/support/word2x/tblock.h
blob: 0879ace8bbc46bcc64505d7d46a42df1bf79fa6a (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
/* $Id: tblock.h,v 1.2 1997/03/21 20:20:53 dps Exp $ */
/* Dynamically grown text block */

#ifndef __tblock_h__
#define __tblock_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