Goby3  3.1.5a
2024.05.23
as.h File Reference
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>
#include <string>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/logical.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/type_traits.hpp>
#include <boost/utility.hpp>

Go to the source code of this file.

Namespaces

 goby
 The global namespace for the Goby project.
 
 goby::util
 

goby::util::as, a "do-the-right-thing" type casting tool

enum  goby::util::FloatRepresentation { goby::util::FLOAT_DEFAULT, goby::util::FLOAT_FIXED, goby::util::FLOAT_SCIENTIFIC }
 
template<typename To >
boost::enable_if< boost::is_arithmetic< To >, To >::type goby::util::_as_from_string (const std::string &from)
 
template<typename To >
boost::enable_if< boost::is_enum< To >, To >::type goby::util::_as_from_string (const std::string &from)
 
template<typename To >
boost::enable_if< boost::is_class< To >, To >::type goby::util::_as_from_string (const std::string &from)
 
template<>
bool goby::util::_as_from_string< bool > (const std::string &from)
 
template<>
std::string goby::util::_as_from_string< std::string > (const std::string &from)
 
template<typename To , typename From >
std::string goby::util::_as_to_string (const From &from)
 
template<>
std::string goby::util::_as_to_string< std::string, bool > (const bool &from)
 specialization of as() for bool -> string More...
 
template<>
std::string goby::util::_as_to_string< std::string, std::string > (const std::string &from)
 
template<typename To , typename From >
boost::disable_if< boost::is_same< To, From >, To >::type goby::util::_as_numeric (const From &from)
 
template<typename To , typename From >
boost::enable_if< boost::is_same< To, From >, To >::type goby::util::_as_numeric (const From &from)
 
template<typename To >
To goby::util::as (const std::string &from)
 
template<typename To , typename From >
boost::enable_if< boost::is_same< To, std::string >, To >::type goby::util::as (const From &from)
 
template<typename To , typename From >
boost::enable_if< boost::mpl::and_< boost::is_arithmetic< To >, boost::is_arithmetic< From > >, To >::type goby::util::as (const From &from)
 
template<typename To , typename From >
boost::enable_if< boost::mpl::and_< boost::is_enum< To >, boost::is_arithmetic< From > >, To >::type goby::util::as (const From &from)
 
template<typename To , typename From >
To goby::util::as (const From &from, int precision, FloatRepresentation rep=FLOAT_DEFAULT)
 
template<>
std::string goby::util::as< std::string, double > (const double &from, int precision, FloatRepresentation rep)
 
template<>
std::string goby::util::as< std::string, float > (const float &from, int precision, FloatRepresentation rep)