Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef Say_INCLUDE_ONCE
00033 #define Say_INCLUDE_ONCE
00034
00035 #include <vlCore/String.hpp>
00036 #include <string>
00037
00038 namespace vl
00039 {
00040
00041
00042
00044 class VLCORE_EXPORT SayArg
00045 {
00046 friend class Say;
00047 public:
00048 SayArg();
00049
00050 explicit SayArg(const unsigned char* d);
00051
00052 explicit SayArg(const std::string& d);
00053
00054 explicit SayArg(const char* d);
00055
00056 explicit SayArg(void* d);
00057
00058 explicit SayArg(const String& d);
00059
00060 explicit SayArg(double d);
00061
00062 explicit SayArg(float d);
00063
00064 explicit SayArg(unsigned char d);
00065
00066 explicit SayArg(signed char d);
00067
00068 explicit SayArg(unsigned short d);
00069
00070 explicit SayArg(signed short d);
00071
00072 explicit SayArg(unsigned int d);
00073
00074 explicit SayArg(signed int d);
00075
00076 explicit SayArg(unsigned long d);
00077
00078 explicit SayArg(signed long d);
00079
00080 explicit SayArg(unsigned long long d);
00081
00082 explicit SayArg(signed long long d);
00083
00084 protected:
00085 void init();
00086
00087 String str;
00088 double float64;
00089 unsigned long long ulonglong;
00090 signed long long slonglong;
00091
00092 enum
00093 {
00094 NO_TYPE,
00095 STRING,
00096 FLOAT64,
00097 ULONGLONG,
00098 SLONGLONG
00099 } type;
00100
00101 };
00102
00103
00104
00124 class VLCORE_EXPORT Say: public std::vector<SayArg>
00125 {
00126 public:
00127 String format_string;
00128
00129 Say(const String& fstr)
00130 {
00131 format_string = fstr;
00132 }
00133
00134 Say& operator<<(const SayArg& p)
00135 {
00136 push_back(p);
00137 return *this;
00138 }
00139
00140 template <typename T>
00141 Say& operator<<(T p)
00142 {
00143 push_back(SayArg(p));
00144 return *this;
00145 }
00146
00147 operator String()
00148 {
00149 return parse(*this);
00150 }
00151
00152 String str() const
00153 {
00154 return parse(*this);
00155 }
00156
00157 protected:
00158 String parse( const Say& pset ) const;
00159
00160 String euronotation(const String& str, int base) const;
00161
00162 String format(unsigned long long n, int base, int field, int decimals, int align, int fill, int plus, int finalizer, int eur) const;
00163
00164 String format(signed long long nn, int base, int field, int decimals, int align, int fill, int plus, int finalizer, int eur) const;
00165
00166 String format(double num, int base, int field, int decimals, int align, int fill, int plus, int finalizer, int eur) const;
00167
00168 String pipeline(const String& str, int base, int field, int decimals, int finalizer, int align, int eur, int fill, int negative, int plus) const;
00169 };
00170 }
00171
00172 #endif