replace and purge boost::lexical_cast

pull/228/head
Bret Curtis 7 years ago
parent 98752a9702
commit d48b829b45

@ -1,7 +1,5 @@
#include "referencecheck.hpp"
#include <boost/lexical_cast.hpp>
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<std::string>(cellRef.mChargeFloat);
str += std::to_string(cellRef.mChargeFloat);
else
str += boost::lexical_cast<std::string>(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<std::string>(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<std::string>(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<std::string>(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<std::string>(cellRef.mEnchantmentCharge);
str += std::to_string(cellRef.mEnchantmentCharge);
messages.push_back(std::make_pair(id, id.getId() + str));
}

@ -5,8 +5,6 @@
#include <sstream>
#include <stdexcept>
#include <boost/lexical_cast.hpp>
#include <QColor>
#include <components/esm/loadbody.hpp>

@ -1,15 +1,10 @@
#include "cellmarker.hpp"
#include <boost/lexical_cast.hpp>
#include <osg/AutoTransform>
#include <osg/Material>
#include <osg/Geode>
#include <osg/Group>
#include <osgText/Text>
#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<std::string>(mCoordinates.getX()) + "," +
boost::lexical_cast<std::string>(mCoordinates.getY());
std::to_string(mCoordinates.getX()) + "," +
std::to_string(mCoordinates.getY());
markerText->setText(coordinatesText);
// Add text to marker node.

@ -1,14 +1,11 @@
#include "misc.hpp"
#include <boost/lexical_cast.hpp>
#include <components/esm/loadmisc.hpp>
#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 <boost/lexical_cast.hpp>
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<std::string>(count) + ")";
countString = " (" + std::to_string(count) + ")";
info.caption = ref->mBase->mName + countString;
info.icon = ref->mBase->mIcon;

@ -2,16 +2,12 @@
#include <iomanip>
#include <boost/lexical_cast.hpp>
#include <MyGUI_Button.h>
#include <MyGUI_ScrollView.h>
#include <components/widgets/list.hpp>
#include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"

@ -2,8 +2,6 @@
#include <iostream>
#include <boost/lexical_cast.hpp>
#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<std::string>(spell->mData.mCost);
std::string chance = boost::lexical_cast<std::string>(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<float>(enchant->mData.mCost), mActor);
std::string cost = boost::lexical_cast<std::string>(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<std::string>(currentCharge);
std::string charge = std::to_string(currentCharge);
newSpell.mCostColumn = cost + "/" + charge;
newSpell.mActive = invStore.isEquipped(item);

@ -1,9 +1,5 @@
#include "inputmanagerimp.hpp"
#include <cmath>
#include <boost/lexical_cast.hpp>
#include <osgViewer/ViewerEventHandlers>
#include <MyGUI_InputManager.h>
@ -1175,7 +1171,7 @@ namespace MWInput
bool controlExists = mInputBinder->getChannel(i)->getControlsCount () != 0;
if (!controlExists)
{
control = new ICS::Control(boost::lexical_cast<std::string>(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<std::string>(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<std::string>(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<std::string>(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<std::string>(axis);
return "Axis " + std::to_string(axis);
}
}

@ -1,10 +1,7 @@
#include "loadmgef.hpp"
#include <stdexcept>
#include <sstream>
#include <boost/lexical_cast.hpp>
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include "defs.hpp"
@ -524,7 +521,7 @@ const std::string &MagicEffect::effectIdToString(short effectID)
{
std::map<short,std::string>::const_iterator name = sNames.find(effectID);
if(name == sNames.end())
throw std::runtime_error(std::string("Unimplemented effect ID ")+boost::lexical_cast<std::string>(effectID));
throw std::runtime_error(std::string("Unimplemented effect ID ")+std::to_string(effectID));
return name->second;
}

@ -1,9 +1,11 @@
#include "fallback.hpp"
#include <boost/lexical_cast.hpp>
namespace Fallback
{
bool stob(std::string const& s) {
return s != "0";
}
Map::Map(const std::map<std::string,std::string>& fallback):mFallbackMap(fallback)
{}
@ -22,7 +24,7 @@ namespace Fallback
if(fallback.empty())
return 0;
else
return boost::lexical_cast<float>(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<int>(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<bool>(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<int>(ret[0])/255.f,boost::lexical_cast<int>(ret[1])/255.f,boost::lexical_cast<int>(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);
}
}

@ -3,16 +3,14 @@
#include <fstream>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <osg/Program>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/string.hpp>
#include <OpenThreads/ScopedLock>
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<std::string>(counter++));
shader->setName(std::to_string(counter++));
shaderIt = mShaders.insert(std::make_pair(std::make_pair(shaderTemplate, defines), shader)).first;
}

@ -5,11 +5,9 @@
#include <osg/Texture>
#include <osg/Material>
#include <osg/Geometry>
#include <osg/Image>
#include <osgUtil/TangentSpaceGenerator>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <components/resource/imagemanager.hpp>
@ -263,7 +261,7 @@ namespace Shader
for (std::map<int, std::string>::const_iterator texIt = reqs.mTextures.begin(); texIt != reqs.mTextures.end(); ++texIt)
{
defineMap[texIt->second] = "1";
defineMap[texIt->second + std::string("UV")] = boost::lexical_cast<std::string>(texIt->first);
defineMap[texIt->second + std::string("UV")] = std::to_string(texIt->first);
}
if (!reqs.mColorMaterial)

@ -1,7 +1,5 @@
#include "numericeditbox.hpp"
#include <boost/lexical_cast.hpp>
namespace Gui
{
@ -30,7 +28,7 @@ namespace Gui
try
{
mValue = boost::lexical_cast<int>(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));
}

@ -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

Loading…
Cancel
Save