~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/linebuffer.h

  • Committer: Andrew Hutchings
  • Date: 2010-11-07 12:27:27 UTC
  • mto: (1912.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1913.
  • Revision ID: andrew@linuxjedi.co.uk-20101107122727-r9govyzy73qcyvx5
Re-write of linebuffer to stop buffer overrrun and hopefully improve performance
Error if max_line_length hit instead of eating into RAM

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include <vector>
20
20
#include <sstream>
 
21
#include <iostream>
 
22
#include <boost/iostreams/stream.hpp>
 
23
#include <boost/iostreams/device/file_descriptor.hpp>
21
24
 
22
25
class LineBuffer
23
26
{
24
27
public:
25
28
  LineBuffer(uint32_t max_size,FILE *file);
26
 
 
27
29
  void addString(const std::string &argument);
28
30
  char *readline();
29
31
private:
30
32
  FILE *file;
31
 
  std::stringstream buffer;
32
33
  std::vector<char> line;
 
34
  std::iostream *file_stream;
33
35
  uint32_t max_size;
34
 
  bool eof;
35
36
};
36
37
 
37
38
#endif /* CLIENT_LINEBUFFER_H */