diff options
Diffstat (limited to 'sql/gstream.h')
-rw-r--r-- | sql/gstream.h | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/sql/gstream.h b/sql/gstream.h index a3914a534dd..2e9513d2639 100644 --- a/sql/gstream.h +++ b/sql/gstream.h @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -class GTextReadStream +class Gis_read_stream { public: - enum TokTypes + enum enum_tok_types { unknown, eostream, @@ -29,41 +29,47 @@ public: comma }; - GTextReadStream(const char *buffer, int size) - :m_cur(buffer), m_limit(buffer + size), m_last_text_position(buffer), - m_err_msg(NULL) + Gis_read_stream(const char *buffer, int size) + :m_cur(buffer), m_limit(buffer + size), m_err_msg(NULL) {} - GTextReadStream(): m_cur(NULL), m_limit(NULL), m_err_msg(NULL) + Gis_read_stream(): m_cur(NullS), m_limit(NullS), m_err_msg(NullS) {} - - ~GTextReadStream() + ~Gis_read_stream() { my_free(m_err_msg, MYF(MY_ALLOW_ZERO_PTR)); } - int get_next_toc_type() const; - const char *get_next_word(int *word_len); - int get_next_number(double *d); - char get_next_symbol(); + enum enum_tok_types get_next_toc_type(); + bool get_next_word(LEX_STRING *); + bool get_next_number(double *); + bool check_next_symbol(char); - const char *get_last_text_position() const + inline void skip_space() { - return m_last_text_position; + while (my_isspace(&my_charset_latin1, *m_cur)) + m_cur++; + } + /* Skip next character, if match. Return 1 if no match */ + inline bool skip_char(char skip) + { + skip_space(); + if (*m_cur != skip) + return 1; /* Didn't find char */ + m_cur++; + return 0; } - void set_error_msg(const char *msg); // caller should free this pointer char *get_error_msg() { char *err_msg = m_err_msg; - m_err_msg = NULL; + m_err_msg= NullS; return err_msg; } protected: const char *m_cur; const char *m_limit; - const char *m_last_text_position; char *m_err_msg; }; |