1
0
Fork 0

Replace boost::lexical_cast by std::ostringstream and std:stof/stoi/stod

This commit is contained in:
gallaert 2020-04-20 19:45:11 +01:00 committed by James Turner
parent c6124b5c5a
commit 4854607382
4 changed files with 19 additions and 21 deletions

View file

@ -3,8 +3,6 @@
#include <windows.h> #include <windows.h>
#include <cstring> #include <cstring>
#include <boost/lexical_cast.hpp>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osgViewer/GraphicsWindow> #include <osgViewer/GraphicsWindow>
#include <osgViewer/api/Win32/GraphicsWindowWin32> #include <osgViewer/api/Win32/GraphicsWindowWin32>

View file

@ -36,7 +36,6 @@
#include <Viewer/renderer.hxx> #include <Viewer/renderer.hxx>
#include <queue> #include <queue>
#include <boost/lexical_cast.hpp>
using std::string; using std::string;
using std::vector; using std::vector;
@ -526,11 +525,11 @@ bool ScreenshotUriHandler::poll(Connection * connection)
SG_LOG(SG_NETWORK, SG_DEBUG, "Screenshot is ready, size=" << screenshot.size()); SG_LOG(SG_NETWORK, SG_DEBUG, "Screenshot is ready, size=" << screenshot.size());
if (screenshotRequest->isStream()) { if (screenshotRequest->isStream()) {
string s( BOUNDARY "\r\nContent-Type: image/"); std::ostringstream ss;
s.append(screenshotRequest->getType()).append("\r\nContent-Length:"); ss << BOUNDARY << "\r\nContent-Type: image/";
s += boost::lexical_cast<string>(screenshot.size()); ss << screenshotRequest->getType() << "\r\nContent-Length:";
s += "\r\n\r\n"; ss << screenshot.size() << "\r\n\r\n";
connection->write(s.c_str(), s.length()); connection->write(ss.str().c_str(), ss.str().length());
} }
connection->write(screenshot.data(), screenshot.size()); connection->write(screenshot.data(), screenshot.size());
@ -566,11 +565,11 @@ bool ScreenshotUriHandler::poll(Connection * connection)
SG_LOG(SG_NETWORK, SG_DEBUG, "CanvasImage is ready, size=" << canvasimage.size()); SG_LOG(SG_NETWORK, SG_DEBUG, "CanvasImage is ready, size=" << canvasimage.size());
if (canvasimageRequest->isStream()) { if (canvasimageRequest->isStream()) {
string s(BOUNDARY "\r\nContent-Type: image/"); std::ostringstream ss;
s.append(canvasimageRequest->getType()).append("\r\nContent-Length:"); ss << BOUNDARY << "\r\nContent-Type: image/";
s += boost::lexical_cast<string>(canvasimage.size()); ss << canvasimageRequest->getType() << "\r\nContent-Length:";
s += "\r\n\r\n"; ss << canvasimage.size() << "\r\n\r\n";
connection->write(s.c_str(), s.length()); connection->write(ss.str().c_str(), ss.str().length());
} }
connection->write(canvasimage.data(), canvasimage.size()); connection->write(canvasimage.data(), canvasimage.size());
if (canvasimageRequest->isStream()) { if (canvasimageRequest->isStream()) {
@ -587,4 +586,3 @@ bool ScreenshotUriHandler::poll(Connection * connection)
} // namespace http } // namespace http
} // namespace flightgear } // namespace flightgear

View file

@ -26,8 +26,6 @@
#ifdef ENABLE_GDAL #ifdef ENABLE_GDAL
#include <boost/lexical_cast.hpp>
#include <simgear/scene/material/mat.hxx> #include <simgear/scene/material/mat.hxx>
#include <simgear/scene/util/SGReaderWriterOptions.hxx> #include <simgear/scene/util/SGReaderWriterOptions.hxx>
@ -84,9 +82,15 @@ void FGPgtTerrain::init( osg::Group* terrain ) {
options->setPluginStringData("SimGear::FG_ROOT", globals->get_fg_root().utf8Str()); options->setPluginStringData("SimGear::FG_ROOT", globals->get_fg_root().utf8Str());
options->setPluginStringData("SimGear::BARE_LOD_RANGE", fgGetString("/sim/rendering/static-lod/bare-delta", boost::lexical_cast<string>(SG_OBJECT_RANGE_BARE))); options->setPluginStringData("SimGear::BARE_LOD_RANGE",
options->setPluginStringData("SimGear::ROUGH_LOD_RANGE", fgGetString("/sim/rendering/static-lod/rough-delta", boost::lexical_cast<string>(SG_OBJECT_RANGE_ROUGH))); fgGetString("/sim/rendering/static-lod/bare-delta",
options->setPluginStringData("SimGear::ROUGH_LOD_DETAILED", fgGetString("/sim/rendering/static-lod/detailed", boost::lexical_cast<string>(SG_OBJECT_RANGE_DETAILED))); std::to_string(SG_OBJECT_RANGE_BARE)));
options->setPluginStringData("SimGear::ROUGH_LOD_RANGE",
fgGetString("/sim/rendering/static-lod/rough-delta",
std::to_string(SG_OBJECT_RANGE_ROUGH)));
options->setPluginStringData("SimGear::ROUGH_LOD_DETAILED",
fgGetString("/sim/rendering/static-lod/detailed",
std::to_string(SG_OBJECT_RANGE_DETAILED)));
options->setPluginStringData("SimGear::RENDER_BUILDING_MESH", fgGetBool("/sim/rendering/building-mesh", false) ? "true" : "false"); options->setPluginStringData("SimGear::RENDER_BUILDING_MESH", fgGetBool("/sim/rendering/building-mesh", false) ? "true" : "false");
options->setPluginStringData("SimGear::FG_EARTH", "ON"); options->setPluginStringData("SimGear::FG_EARTH", "ON");

View file

@ -28,8 +28,6 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <boost/lexical_cast.hpp>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osgDB/Registry> #include <osgDB/Registry>