StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StString.cc
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include "StString.h"
4 
5 //______________________________________________________________________________
6 StString& StString::operator<<(long long I)
7 {
8  char cbuf[200];
9  if (!fPrec) {
10  sprintf(cbuf,"%ld",(long)I);
11  } else {
12  sprintf(cbuf,"%.*ld",fPrec,(long)I);
13  }
14  fPrec = 0;
15  (*this) += cbuf;
16  return *this;
17 }
18 //______________________________________________________________________________
19 StString& StString::operator<<(long I)
20 { long long l = I; *this << l;return *this;}
21 //______________________________________________________________________________
22 StString& StString::operator<<(int I)
23 { long long l = I; *this << l;return *this;}
24 //______________________________________________________________________________
25 StString& StString::operator<<(short I)
26 { long long l = I; *this << l;return *this;}
27 //______________________________________________________________________________
28 StString& StString::operator<<(unsigned long long I)
29 {
30  char cbuf[100];
31  if (!fPrec) {
32  sprintf(cbuf,"%lu",(unsigned long)I);
33  } else {
34  sprintf(cbuf,"%.*lu",fPrec,(unsigned long)I);
35  }
36  fPrec = 0;
37  (*this) += cbuf;
38  return (*this);
39 }
40 //______________________________________________________________________________
41 StString& StString::operator<<(unsigned long I)
42 { unsigned long long l = I; *this << l;return *this;}
43 //______________________________________________________________________________
44 StString& StString::operator<<(unsigned int I)
45 { unsigned long long l = I; *this << l;return *this;}
46 //______________________________________________________________________________
47 StString& StString::operator<<(unsigned short I)
48 { unsigned long long l = I; *this << l;return *this;}
49 //______________________________________________________________________________
50 StString& StString::operator<<(double I)
51 {
52  char cbuf[200];
53  if (!fPrec) {
54  sprintf(cbuf,"%g",I);
55  } else {
56  sprintf(cbuf,"%.*g",fPrec,I);
57  }
58  fPrec = 0;
59  (*this) += cbuf;
60  return *this;
61 }
62 
63 //______________________________________________________________________________
64 StString& StString::operator<<(float I)
65 { double d = I; *this << d; return *this;}
66