diff --git a/apps/opencs/model/tools/referencecheck.cpp b/apps/opencs/model/tools/referencecheck.cpp index be9663e7a..7f247741c 100644 --- a/apps/opencs/model/tools/referencecheck.cpp +++ b/apps/opencs/model/tools/referencecheck.cpp @@ -1,7 +1,5 @@ #include "referencecheck.hpp" -#include - CSMTools::ReferenceCheckStage::ReferenceCheckStage( const CSMWorld::RefCollection& references, const CSMWorld::RefIdCollection& referencables, @@ -40,9 +38,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if ((isLight && cellRef.mChargeFloat < -1) || (!isLight && cellRef.mChargeInt < -1)) { std::string str = " has invalid charge "; if (localIndex.second == CSMWorld::UniversalId::Type_Light) - str += boost::lexical_cast(cellRef.mChargeFloat); + str += std::to_string(cellRef.mChargeFloat); else - str += boost::lexical_cast(cellRef.mChargeInt); + str += std::to_string(cellRef.mChargeInt); messages.push_back(std::make_pair(id, id.getId() + str)); } } @@ -66,9 +64,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message // Check item's faction rank if (hasFaction && cellRef.mFactionRank < -1) - messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + boost::lexical_cast(cellRef.mFactionRank))); + messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + std::to_string(cellRef.mFactionRank))); else if (!hasFaction && cellRef.mFactionRank != -2) - messages.push_back(std::make_pair(id, " has invalid faction rank " + boost::lexical_cast(cellRef.mFactionRank))); + messages.push_back(std::make_pair(id, " has invalid faction rank " + std::to_string(cellRef.mFactionRank))); // If door have destination cell, check if that reference is valid if (!cellRef.mDestCell.empty()) @@ -79,7 +77,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if (cellRef.mScale < 0) { std::string str = " has negative scale "; - str += boost::lexical_cast(cellRef.mScale); + str += std::to_string(cellRef.mScale); messages.push_back(std::make_pair(id, id.getId() + str)); } @@ -87,7 +85,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if (cellRef.mEnchantmentCharge < 0 && cellRef.mEnchantmentCharge != -1) { std::string str = " has negative enchantment points "; - str += boost::lexical_cast(cellRef.mEnchantmentCharge); + str += std::to_string(cellRef.mEnchantmentCharge); messages.push_back(std::make_pair(id, id.getId() + str)); } diff --git a/apps/opencs/model/world/columnimp.hpp b/apps/opencs/model/world/columnimp.hpp index 33a71e97a..154bdab82 100644 --- a/apps/opencs/model/world/columnimp.hpp +++ b/apps/opencs/model/world/columnimp.hpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include diff --git a/apps/opencs/view/render/cellmarker.cpp b/apps/opencs/view/render/cellmarker.cpp index 980ed305a..d0521a7b7 100644 --- a/apps/opencs/view/render/cellmarker.cpp +++ b/apps/opencs/view/render/cellmarker.cpp @@ -1,15 +1,10 @@ #include "cellmarker.hpp" -#include - #include #include #include -#include #include -#include "mask.hpp" - CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker) : TagBase(Mask_CellMarker), mMarker(marker) {} @@ -42,8 +37,8 @@ void CSVRender::CellMarker::buildMarker() // Add text containing cell's coordinates. std::string coordinatesText = - boost::lexical_cast(mCoordinates.getX()) + "," + - boost::lexical_cast(mCoordinates.getY()); + std::to_string(mCoordinates.getX()) + "," + + std::to_string(mCoordinates.getY()); markerText->setText(coordinatesText); // Add text to marker node. diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 203a7bbc4..a68176226 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -1,14 +1,11 @@ #include "misc.hpp" -#include - #include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/cellstore.hpp" #include "../mwworld/esmstore.hpp" @@ -22,8 +19,6 @@ #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" -#include - namespace MWClass { bool Miscellaneous::isGold (const MWWorld::ConstPtr& ptr) const @@ -146,7 +141,7 @@ namespace MWClass if (!gold) countString = MWGui::ToolTips::getCountString(count); else // gold displays its count also if it's 1. - countString = " (" + boost::lexical_cast(count) + ")"; + countString = " (" + std::to_string(count) + ")"; info.caption = ref->mBase->mName + countString; info.icon = ref->mBase->mIcon; diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index e44dc6fcc..a4728218a 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -2,16 +2,12 @@ #include -#include - #include #include #include #include -#include "../mwbase/environment.hpp" -#include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwbase/mechanicsmanager.hpp" diff --git a/apps/openmw/mwgui/spellmodel.cpp b/apps/openmw/mwgui/spellmodel.cpp index d4ab552ff..6953d682b 100644 --- a/apps/openmw/mwgui/spellmodel.cpp +++ b/apps/openmw/mwgui/spellmodel.cpp @@ -2,8 +2,6 @@ #include -#include - #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -61,8 +59,8 @@ namespace MWGui if (spell->mData.mType == ESM::Spell::ST_Spell) { newSpell.mType = Spell::Type_Spell; - std::string cost = boost::lexical_cast(spell->mData.mCost); - std::string chance = boost::lexical_cast(int(MWMechanics::getSpellSuccessChance(spell, mActor))); + std::string cost = std::to_string(spell->mData.mCost); + std::string chance = std::to_string(int(MWMechanics::getSpellSuccessChance(spell, mActor))); newSpell.mCostColumn = cost + "/" + chance; } else @@ -112,11 +110,11 @@ namespace MWGui int castCost = MWMechanics::getEffectiveEnchantmentCastCost(static_cast(enchant->mData.mCost), mActor); - std::string cost = boost::lexical_cast(castCost); + std::string cost = std::to_string(castCost); int currentCharge = int(item.getCellRef().getEnchantmentCharge()); if (currentCharge == -1) currentCharge = enchant->mData.mCharge; - std::string charge = boost::lexical_cast(currentCharge); + std::string charge = std::to_string(currentCharge); newSpell.mCostColumn = cost + "/" + charge; newSpell.mActive = invStore.isEquipped(item); diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 234a17cc3..19b746d5d 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1,9 +1,5 @@ #include "inputmanagerimp.hpp" -#include - -#include - #include #include @@ -1175,7 +1171,7 @@ namespace MWInput bool controlExists = mInputBinder->getChannel(i)->getControlsCount () != 0; if (!controlExists) { - control = new ICS::Control(boost::lexical_cast(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX); + control = new ICS::Control(std::to_string(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX); mInputBinder->addControl(control); control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT); } @@ -1247,7 +1243,7 @@ namespace MWInput if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) initial = 0.0f; else initial = 0.5f; - control = new ICS::Control(boost::lexical_cast(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); + control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); mInputBinder->addControl(control); control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT); } @@ -1336,7 +1332,7 @@ namespace MWInput if (key != SDL_SCANCODE_UNKNOWN) return MyGUI::TextIterator::toTagsString(mInputBinder->scancodeToString (key)); else if (mouse != ICS_MAX_DEVICE_BUTTONS) - return "#{sMouse} " + boost::lexical_cast(mouse); + return "#{sMouse} " + std::to_string(mouse); else return "#{sNone}"; } @@ -1391,7 +1387,7 @@ namespace MWInput case SDL_CONTROLLER_BUTTON_Y: return "Y Button"; default: - return "Button " + boost::lexical_cast(button); + return "Button " + std::to_string(button); } } std::string InputManager::sdlControllerAxisToString(int axis) @@ -1411,7 +1407,7 @@ namespace MWInput case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: return "Right Trigger"; default: - return "Axis " + boost::lexical_cast(axis); + return "Axis " + std::to_string(axis); } } diff --git a/components/esm/loadmgef.cpp b/components/esm/loadmgef.cpp index dc8266132..3a918cf19 100644 --- a/components/esm/loadmgef.cpp +++ b/components/esm/loadmgef.cpp @@ -1,10 +1,7 @@ #include "loadmgef.hpp" -#include #include -#include - #include "esmreader.hpp" #include "esmwriter.hpp" #include "defs.hpp" @@ -524,7 +521,7 @@ const std::string &MagicEffect::effectIdToString(short effectID) { std::map::const_iterator name = sNames.find(effectID); if(name == sNames.end()) - throw std::runtime_error(std::string("Unimplemented effect ID ")+boost::lexical_cast(effectID)); + throw std::runtime_error(std::string("Unimplemented effect ID ")+std::to_string(effectID)); return name->second; } diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 354595660..9b058f104 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -1,9 +1,11 @@ #include "fallback.hpp" -#include - namespace Fallback { + bool stob(std::string const& s) { + return s != "0"; + } + Map::Map(const std::map& fallback):mFallbackMap(fallback) {} @@ -22,7 +24,7 @@ namespace Fallback if(fallback.empty()) return 0; else - return boost::lexical_cast(fallback); + return std::stof(fallback); } int Map::getFallbackInt(const std::string& fall) const { @@ -30,7 +32,7 @@ namespace Fallback if(fallback.empty()) return 0; else - return boost::lexical_cast(fallback); + return std::stoi(fallback); } bool Map::getFallbackBool(const std::string& fall) const @@ -39,7 +41,7 @@ namespace Fallback if(fallback.empty()) return false; else - return boost::lexical_cast(fallback); + return stob(fallback); } osg::Vec4f Map::getFallbackColour(const std::string& fall) const { @@ -55,7 +57,7 @@ namespace Fallback else if (sum[i] != ' ') ret[j]+=sum[i]; } - return osg::Vec4f(boost::lexical_cast(ret[0])/255.f,boost::lexical_cast(ret[1])/255.f,boost::lexical_cast(ret[2])/255.f, 1.f); + return osg::Vec4f(std::stoi(ret[0])/255.f,std::stoi(ret[1])/255.f,std::stoi(ret[2])/255.f, 1.f); } } diff --git a/components/shader/shadermanager.cpp b/components/shader/shadermanager.cpp index ce77f46dc..2bfb17b5c 100644 --- a/components/shader/shadermanager.cpp +++ b/components/shader/shadermanager.cpp @@ -3,16 +3,14 @@ #include #include #include +#include #include -#include #include #include #include -#include - namespace Shader { @@ -139,7 +137,7 @@ namespace Shader shader->setShaderSource(shaderSource); // Assign a unique name to allow the SharedStateManager to compare shaders efficiently static unsigned int counter = 0; - shader->setName(boost::lexical_cast(counter++)); + shader->setName(std::to_string(counter++)); shaderIt = mShaders.insert(std::make_pair(std::make_pair(shaderTemplate, defines), shader)).first; } diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index b68d419a3..d85b72203 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -5,11 +5,9 @@ #include #include #include -#include #include -#include #include #include @@ -263,7 +261,7 @@ namespace Shader for (std::map::const_iterator texIt = reqs.mTextures.begin(); texIt != reqs.mTextures.end(); ++texIt) { defineMap[texIt->second] = "1"; - defineMap[texIt->second + std::string("UV")] = boost::lexical_cast(texIt->first); + defineMap[texIt->second + std::string("UV")] = std::to_string(texIt->first); } if (!reqs.mColorMaterial) diff --git a/components/widgets/numericeditbox.cpp b/components/widgets/numericeditbox.cpp index 5361b3127..d59deb378 100644 --- a/components/widgets/numericeditbox.cpp +++ b/components/widgets/numericeditbox.cpp @@ -1,7 +1,5 @@ #include "numericeditbox.hpp" -#include - namespace Gui { @@ -30,7 +28,7 @@ namespace Gui try { - mValue = boost::lexical_cast(newCaption); + mValue = std::stoi(newCaption); int capped = std::min(mMaxValue, std::max(mValue, mMinValue)); if (capped != mValue) { @@ -38,7 +36,7 @@ namespace Gui setCaption(MyGUI::utility::toString(mValue)); } } - catch (boost::bad_lexical_cast&) + catch (...) { setCaption(MyGUI::utility::toString(mValue)); } diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index 691a93725..308b54c3b 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -32,8 +32,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "ICSControl.h" #include "ICSChannel.h" -#include "boost/lexical_cast.hpp" - #define ICS_LOG(text) if(mLog) mLog->logMessage( ("ICS: " + std::string(text)).c_str() ); #define ICS_MAX_JOYSTICK_AXIS 16 #define ICS_MOUSE_BINDING_MARGIN 30