NetBurner 3.5.8
PDF Version
web_buffers.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#ifndef _WEB_BUFFERS_H
6#define _WEB_BUFFERS_H
7#include <nbstring.h>
8
9
13
14
20{
21 public:
22 // A write of ZERO bytes indicates end of data stream
23 virtual int WriteData(const unsigned char *pCopyFrom, int num_bytes) = 0;
24 virtual int ReadFrom(int fd) = 0;
25 virtual void ProcessHeader(const char * hdr) {};
26};
27
31class SimpleBufferObject : public buffer_object
32{
33protected:
34 unsigned char *cp_to;
35 int space_left;
36 int used;
37 public:
38
39 virtual int WriteData(const unsigned char *pCopyFrom, int num_bytes);
40 virtual int ReadFrom(int fd);
41
42 SimpleBufferObject(unsigned char *p, int len)
43 {
44 cp_to = p;
45 space_left = len;
46 used = 0;
47 };
48 int AmountUsed() { return used; };
49};
50
54class StringBufferObject : public buffer_object
55{
56 NBString & TheString;
57 public:
58
59 virtual int WriteData(const unsigned char *pCopyFrom, int num_bytes);
60 virtual int ReadFrom(int fd);
61
62 StringBufferObject(NBString & s) :TheString(s){};
63};
64
66
67#endif
Lightweight alternative to C++ CString class.
Definition nbstring.h:118
Base class for web client response buffers.
Definition web_buffers.h:20