~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/my_readline.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-07-08 04:26:02 UTC
  • mto: (1089.3.4 merge)
  • mto: This revision was merged to the branch mainline in revision 1092.
  • Revision ID: osullivan.padraig@gmail.com-20090708042602-x4hmf9ny8dcpvb22
Replaced an instance where a uint8_t type was being used to hold a
collection of flags. Converted it to a std::bitset<2> instead.

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
18
 
 
19
 
#include <vector>
20
 
#include <sstream>
21
 
 
22
 
class LineBuffer
 
16
 
 
17
typedef struct st_line_buffer
23
18
{
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;
 
19
  File file;
 
20
  char *buffer;                 /* The buffer itself, grown as needed. */
 
21
  char *end;                    /* Pointer at buffer end */
 
22
  char *start_of_line,*end_of_line;
 
23
  uint32_t bufread;                     /* Number of bytes to get with each read(). */
 
24
  uint32_t eof;
33
25
  uint32_t max_size;
34
 
  bool eof;
35
 
};
 
26
  uint32_t read_length;         /* Length of last read string */
 
27
} LINE_BUFFER;
36
28
 
37
 
#endif /* CLIENT_LINEBUFFER_H */
 
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);