[Mockpp-commits] mockpp/mockpp/compat Formatter.cpp,1.40,1.41 Formatter.h,1.28,1.29
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-07-23 17:37:43
|
Update of /cvsroot/mockpp/mockpp/mockpp/compat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9329/mockpp/compat Modified Files: Formatter.cpp Formatter.h Log Message: Formatter uses operator<<(ostream) Index: Formatter.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/compat/Formatter.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- Formatter.h 1 May 2005 14:22:16 -0000 1.28 +++ Formatter.h 23 Jul 2005 17:37:33 -0000 1.29 @@ -199,7 +199,7 @@ */ mockpp::String & operator << (mockpp::String &formatter, const wchar_t *repdata); -#endif +#endif // MOCKPP_UNICODE /** Replace a positional %-parameter with a value. @@ -236,7 +236,7 @@ */ mockpp::String & operator << (mockpp::String &formatter, const std::string &repdata); -#else +#else // MOCKPP_UNICODE /** Replace a positional %-parameter with a value. * Replaces the lowest %-parameter with the string representation of the data. @@ -248,7 +248,7 @@ */ // mockpp::String & operator << (mockpp::String &formatter, const std::basic_string<wchar_t> &repdata); -#endif +#endif // MOCKPP_UNICODE /** Replace a positional %-parameter with a value. @@ -307,5 +307,37 @@ #endif // MOCKPP_ENABLE_DEFAULT_FORMATTER +#ifndef MOCKPP_DISABLE_OSTREAMED + +#include <sstream> + + +template <class T> +mockpp::String ostreamed(const T& t) +{ + std::basic_ostringstream<char> oss; + oss << t; +#ifdef MOCKPP_UNICODE + return mockpp::getUnicode(oss.str()); +#else + return oss.str(); +#endif +} + + +template <class T> +mockpp::String owstreamed(const T& t) +{ + std::basic_ostringstream<wchar_t> oss; + oss << t; +#ifdef MOCKPP_UNICODE + return oss.str(); +#else + return mockpp::getLatin1(oss.str()); +#endif +} + +#endif // MOCKPP_DISABLE_OSTREAMED + #endif // MOCKPP_FORMATTER_H Index: Formatter.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/compat/Formatter.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- Formatter.cpp 7 May 2005 12:46:19 -0000 1.40 +++ Formatter.cpp 23 Jul 2005 17:37:33 -0000 1.41 @@ -10,6 +10,7 @@ begin : Wed Dez 25 2002 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, |