~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.h

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#endif
29
29
 
30
30
#include <drizzled/common.h>
31
 
#include <mysys/iocache.h>
32
 
#include <assert.h>
33
 
#include <stdlib.h>
34
 
#include <string.h>
 
31
#include <cassert>
 
32
#include <cstdlib>
 
33
#include <cstring>
35
34
 
36
35
class String;
37
36
 
38
37
extern String my_empty_string;
39
38
extern const String my_null_string;
 
39
typedef struct st_mem_root MEM_ROOT;
 
40
typedef struct charset_info_st CHARSET_INFO;
40
41
 
41
42
#if defined(__cplusplus)
42
43
extern "C" {
66
67
  const CHARSET_INFO *str_charset;
67
68
 
68
69
public:
69
 
  String() :
70
 
    Ptr(0),
71
 
    str_length(0),
72
 
    Alloced_length(0),
73
 
    alloced(0),
74
 
    str_charset(&my_charset_bin) { }
75
 
 
76
 
  String(uint32_t length_arg) :
77
 
    Ptr(0),
78
 
    str_length(0),
79
 
    Alloced_length(0),
80
 
    alloced(0),
81
 
    str_charset(&my_charset_bin)
82
 
  {
83
 
    (void) real_alloc(length_arg);
84
 
  }
85
 
 
86
 
  String(const char *str, const CHARSET_INFO * const cs) :
87
 
    Ptr(const_cast<char*>(str)),
88
 
    str_length(static_cast<uint32_t>(strlen(str))),
89
 
    Alloced_length(0),
90
 
    alloced(0),
91
 
    str_charset(cs) { }
92
 
 
93
 
  String(const char *str, uint32_t len, const CHARSET_INFO * const cs) :
94
 
    Ptr(const_cast<char*>(str)),
95
 
    str_length(len),
96
 
    Alloced_length(0),
97
 
    alloced(0),
98
 
    str_charset(cs) { }
99
 
 
100
 
  String(char *str,uint32_t len, const CHARSET_INFO * const cs) :
101
 
    Ptr(str),
102
 
    str_length(len),
103
 
    Alloced_length(len),
104
 
    alloced(0),
105
 
    str_charset(cs) { }
106
 
 
107
 
  String(const String &str) :
108
 
    Ptr(str.Ptr),
109
 
    str_length(str.str_length),
110
 
    Alloced_length(str.Alloced_length),
111
 
    alloced(0),
112
 
    str_charset(str.str_charset) { }
113
 
 
114
 
  static void *operator new(size_t size, MEM_ROOT *mem_root)
115
 
  { return alloc_root(mem_root, static_cast<uint32_t>(size)); }
 
70
  String();
 
71
  String(uint32_t length_arg);
 
72
  String(const char *str, const CHARSET_INFO * const cs);
 
73
  String(const char *str, uint32_t len, const CHARSET_INFO * const cs);
 
74
  String(char *str, uint32_t len, const CHARSET_INFO * const cs);
 
75
  String(const String &str);
 
76
 
 
77
  static void *operator new(size_t size, MEM_ROOT *mem_root);
116
78
  static void operator delete(void *, size_t)
117
 
  { TRASH(ptr_arg, size); }
 
79
  { }
118
80
  static void operator delete(void *, MEM_ROOT *)
119
81
  { /* never called */ }
120
82
  ~String();
390
352
  }
391
353
};
392
354
 
393
 
static inline bool check_if_only_end_space(const CHARSET_INFO * const cs, char *str,
394
 
                                           char *end)
395
 
{
396
 
  return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
397
 
}
 
355
bool check_if_only_end_space(const CHARSET_INFO * const cs, char *str,
 
356
                             char *end);
398
357
 
399
358
extern "C++" {
400
359
bool operator==(const String &s1, const String &s2);