~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/linebuffer.h

  • Committer: Robert Klahn
  • Date: 2009-07-17 03:11:10 UTC
  • mto: (1093.1.23 captain)
  • mto: This revision was merged to the branch mainline in revision 1099.
  • Revision ID: rklahn@quad-20090717031110-0sn0vgfk1dzdbwg1
Replace typedef struct LINE_BUFFER with class LineBuffer, encapsulating current logic

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
 
16
#ifndef CLIENT_LINEBUFFER_H
 
17
#define CLIENT_LINEBUFFER_H
16
18
 
17
 
typedef struct st_line_buffer
 
19
class LineBuffer
18
20
{
 
21
public:
 
22
  LineBuffer(uint32_t max_size,FILE *file);
 
23
  ~LineBuffer();
 
24
 
 
25
  void add_string(const char *argument);
 
26
  char *readline();
 
27
private:
 
28
  char *internal_readline(uint32_t *out_length);
 
29
  size_t fill_buffer();
 
30
 
19
31
  File file;
20
32
  char *buffer;                 /* The buffer itself, grown as needed. */
21
33
  char *end;                    /* Pointer at buffer end */
24
36
  uint32_t eof;
25
37
  uint32_t max_size;
26
38
  uint32_t read_length;         /* Length of last read string */
27
 
} LINE_BUFFER;
 
39
};
28
40
 
29
 
extern LINE_BUFFER *batch_readline_init(uint32_t max_size,FILE *file);
30
 
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
31
 
extern char *batch_readline(LINE_BUFFER *buffer);
32
 
extern void batch_readline_end(LINE_BUFFER *buffer);
 
41
#endif /* CLIENT_LINEBUFFER_H */