1 |
|
2 |
#ifndef CPPUNIT_ESTRING_H |
3 |
#define CPPUNIT_ESTRING_H |
4 |
|
5 |
#include <cstdio> |
6 |
|
7 |
#include "CppUnitTest/CppUnitTestNamespace.h" |
8 |
BEGIN_NAMESPACE_CPPUNITTEST |
9 |
|
10 |
// Create a string from a const char pointer |
11 |
inline std::string estring (const char *cstring) |
12 |
{ return std::string (cstring); } |
13 |
|
14 |
// Create a string from a string (for uniformities' sake) |
15 |
inline std::string estring (std::string& expandedString) |
16 |
{ return expandedString; } |
17 |
|
18 |
// Create a string from an int |
19 |
inline std::string estring (int number) |
20 |
{ char buffer [50]; sprintf (buffer, "%d", number); return std::string (buffer); } |
21 |
|
22 |
// Create a string from a long |
23 |
inline std::string estring (long number) |
24 |
{ char buffer [50]; sprintf (buffer, "%ld", number); return std::string (buffer); } |
25 |
|
26 |
// Create a string from a double |
27 |
inline std::string estring (double number) |
28 |
{ char buffer [50]; sprintf (buffer, "%f", number); return std::string (buffer); } |
29 |
|
30 |
END_NAMESPACE_CPPUNITTEST |
31 |
|
32 |
#endif |
33 |
|
34 |
|
35 |
|
36 |
|