New lexcical_cast header. More...
#include "global.hpp"
#include <cstdlib>
#include <string>
#include <sstream>
#include <boost/mpl/set.hpp>
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
Go to the source code of this file.
Namespaces | |
implementation | |
Contains the implementation details for lexical_cast and shouldn't be used directly. | |
Macros | |
#define | LEXICAL_CAST_HPP_INCLUDED |
#define | DEBUG_THROW(id) |
Throws an exception for debugging. More... | |
#define | LEXICAL_CAST_HPP_INCLUDED |
#define | DEBUG_THROW(id) throw id; |
Functions | |
template<typename To , typename From > | |
To | lexical_cast (From value) |
Lexical cast converts one type to another. More... | |
New lexcical_cast header.
For debugging you can include this header in a namespace (to honor ODR) and have a set of functions that throws exceptions instead of doing the real job. This is done for the unit tests but should normally not be done.
Definition in file lexical_cast.hpp.
#define DEBUG_THROW | ( | id | ) |
Throws an exception for debugging.
id | The unique name to identify the function. |
Definition at line 42 of file test_lexical_cast.cpp.
Referenced by implementation::tlexical_cast< To, From, ToEnable, FromEnable >::operator()(), implementation::tlexical_cast< std::string, From, void, typename boost::enable_if< boost::is_integral< typename boost::remove_pointer< From >::type > >::type >::operator()(), implementation::tlexical_cast< long long, From, void, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >::operator()(), implementation::tlexical_cast< long long, std::string >::operator()(), implementation::tlexical_cast< To, From, typename boost::enable_if< boost::is_signed< To > >::type, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >::operator()(), implementation::tlexical_cast< To, std::string, typename boost::enable_if< boost::is_signed< To > >::type >::operator()(), implementation::tlexical_cast< unsigned long long, From, void, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >::operator()(), implementation::tlexical_cast< unsigned long long, std::string >::operator()(), implementation::tlexical_cast< To, From, typename boost::enable_if< boost::is_unsigned< To > >::type, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >::operator()(), and implementation::tlexical_cast< To, std::string, typename boost::enable_if< boost::is_unsigned< To > >::type >::operator()().
#define LEXICAL_CAST_HPP_INCLUDED |
#define LEXICAL_CAST_HPP_INCLUDED |
Definition at line 30 of file test_lexical_cast.cpp.
|
inline |
Lexical cast converts one type to another.
To | The type to convert to. |
From | The type to convert from. |
value | The value to convert. |
Definition at line 93 of file lexical_cast.hpp.
Referenced by config::apply_diff(), attack_type::apply_modification(), BOOST_AUTO_TEST_CASE(), gui2::tcampaign_selection::campaign_selected(), config::clear_diff_track(), create(), unit::describe_builtin_effect(), attack_type::describe_modification(), destroy(), events::console_handler::do_control(), events::console_handler::do_controller(), editor::editor_display::draw_sidebar(), gui2::tgame_load::evaluate_summary_string(), ai::find_component(), game_info::game_info(), gui2::teditor_generate_map::get_seed(), help::help_text_area::handle_jump_cfg(), campaignd::server::handle_request_campaign_list(), wesnothd::server::handle_termination(), gui2::tpreferences::initialize_members(), ai::manager::internal_evaluate_command(), gui2::tlua_interpreter::input_model::list_history(), modify(), ai::target_unit_goal::on_create(), ai::target_location_goal::on_create(), ai::protect_goal::on_create(), implementation::tlexical_cast< long long, std::string >::operator()(), implementation::tlexical_cast< To, std::string, typename boost::enable_if< boost::is_signed< To > >::type >::operator()(), implementation::tlexical_cast< unsigned long long, std::string >::operator()(), config::attribute_value::string_visitor::operator()(), implementation::tlexical_cast< To, std::string, typename boost::enable_if< boost::is_unsigned< To > >::type >::operator()(), font::parse_markup(), commandline_options::parse_resolution_(), commandline_options::parse_to_uint_string_string_tuples_(), commandline_options::parse_to_uint_string_tuples_(), mp::gamebrowser::populate_game_item(), gui2::tcampaign_selection::post_show(), gui2::tlabel_settings::pre_show(), progressive_< T >::progressive_(), network::receive_data(), gui2::sort(), string2rgb(), SYNCED_COMMAND_HANDLER_FUNCTION(), and ai::config_value_translator< T >::value_to_cfg().