StringConvert.h File Reference

#include <cexception.h>
#include <iostream>
#include <sstream>
#include <string>

Go to the source code of this file.

Functions

template<class t >
convertString (const std::string &str)
template<class t >
std::string convertToString (const t &val)

Detailed Description

Author:
Stephan Krause

Definition in file StringConvert.h.


Function Documentation

template<class t >
t convertString ( const std::string &  str  )  [inline]

Definition at line 29 of file StringConvert.h.

00029                                                           {
00030     std::istringstream s(str);
00031     t buf;
00032     if (!(s >> buf)) {
00033         throw( cException("convertString: parsing of string %s failed", str.c_str()) );
00034     }
00035     return buf;
00036 }

template<class t >
std::string convertToString ( const t &  val  )  [inline]

Definition at line 38 of file StringConvert.h.

00038                                                             {
00039     std::ostringstream s;
00040     if (!(s << val)) {
00041         throw( cException("convertToString: cannot convert value to string") );
00042     }
00043     return s.str();
00044 }

Generated on Wed May 26 16:21:15 2010 for OverSim by  doxygen 1.6.3