Various conversion functions for common usage - declarations.
More...
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <limits>
Go to the source code of this file.
Various conversion functions for common usage - declarations.
Encoding: UTF-8 Project: Serial-TCP/IP bridge
- Author
- Petr Zemek, xzeme.nosp@m.k02@.nosp@m.stud..nosp@m.fit..nosp@m.vutbr.nosp@m..cz
- Date
- 2009
template<typename N >
bool strToNum |
( |
const std::string & |
str, |
|
|
N & |
number, |
|
|
std::ios_base &(*)(std::ios_base &) |
format = std::dec |
|
) |
| |
|
inline |
Converts the selected string into a number.
- Parameters
-
str | String that should be converted into a number. |
number | Into this parameter the result number will be stored. |
format | Number format (e.g. std::dec, std::hex). |
- Returns
- True if the conversion went ok, false otherwise.
If the conversion fails, number value will be left unchanged.
Referenced by Config::parseNumber().
template<typename T >
std::string toString |
( |
const T & |
value | ) |
|
|
inline |
Converts the selected value into a string.
- Parameters
-
value | Value that should be converted into string |
Referenced by Config::parseNumber().
template<>
std::string toString< bool > |
( |
const bool & |
value | ) |
|
|
inline |
template<>
std::string toString< char > |
( |
const char & |
value | ) |
|
|
inline |
template<>
std::string toString< double > |
( |
const double & |
value | ) |
|
|
inline |
Specialization for double.
template<>
std::string toString< float > |
( |
const float & |
value | ) |
|
|
inline |
Specialization for float.
template<>
std::string toString< long double > |
( |
const long double & |
value | ) |
|
|
inline |
Specialization for long double.
Specialization for char *.
template<>
std::string toString< std::string > |
( |
const std::string & |
value | ) |
|
|
inline |
Specialization for std::string.