Commit 3e27677b authored by Alexander Barkov's avatar Alexander Barkov

Cleanup: moving the definition of Lex_cstring from vers_string.h to lex_string.h

parent e98f3bcf
......@@ -18,8 +18,46 @@
#ifndef LEX_STRING_INCLUDED
#define LEX_STRING_INCLUDED
typedef struct st_mysql_const_lex_string LEX_CSTRING;
class Lex_cstring : public LEX_CSTRING
{
public:
Lex_cstring()
{
str= NULL;
length= 0;
}
Lex_cstring(const char *_str, size_t _len)
{
str= _str;
length= _len;
}
Lex_cstring(const char *start, const char *end)
{
DBUG_ASSERT(start <= end);
str= start;
length= end - start;
}
void set(const char *_str, size_t _len)
{
str= _str;
length= _len;
}
};
class Lex_cstring_strlen: public Lex_cstring
{
public:
Lex_cstring_strlen(const char *from)
:Lex_cstring(from, from ? strlen(from) : 0)
{ }
};
/* Functions to compare if two lex strings are equal */
static inline bool lex_string_cmp(CHARSET_INFO *charset, const LEX_CSTRING *a,
......
......@@ -17,6 +17,8 @@
#ifndef VERS_STRING_INCLUDED
#define VERS_STRING_INCLUDED
#include "lex_string.h"
/*
LEX_CSTRING with comparison semantics.
*/
......@@ -45,41 +47,6 @@ struct Compare_identifiers
}
};
class Lex_cstring : public LEX_CSTRING
{
public:
Lex_cstring()
{
str= NULL;
length= 0;
}
Lex_cstring(const char *_str, size_t _len)
{
str= _str;
length= _len;
}
Lex_cstring(const char *start, const char *end)
{
DBUG_ASSERT(start <= end);
str= start;
length= end - start;
}
void set(const char *_str, size_t _len)
{
str= _str;
length= _len;
}
};
class Lex_cstring_strlen: public Lex_cstring
{
public:
Lex_cstring_strlen(const char *from)
:Lex_cstring(from, from ? strlen(from) : 0)
{ }
};
template <class Compare>
struct Lex_cstring_with_compare : public Lex_cstring
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment