00001 #include <stdlib.h>
00002 #include <stdio.h>
00003 #include "StString.h"
00004
00005
00006 StString& StString::operator<<(long long I)
00007 {
00008 char cbuf[200];
00009 if (!fPrec) {
00010 sprintf(cbuf,"%ld",(long)I);
00011 } else {
00012 sprintf(cbuf,"%.*ld",fPrec,(long)I);
00013 }
00014 fPrec = 0;
00015 (*this) += cbuf;
00016 return *this;
00017 }
00018
00019 StString& StString::operator<<(long I)
00020 { long long l = I; *this << l;return *this;}
00021
00022 StString& StString::operator<<(int I)
00023 { long long l = I; *this << l;return *this;}
00024
00025 StString& StString::operator<<(short I)
00026 { long long l = I; *this << l;return *this;}
00027
00028 StString& StString::operator<<(unsigned long long I)
00029 {
00030 char cbuf[100];
00031 if (!fPrec) {
00032 sprintf(cbuf,"%lu",(unsigned long)I);
00033 } else {
00034 sprintf(cbuf,"%.*lu",fPrec,(unsigned long)I);
00035 }
00036 fPrec = 0;
00037 (*this) += cbuf;
00038 return (*this);
00039 }
00040
00041 StString& StString::operator<<(unsigned long I)
00042 { unsigned long long l = I; *this << l;return *this;}
00043
00044 StString& StString::operator<<(unsigned int I)
00045 { unsigned long long l = I; *this << l;return *this;}
00046
00047 StString& StString::operator<<(unsigned short I)
00048 { unsigned long long l = I; *this << l;return *this;}
00049
00050 StString& StString::operator<<(double I)
00051 {
00052 char cbuf[200];
00053 if (!fPrec) {
00054 sprintf(cbuf,"%g",I);
00055 } else {
00056 sprintf(cbuf,"%.*g",fPrec,I);
00057 }
00058 fPrec = 0;
00059 (*this) += cbuf;
00060 return *this;
00061 }
00062
00063
00064 StString& StString::operator<<(float I)
00065 { double d = I; *this << d; return *this;}
00066