492.1.7
by Monty Taylor
Moved test() to its own file. |
1 |
/* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 MySQL
|
|
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; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
21 |
#ifndef DRIZZLE_SERVER_UTIL_CONVERT
|
|
22 |
#define DRIZZLE_SERVER_UTIL_CONVERT
|
|
23 |
||
24 |
#include <string> |
|
25 |
#include <iostream> |
|
26 |
#include <sstream> |
|
971.3.11
by Eric Day
Header needed for Solaris/SunCC. |
27 |
#include <stdint.h> |
492.1.7
by Monty Taylor
Moved test() to its own file. |
28 |
|
29 |
template <class T> |
|
30 |
std::string to_string(T t) |
|
31 |
{
|
|
32 |
std::ostringstream o; |
|
33 |
o << t; |
|
34 |
return o.str(); |
|
35 |
}
|
|
36 |
||
37 |
template <class T> |
|
38 |
std::string& to_string(std::string &str, T t) |
|
39 |
{
|
|
40 |
std::ostringstream o(str); |
|
41 |
o << t; |
|
42 |
return str; |
|
43 |
}
|
|
44 |
||
971.3.9
by Eric Day
Removed dependency for hex convert, fixed a few Protocol class issues for Solaris. |
45 |
extern "C" |
46 |
{
|
|
47 |
uint64_t drizzled_string_to_hex(char *to, const char *from, |
|
48 |
uint64_t from_size); |
|
49 |
}
|
|
50 |
||
492.1.7
by Monty Taylor
Moved test() to its own file. |
51 |
#endif
|