~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lex_string.h

  • Committer: Olaf van der Spek
  • Date: 2011-08-04 08:13:04 UTC
  • mfrom: (2384 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2385.
  • Revision ID: olafvdspek@gmail.com-20110804081304-rlejjpvoos17bjdf
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#pragma once
21
21
 
22
 
#include <stddef.h>
 
22
#include <cstddef>
23
23
 
24
24
namespace drizzled {
25
25
 
26
26
/*
27
 
  LEX_STRING -- a pair of a C-string and its length.
 
27
  lex_string_t -- a pair of a C-string and its length.
28
28
*/
29
29
 
30
30
/* This definition must match the one given in mysql/plugin.h */
31
 
struct LEX_STRING
 
31
struct lex_string_t
32
32
{
33
33
  const char* begin() const
34
34
  {
44
44
  size_t length;
45
45
};
46
46
 
47
 
inline const LEX_STRING &null_lex_string()
 
47
inline const lex_string_t &null_lex_string()
48
48
{
49
 
  static LEX_STRING tmp= { NULL, 0 };
 
49
  static lex_string_t tmp= { NULL, 0 };
50
50
  return tmp;
51
51
}
52
52
 
53
 
#define NULL_LEX_STRING null_lex_string()
 
53
#define NULL_lex_string_t null_lex_string()
54
54
 
55
 
struct execute_string_t : public LEX_STRING
 
55
struct execute_string_t : public lex_string_t
56
56
{
57
57
private:
58
58
  bool is_variable;
63
63
    return is_variable;
64
64
  }
65
65
 
66
 
  void set(const LEX_STRING& ptr, bool is_variable_arg= false)
 
66
  void set(const lex_string_t& ptr, bool is_variable_arg= false)
67
67
  {
68
68
    is_variable= is_variable_arg;
69
69
    str= ptr.str;
72
72
 
73
73
};
74
74
 
75
 
#define STRING_WITH_LEN(X) (X), (static_cast<size_t>((sizeof(X) - 1)))
76
 
#define C_STRING_WITH_LEN(X) (const_cast<char *>((X))), (static_cast<size_t>((sizeof(X) - 1)))
 
75
#define STRING_WITH_LEN(X) (X), (static_cast<size_t>((sizeof(X) - 1))) // remove size_t cast
 
76
#define C_STRING_WITH_LEN(X) (const_cast<char*>((X))), (static_cast<size_t>((sizeof(X) - 1)))
77
77
 
78
78
} /* namespace drizzled */
79
79