summaryrefslogtreecommitdiff
path: root/server/src/tostring.h
blob: 137969f7beefe93bdb94ab3879eed15c3c4c1bd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
 *            tostring.h
 *
 *  Thu Mar 29 13:16:13 CEST 2007
 *  Copyright  2006 Bent Bisballe Nyeng
 *  deva@aasimon.org
 ****************************************************************************/

/*
 *  This file is part of Artefact.
 *
 *  Artefact is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Artefact is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Artefact; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#ifndef __ARTEFACT_TOSTRING_H__
#define __ARTEFACT_TOSTRING_H__

#include <string>

/**
 * toString converts a nonstring variable into an STL string.
 * @param s A string, converted into a... string...
 * @return The STL string containing the converted value.
 */
std::string toString(std::string s);

/**
 * toString converts a nonstring variable into an STL string.
 * @param c A char, converted into a string.
 * @return The STL string containing the converted value.
 */
std::string toString(char c);

/**
 * toString converts a nonstring variable into an STL string.
 * @param c A unsigned char, converted into a string.
 * @return The STL string containing the converted value.
 */
std::string toString(unsigned char c);

/**
 * toString converts a nonstring variable into an STL string.
 * @param si A short integer, converted into a string.
 * @return The STL string containing the converted value.
 */
std::string toString(short int si);

/**
 * toString converts a nonstring variable into an STL string.
 * @param su An unsigned short integer, converted into a string.
 * @return The STL string containing the converted value.
 */
std::string toString(short unsigned int su);

/**
 * toString converts a nonstring variable into an STL string.
 * @param li A long integer, converted into a string.
 * @return The STL string containing the converted value.
 */
std::string toString(int li);

/**
 * toString converts a nonstring variable into an STL string.
 * @param lu An unsigned long integer, converted into a string.
 * @return The STL string containing the converted value.
 */
std::string toString(unsigned int lu);

/**
 * toString converts a nonstring variable into an STL string.
 * @param b A boolean value, converted into a string (true/false).
 * @return The STL string containing the converted value.
 */
std::string toString(bool b);

/**
 * toString converts a nonstring variable into an STL string.
 * @param f A floating point value, converted into a string.
 * @param precision The precision to use when converting.
 * @return The STL string containing the converted value.
 */
std::string toString(float f, unsigned int precision = 8);

/**
 * toString converts a nonstring variable into an STL string.
 * @param d A double precision floating point value, converted into a string.
 * @param precision The precision to use when converting.
 * @return The STL string containing the converted value.
 */
std::string toString(double d, unsigned int precision = 16);

/**
 * toString converts a nonstring variable into an STL string.
 * @param ld A long double precision floating point value, converted into a string.
 * @param precision The precision to use when converting.
 * @return The STL string containing the converted value.
 */
std::string toString(long double ld, unsigned int precision = 32);

#endif/*__ARTEFACT_TOSTRING_H__*/