arguments.h

Go to the documentation of this file.
00001 
00008 /**************************************************************************
00009 
00010    begin                : Sat Sep 09 2007
00011    copyright            : (C) 2007 by Ewald Arnold
00012    email                : log4sendpp at ewald-arnold dot de
00013 
00014    This program is free software; you can redistribute it and/or modify
00015    it under the terms of the GNU Lesser General Public License as
00016    published by the Free Software Foundation; either version 2 of the License,
00017    or (at your option) any later version.
00018 
00019    This program is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022    GNU General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public License
00025    along with this program; if not, write to the Free Software
00026    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00027 
00028  **/
00029 
00030 #ifndef LOG4SENDPP_ARGUMENTS_H
00031 #define LOG4SENDPP_ARGUMENTS_H
00032 
00033 #include <log4sendpp/log4sendpp.h>  // always first header
00034 
00035 
00036 LOG4SENDPP_NS_START
00037 
00038 
00044   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string) number(long n, unsigned base = 10);
00045 
00046 #ifndef UPS_NO_LONG_LONG
00047 
00053   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string) number(long long n, unsigned base = 10);
00054 
00055 #endif
00056 
00062   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string) number(unsigned long n, unsigned base = 10);
00063 
00064 
00065 #ifndef UPS_NO_LONG_LONG
00066 
00072   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string) number(unsigned long long n, unsigned base = 10);
00073 
00074 #endif
00075 
00082   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string) number(double n, unsigned prec = 0);
00083 
00084 
00092   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &) replaceFormatterString(LOG4SENDPP_STD_NS::string &formatter, const LOG4SENDPP_STD_NS::string &repdata);
00093 
00094 
00095 LOG4SENDPP_NS_END
00096 
00097 
00105   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00106     operator << (LOG4SENDPP_STD_NS::string &formatter, const int &repdata);
00107 
00108 
00116   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00117     operator << (LOG4SENDPP_STD_NS::string &formatter, const bool &repdata);
00118 
00119 
00127   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00128     operator << (LOG4SENDPP_STD_NS::string &formatter, const unsigned int &repdata);
00129 
00130 
00138   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &
00139     operator) << (LOG4SENDPP_STD_NS::string &formatter, const unsigned long &repdata);
00140 
00141 
00149   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00150     operator << (LOG4SENDPP_STD_NS::string &formatter, const signed char &repdata);
00151 
00152 
00160   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00161     operator << (LOG4SENDPP_STD_NS::string &formatter, const unsigned char &repdata);
00162 
00163 
00171   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00172     operator << (LOG4SENDPP_STD_NS::string &formatter, const char &repdata);
00173 
00174 
00182   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00183     operator << (LOG4SENDPP_STD_NS::string &formatter, const char * repdata);
00184 
00185 
00193   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00194     operator << (LOG4SENDPP_STD_NS::string &formatter, const float &repdata);
00195 
00196 #ifdef LOG4SENDPP_UNICODE
00197 
00205   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00206     operator << (LOG4SENDPP_STD_NS::string &formatter, const wchar_t &repdata);
00207 
00208 
00216   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00217     operator << (LOG4SENDPP_STD_NS::string &formatter, const wchar_t * repdata);
00218 
00219 #endif // LOG4SENDPP_UNICODE
00220 
00221 
00229   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00230     operator << (LOG4SENDPP_STD_NS::string &formatter, const long &repdata);
00231 
00232 
00240   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00241     operator << (LOG4SENDPP_STD_NS::string &formatter, const LOG4SENDPP_STD_NS::string &repdata);
00242 
00243 
00244 #ifdef LOG4SENDPP_UNICODE
00245 
00253   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00254     operator << (LOG4SENDPP_STD_NS::string &formatter, const LOG4SENDPP_STL::string &repdata);
00255 
00256 #else // LOG4SENDPP_UNICODE
00257 
00265 // LOG4SENDPP_STD_NS::string & operator << (LOG4SENDPP_STD_NS::string &formatter, const LOG4SENDPP_STL::basic_string<wchar_t> &repdata);
00266 
00267 #endif // LOG4SENDPP_UNICODE
00268 
00269 
00277   LOG4SENDPP_API_DECL(LOG4SENDPP_STD_NS::string &)
00278     operator << (LOG4SENDPP_STD_NS::string &formatter, const double &repdata);
00279 
00280 
00281 #ifdef LOG4SENDPP_ENABLE_DEFAULT_FORMATTER
00282 
00291   template <typename T>
00292   LOG4SENDPP_STD_NS::string & operator << (LOG4SENDPP_STD_NS::string &formatter, const T &o)
00293   {
00294     LOG4SENDPP_STD_NS::string s =   LLOG4SENDPP_STD_NS::string("[")
00295 #ifdef LOG4SENDPP_NO_RTTI
00296                        + LOG4SENDPP_GET_STRING("[rtti-disabled]")
00297 #else
00298                        + LOG4SENDPP_GET_STRING(typeid(o).name())
00299 #endif
00300                        + LLOG4SENDPP_STD_NS::string("&]");
00301     formatter << s;
00302 #ifdef __BORLANDC__
00303     LOG4SENDPP_UNUSED(o);
00304 #endif
00305     return formatter;
00306 }
00307 
00308 
00317 template <typename T>
00318 LOG4SENDPP_STD_NS::string & operator << (LOG4SENDPP_STD_NS::string &formatter, const T * &po)
00319 {
00320   LOG4SENDPP_STD_NS::string s = LOG4SENDPP_STD_NS::string("[")
00321 #ifdef LOG4SENDPP_NO_RTTI
00322                      + LOG4SENDPP_STD_NS::string("[rtti-disabled]")
00323 #else
00324                      + LOG4SENDPP_STD_NS::string(typeid(*po).name())
00325 #endif
00326                      + LOG4SENDPP_STD_NS::string("*]");
00327   formatter << s;
00328 #ifdef __BORLANDC__
00329   LOG4SENDPP_UNUSED(po);
00330 #endif
00331   return formatter;
00332 }
00333 
00334 
00335 #endif // LOG4SENDPP_ENABLE_DEFAULT_FORMATTER
00336 
00337 
00338 #ifndef LOG4SENDPP_DISABLE_OSTREAMED
00339 
00340 #include <sstream>
00341 
00342 
00343 LOG4SENDPP_NS_START
00344 
00345 
00349 template <class T>
00350 LOG4SENDPP_STD_NS::string ostreamed(const T& t)
00351 {
00352   LOG4SENDPP_STD_NS::basic_ostringstream<char> oss;
00353   oss << t;
00354   return oss.str();
00355 }
00356 
00357 
00358 LOG4SENDPP_NS_END
00359 
00360 
00364 #define LOG4SENDPP_OSTREAMABLE(T) \
00365 LOG4SENDPP_STD_NS::string & \
00366   operator << (LOG4SENDPP_STD_NS::string &formatter, const T &o) \
00367 { \
00368   formatter << LOG4SENDPP_NS::ostreamed(o); \
00369   return formatter; \
00370 }
00371 
00372 
00373 #ifdef LOG4SENDPP_UNICODE
00374 
00375 
00376 LOG4SENDPP_NS_START
00377 
00381 template <class T>
00382 LOG4SENDPP_STD_NS::string owstreamed(const T& t)
00383 {
00384   LOG4SENDPP_STD_NS::basic_ostringstream<wchar_t> oss;
00385   oss << t;
00386 #ifndef LOG4SENDPP_ALTERNATIVE_STL
00387   return oss.str();
00388 #else
00389   return oss.str().c_str();
00390 #endif
00391 }
00392 
00393 LOG4SENDPP_NS_END
00394 
00399 #define LOG4SENDPP_OWSTREAMABLE(T) \
00400 LOG4SENDPP_STD_NS::string & \
00401   operator << (LOG4SENDPP_STD_NS::string &formatter, const T &o) \
00402 { \
00403   formatter << LOG4SENDPP_NS::owstreamed(o); \
00404   return formatter; \
00405 }
00406 
00407 
00408 #endif // LOG4SENDPP_UNICODE
00409 
00410 
00411 #endif // LOG4SENDPP_DISABLE_OSTREAMED
00412 
00413 #endif // LOG4SENDPP_ARGUMENTS_H
00414 

Generated on Sat Nov 24 14:41:22 2007 for log4sendpp by  doxygen 1.5.3