Menu

[r151]: / trunk / cppunit / src / cppunit / estring.h  Maximize  Restore  History

Download this file

32 lines (21 with data), 927 Bytes

 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
#ifndef CPPUNIT_ESTRING_H
#define CPPUNIT_ESTRING_H
#include <cstdio>
namespace CppUnit {
/// Create a string from a const char pointer
inline std::string estring (const char *cstring)
{ return std::string (cstring); }
/// Create a string from a string (for uniformities' sake)
inline std::string estring (std::string& expandedString)
{ return expandedString; }
/// Create a string from an int
inline std::string estring (int number)
{ char buffer [50]; sprintf (buffer, "%d", number); return std::string (buffer); }
/// Create a string from a long
inline std::string estring (long number)
{ char buffer [50]; sprintf (buffer, "%ld", number); return std::string (buffer); }
/// Create a string from a double
inline std::string estring (double number)
{ char buffer [50]; sprintf (buffer, "%f", number); return std::string (buffer); }
} // namespace CppUnit
#endif // CPPUNIT_ESTRING_H
MongoDB Logo MongoDB