~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/linebuffer.h

  • Committer: Monty Taylor
  • Date: 2010-10-15 17:18:02 UTC
  • mto: (1859.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1860.
  • Revision ID: mordred@inaugust.com-20101015171802-qhk6zyfhrkvprr1n
Added support for registering regular sys_var instances via module::Context.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
/* readline for batch mode */
17
 
 
18
 
typedef struct st_line_buffer
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
15
 
 
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;
26
 
  ulong max_size;
27
 
  ulong read_length;            /* Length of last read string */
28
 
} LINE_BUFFER;
29
 
 
30
 
extern LINE_BUFFER *batch_readline_init(ulong 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);
 
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;
 
33
  uint32_t max_size;
 
34
  bool eof;
 
35
};
 
36
 
 
37
#endif /* CLIENT_LINEBUFFER_H */