00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef FORMATTER_HPP_INCLUDED
00014 #define FORMATTER_HPP_INCLUDED
00015
00016 #include <sstream>
00017
00018 class formatter
00019 {
00020 public:
00021 template<typename T>
00022 formatter& operator<<(const T& o) {
00023 stream_ << o;
00024 return *this;
00025 }
00026
00027 const std::string str() {
00028 return stream_.str();
00029 }
00030
00031 const char* c_str() {
00032 return str().c_str();
00033 }
00034
00035 operator std::string() {
00036 return stream_.str();
00037 }
00038 private:
00039 std::ostringstream stream_;
00040 };
00041
00042 #endif