~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/linebuffer.h

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

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
 
/* readline for batch mode */
17
 
 
18
 
typedef struct st_line_buffer
 
16
#ifndef CLIENT_LINEBUFFER_H
 
17
#define CLIENT_LINEBUFFER_H
 
18
 
 
19
#include <vector>
 
20
#include <sstream>
 
21
 
 
22
class LineBuffer
19
23
{
20
 
  File file;
21
 
  char *buffer;                 /* The buffer itself, grown as needed. */
22
 
  char *end;                    /* Pointer at buffer end */
23
 
  char *start_of_line,*end_of_line;
24
 
  uint bufread;                 /* Number of bytes to get with each read(). */
25
 
  uint eof;
 
24
public:
 
25
  LineBuffer(uint32_t max_size,FILE *file);
 
26
 
 
27
  void addString(const std::string &argument);
 
28
  char *readline();
 
29
private:
 
30
  FILE *file;
 
31
  std::stringstream buffer;
 
32
  std::vector<char> line;
26
33
  uint32_t max_size;
27
 
  uint32_t read_length;         /* Length of last read string */
28
 
} LINE_BUFFER;
 
34
  bool eof;
 
35
};
29
36
 
30
 
extern LINE_BUFFER *batch_readline_init(uint32_t max_size,FILE *file);
31
 
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str);
32
 
extern char *batch_readline(LINE_BUFFER *buffer);
33
 
extern void batch_readline_end(LINE_BUFFER *buffer);
 
37
#endif /* CLIENT_LINEBUFFER_H */