t_str_chunk_reader Class Reference

Class for reading string chunks. More...

#include <sgftoken.hpp>

Inheritance diagram for t_str_chunk_reader:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 t_str_chunk_reader (char *the_buffer, unsigned len)
 Constructor.
virtual ~t_str_chunk_reader ()
 Virtual destructor.

Protected Member Functions

virtual bool get_chunk ()=0
 Gets the current chunk.

Protected Attributes

char * buffer
unsigned buf_len

Friends

bool read_by_chunks (char, t_str_chunk_reader &)
 Reads characters from 'sg_input_f' until 'term' is encountered.

Detailed Description

Class for reading string chunks.


Constructor & Destructor Documentation

t_str_chunk_reader::t_str_chunk_reader ( char *  the_buffer,
unsigned  len 
) [inline]

Constructor.

Parameters:
[in] the_buffer The buffer
[in] len The maximal chunk length (without '\0')

virtual t_str_chunk_reader::~t_str_chunk_reader (  )  [inline, virtual]

Virtual destructor.


Member Function Documentation

virtual bool t_str_chunk_reader::get_chunk (  )  [protected, pure virtual]

Gets the current chunk.

Note:
get_chunk should return 0 if OK and nonzero on a problem. In the latter case the rest of the string is skipped.
Bug:
zero or non-zero not appropriate for boolean value.


Friends And Related Function Documentation

bool read_by_chunks ( char  term,
t_str_chunk_reader reader 
) [friend]

Reads characters from 'sg_input_f' until 'term' is encountered.

The characters are written to 'reader.buffer'. As soon as the buffer is filled up it is flushed using 'reader.get_chunk'. If this function returns nonzero, the further characters up to 'term' or the end of the file are skipped. Unless EOF encounered the terminating character 'term' is written to input_token_buf, else (if EOF encountered) the first entry of input_token_buf is set to zero. last_delim is always set to zero. The function returns zero if 'reader.get_chunk' has returned zero at all the calls and nonzero otherwise.

Note:
'\' is always skipped and the following character is not checked for 'term'. \ \ is translated to '\'.
Bug:
zero or non-zero not appropriate for boolean value.


Member Data Documentation

char* t_str_chunk_reader::buffer [protected]

unsigned t_str_chunk_reader::buf_len [protected]


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 12:34:43 2007 for SG2 by  doxygen 1.5.2