-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStringBuilderExtension.h
48 lines (40 loc) · 1.07 KB
/
StringBuilderExtension.h
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
#ifndef __UTILS_COLLECTION__STRING_BUILDER_EXTENSION_H__
#define __UTILS_COLLECTION__STRING_BUILDER_EXTENSION_H__
#include "StringBuilder.h"
inline void operator +=(StringBuilder& oBuilder, int iValue)
{
char pBuffer[33];
sprintf(pBuffer, "%d", iValue);
oBuilder.Append(pBuffer);
}
inline void operator +=(StringBuilder& oBuilder, unsigned int iValue)
{
char pBuffer[33];
sprintf(pBuffer, "%u", iValue);
oBuilder.Append(pBuffer);
}
inline void operator +=(StringBuilder& oBuilder, long iValue)
{
char pBuffer[65];
sprintf(pBuffer, "%ld", iValue);
oBuilder.Append(pBuffer);
}
inline void operator +=(StringBuilder& oBuilder, unsigned long iValue)
{
char pBuffer[65];
sprintf(pBuffer, "%lu", iValue);
oBuilder.Append(pBuffer);
}
inline void operator +=(StringBuilder& oBuilder, float fValue)
{
char pBuffer[65];
sprintf(pBuffer, "%f", fValue);
oBuilder.Append(pBuffer);
}
inline void operator +=(StringBuilder& oBuilder, double fValue)
{
char pBuffer[65];
sprintf(pBuffer, "%f", fValue);
oBuilder.Append(pBuffer);
}
#endif //__UTILS_COLLECTION__STRING_BUILDER_EXTENSION_H__