MIRA
Classes | Namespaces | Macros | Functions
ToString.h File Reference

Contains toString and fromString functions for converting data types to strings and the other way round. More...

#include <iomanip>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/lexical_cast.hpp>
#include <error/Exceptions.h>
#include <math/Math.h>
Include dependency graph for ToString.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FromHex< T >
 Can be used with fromString to convert hex strings into numbers. More...
 
class  ToHex< T >
 Can be used with toString to convert values to their string hex representation. More...
 
class  FromOct< T >
 Can be used with fromString to convert oct strings into numbers. More...
 
class  ToOct< T >
 Can be used with toString to convert values to their string oct representation. More...
 

Namespaces

 mira
 specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
 

Macros

#define MIRA_TOSTRING_NAN   "nan"
 
#define MIRA_TOSTRING_POSITIVE_INF   "inf"
 
#define MIRA_TOSTRING_NEGATIVE_INF   "-inf"
 

Functions

template<typename T >
std::string toString (const T &value, int precision=-1)
 Converts any data type to string (the data type must support the stream << operator). More...
 
template<typename T >
fromString (const std::string &str)
 Converts a string to any data type that supports the stream >> operator. More...
 
template<>
std::string toString< char > (const char &value, int precision)
 Specialization for char. More...
 
template<>
char fromString< char > (const std::string &str)
 Specialization for char. More...
 
template<>
std::string toString< signed char > (const signed char &value, int precision)
 Specialization for signed char. More...
 
template<>
signed char fromString< signed char > (const std::string &str)
 Specialization for signed char. More...
 
template<>
std::string toString< unsigned char > (const unsigned char &value, int precision)
 Specialization for unsigned char. More...
 
template<>
unsigned char fromString< unsigned char > (const std::string &str)
 Specialization for unsigned char. More...
 
template<>
std::string toString< std::string > (const std::string &value, int precision)
 Specialization for string. More...
 
template<>
std::string fromString< std::string > (const std::string &str)
 Specialization for string. More...
 
template<>
std::string toString< float > (const float &value, int precision)
 Specialization for float. More...
 
template<>
float fromString< float > (const std::string &str)
 Specialization for float. More...
 
template<>
std::string toString< double > (const double &value, int precision)
 Specialization for double. More...
 
template<>
double fromString< double > (const std::string &str)
 Specialization for double. More...
 
template<>
std::string toString< long double > (const long double &value, int precision)
 Specialization for long double. More...
 
template<>
long double fromString< long double > (const std::string &str)
 Specialization for long double. More...
 
template<>
std::string toString< bool > (const bool &value, int precision)
 Specialization for bool. More...
 
template<>
bool fromString< bool > (const std::string &str)
 Specialization for bool. More...
 

Detailed Description

Contains toString and fromString functions for converting data types to strings and the other way round.

Author
Erik Einhorn, Tim Langner
Date
2010/07/08

Macro Definition Documentation

◆ MIRA_TOSTRING_NAN

#define MIRA_TOSTRING_NAN   "nan"

◆ MIRA_TOSTRING_POSITIVE_INF

#define MIRA_TOSTRING_POSITIVE_INF   "inf"

◆ MIRA_TOSTRING_NEGATIVE_INF

#define MIRA_TOSTRING_NEGATIVE_INF   "-inf"