~drizzle-trunk/drizzle/development

584.4.2 by Monty Taylor
Split out hybrid_type_traits.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef DRIZZLED_HYBRID_TYPE_TRAITS_H
21
#define DRIZZLED_HYBRID_TYPE_TRAITS_H
22
1241.9.21 by Monty Taylor
Removed sql_string.h from server_includes.h.
23
#include "drizzled/common.h"
1315.2.14 by Stewart Smith
move Item_result out to its own header file and out of common.h
24
#include "drizzled/item_result.h"
584.4.2 by Monty Taylor
Split out hybrid_type_traits.
25
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
26
namespace drizzled
27
{
28
584.4.2 by Monty Taylor
Split out hybrid_type_traits.
29
class Item;
30
class Field;
31
class Hybrid_type;
32
class String;
33
class my_decimal;
34
35
/* Hybryd_type_traits interface + default implementation for REAL_RESULT */
36
37
class Hybrid_type_traits
38
{
39
public:
40
41
  virtual Item_result type() const;
42
43
  virtual void
44
  fix_length_and_dec(Item *item, Item *arg) const;
45
46
  /* Hybrid_type operations. */
47
  virtual void set_zero(Hybrid_type *val) const;
48
  virtual void add(Hybrid_type *val, Field *f) const;
49
  virtual void div(Hybrid_type *val, uint64_t u) const;
50
51
  virtual int64_t val_int(Hybrid_type *val,
52
                          bool unsigned_flag) const;
53
  virtual double val_real(Hybrid_type *val) const;
54
  virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const;
55
  virtual String *val_str(Hybrid_type *val, String *buf,
56
                          uint8_t decimals) const;
57
58
  static const Hybrid_type_traits *instance();
59
  Hybrid_type_traits();
60
  virtual ~Hybrid_type_traits();
61
62
};
63
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
64
} /* namespace drizzled */
65
584.4.2 by Monty Taylor
Split out hybrid_type_traits.
66
#endif /* DRIZZLED_HYBRID_TYPE_TRAITS_H */