~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/option_string.h

  • Committer: lbieber
  • Date: 2010-09-11 16:33:45 UTC
  • mfrom: (1757.1.2 build)
  • Revision ID: lbieber@orisndriz03-20100911163345-na1t8m18at9thsjl
Merge Vijay - added utf 8 tamil test case suite and test case for creating a database in tamil
Merge Brian - Small set of refactoring (includes one case of memset on a table object).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Vijay Samuel
5
 
 *  Copyright (C) 2008 MySQL
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; either version 2 of the License, or
10
 
 *  (at your option) any later version.
11
 
 *
12
 
 *  This program is distributed in the hope that it will be useful,
13
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *  GNU General Public License for more details.
16
 
 *
17
 
 *  You should have received a copy of the GNU General Public License
18
 
 *  along with this program; if not, write to the Free Software
19
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 */
21
 
 
22
 
#ifndef CLIENT_OPTION_STRING_H
23
 
#define CLIENT_OPTION_STRING_H
24
 
 
25
 
#include "client_priv.h"
26
 
#include <iostream>
27
 
#include <string>
28
 
#include <cstdlib>
29
 
#include <drizzled/gettext.h>
30
 
 
31
 
class OptionString 
32
 
{
33
 
public:
34
 
  OptionString(char *in_string,
35
 
               size_t in_length,
36
 
               char *in_option,
37
 
               size_t in_option_length,
38
 
               OptionString *in_next) :
39
 
    string(in_string),
40
 
    length(in_length),
41
 
    option(in_option),
42
 
    option_length(in_option_length),
43
 
    next(in_next)
44
 
  { }  
45
 
 
46
 
  OptionString() :
47
 
    string(NULL),
48
 
    length(0),
49
 
    option(NULL),
50
 
    option_length(0),
51
 
    next(NULL)
52
 
  { }
53
 
 
54
 
  ~OptionString()
55
 
  {
56
 
    if (getString())
57
 
      free(getString());
58
 
    if (getOption())
59
 
      free(getOption());
60
 
  }
61
 
 
62
 
  char *getString() const
63
 
  {
64
 
    return string;
65
 
  }
66
 
 
67
 
  size_t getLength() const
68
 
  {
69
 
    return length;
70
 
  }
71
 
 
72
 
  char *getOption() const
73
 
  {
74
 
  return option;
75
 
  }
76
 
 
77
 
  size_t getOptionLength() const
78
 
  {
79
 
    return option_length;
80
 
  }
81
 
 
82
 
  OptionString *getNext() const
83
 
  {
84
 
    return next;
85
 
  }
86
 
 
87
 
  void setString(char *in_string)
88
 
  {
89
 
    string= in_string;
90
 
    length= strlen(in_string);
91
 
  }
92
 
 
93
 
  void setOption(char *in_option)
94
 
  {
95
 
    option= strdup(in_option);
96
 
    option_length= strlen(in_option);
97
 
  }
98
 
 
99
 
  void setNext(OptionString *in_next)
100
 
  {
101
 
    next= in_next;
102
 
  }
103
 
  
104
 
private:
105
 
  char *string;
106
 
  size_t length;
107
 
  char *option;
108
 
  size_t option_length;
109
 
  OptionString *next;
110
 
};
111
 
 
112
 
#endif /* CLIENT_OPTION_STRING_H */