Converted remaining cases of boost::lexical_cast to our own lexical_cast implementation

Excludes uses in tools/
This commit is contained in:
Charles Dang 2016-07-24 17:28:51 +11:00
parent 3d140f988a
commit 211ba2e770
13 changed files with 10 additions and 25 deletions

View file

@ -26,7 +26,6 @@
#include "ai/formula/ai.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
namespace pathfind {
@ -160,8 +159,8 @@ static component *find_component(component *root, const std::string &path, path_
pe.position = -2;
} else {
try {
pe.position = boost::lexical_cast<int>(position);
} catch (boost::bad_lexical_cast){
pe.position = lexical_cast<int>(position);
} catch (bad_lexical_cast){
pe.position = -2;
}
}

View file

@ -36,7 +36,6 @@
#include "units/filter.hpp"
#include "wml_exception.hpp"
#include <boost/lexical_cast.hpp>
#include <set>
#include <sstream>
@ -134,8 +133,8 @@ void target_unit_goal::on_create()
}
if (const config::attribute_value *v = cfg_.get("value")) {
try {
value_ = boost::lexical_cast<double>(*v);
} catch (boost::bad_lexical_cast){
value_ = lexical_cast<double>(*v);
} catch (bad_lexical_cast){
ERR_AI_GOAL << "bad value of goal"<<std::endl;
value_ = 0;
}
@ -181,8 +180,8 @@ void target_location_goal::on_create()
}
if (cfg_.has_attribute("value")) {
try {
value_ = boost::lexical_cast<double>(cfg_["value"]);
} catch (boost::bad_lexical_cast){
value_ = lexical_cast<double>(cfg_["value"]);
} catch (bad_lexical_cast){
ERR_AI_GOAL << "bad value of goal"<<std::endl;
value_ = 0;
}
@ -230,16 +229,16 @@ void protect_goal::on_create()
}
if (const config::attribute_value *v = cfg_.get("value")) {
try {
value_ = boost::lexical_cast<double>(*v);
} catch (boost::bad_lexical_cast){
value_ = lexical_cast<double>(*v);
} catch (bad_lexical_cast){
ERR_AI_GOAL << "bad value of protect_goal"<<std::endl;
value_ = 0;
}
}
if (const config::attribute_value *v = cfg_.get("protect_radius")) {
try {
radius_ = boost::lexical_cast<int>(*v);
} catch (boost::bad_lexical_cast){
radius_ = lexical_cast<int>(*v);
} catch (bad_lexical_cast){
ERR_AI_GOAL << "bad protection radius of protect_goal"<<std::endl;
radius_ = 1;
}

View file

@ -55,7 +55,6 @@
#include "candidates.hpp" // for base_candidate_action, etc
#include <boost/intrusive_ptr.hpp> // for intrusive_ptr
#include <boost/lexical_cast.hpp> // for lexical_cast
#include <boost/shared_ptr.hpp> // for shared_ptr
#include <cassert> // for assert
#include <ctime> // for time

View file

@ -24,7 +24,6 @@
#include "formula/formula.hpp"
#include "formula/function.hpp"
#include "log.hpp"
#include <boost/lexical_cast.hpp>
static lg::log_domain log_ai("ai/stage/side_formulas");
#define LOG_AI LOG_STREAM(info, log_ai)

View file

@ -27,7 +27,6 @@
#include "resources.hpp"
#include "units/unit.hpp"
#include "units/formula_manager.hpp"
#include <boost/lexical_cast.hpp>
static lg::log_domain log_formula_ai("ai/stage/unit_formulas");
#define LOG_AI LOG_STREAM(info, log_formula_ai)

View file

@ -27,8 +27,6 @@
#include "gui/dialogs/formula_debugger.hpp"
#include "gui/widgets/settings.hpp"
#include <boost/lexical_cast.hpp>
static lg::log_domain log_formula_debugger("scripting/formula/debug");
#define DBG_FDB LOG_STREAM(debug, log_formula_debugger)
#define LOG_FDB LOG_STREAM(info, log_formula_debugger)

View file

@ -11,7 +11,6 @@
*/
#include "global.hpp"
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <set>
#include <sstream>

View file

@ -18,8 +18,6 @@
#include <iostream>
#include <string.h>
#include <boost/lexical_cast.hpp>
#include "formatter.hpp"
#include "formula/callable.hpp"
#include "formula/function.hpp"

View file

@ -41,7 +41,6 @@
#include "whiteboard/manager.hpp"
#include "replay_recorder_base.hpp"
#include <boost/lexical_cast.hpp>
#include <set>
#include <map>

View file

@ -28,7 +28,6 @@
#include "util.hpp"
#include <cassert>
#include <boost/array.hpp>
#include <boost/lexical_cast.hpp>
static lg::log_domain log_engine("engine");
#define ERR_GENERAL LOG_STREAM(err, lg::general())

View file

@ -37,7 +37,6 @@
#include "syncmp_handler.hpp"
#include "units/id.hpp"
#include "whiteboard/manager.hpp"
#include <boost/lexical_cast.hpp>
#include <cassert>
#include <stdlib.h>

View file

@ -25,7 +25,6 @@
#include "replay.hpp"
#include "resources.hpp"
#include "gui/dialogs/multiplayer/synced_choice_wait.hpp"
#include <boost/lexical_cast.hpp>
#include <set>
#include <map>
#include "formula/string_utils.hpp"

View file

@ -49,7 +49,6 @@
#include "units/animation_component.hpp"
#include "units/udisplay.hpp"
#include <boost/lexical_cast.hpp>
#include "utils/functional.hpp"
#include <sstream>