Remove make_shared and make_unique to keep single style
parent
7c81df8850
commit
0811e7c350
|
@ -206,7 +206,7 @@ directory_iterator::directory_iterator(const path& p) :
|
|||
directory_iterator::directory_iterator(const path& p, std::error_code& ec) :
|
||||
m_path(p),
|
||||
m_ec(ec),
|
||||
m_search(std::make_shared<SearchImpl>(p))
|
||||
m_search(new SearchImpl(p))
|
||||
{
|
||||
if (!m_search->advance(m_entry))
|
||||
reset();
|
||||
|
@ -239,7 +239,7 @@ struct recursive_directory_iterator::DirStack
|
|||
recursive_directory_iterator::recursive_directory_iterator(const path& p)
|
||||
{
|
||||
if (m_dirs == nullptr)
|
||||
m_dirs = std::make_shared<DirStack>();
|
||||
m_dirs = std::shared_ptr<DirStack>(new DirStack);
|
||||
|
||||
m_iter = directory_iterator(p);
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_MSC_VER) && __cplusplus < 201402L
|
||||
namespace std
|
||||
{
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args&&... args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -49,11 +49,10 @@ FrameTree::FrameTree(Star* star) :
|
|||
starParent(star),
|
||||
bodyParent(nullptr),
|
||||
m_changed(true),
|
||||
defaultFrame(nullptr)
|
||||
{
|
||||
// Default frame for a star is J2000 ecliptical, centered
|
||||
// on the star.
|
||||
defaultFrame = make_shared<J2000EclipticFrame>(Selection(star));
|
||||
defaultFrame(new J2000EclipticFrame(Selection(star)))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,14 +62,8 @@ FrameTree::FrameTree(Body* body) :
|
|||
starParent(nullptr),
|
||||
bodyParent(body),
|
||||
m_changed(true),
|
||||
defaultFrame(nullptr)
|
||||
{
|
||||
// Default frame for a solar system body is the mean equatorial frame of the body.
|
||||
defaultFrame = make_shared<BodyMeanEquatorFrame>(Selection(body), Selection(body));
|
||||
}
|
||||
|
||||
|
||||
FrameTree::~FrameTree()
|
||||
defaultFrame(new BodyMeanEquatorFrame(Selection(body), Selection(body)))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class FrameTree
|
|||
public:
|
||||
FrameTree(Star*);
|
||||
FrameTree(Body*);
|
||||
~FrameTree();
|
||||
~FrameTree() = default;
|
||||
|
||||
/*! Return the star that this tree is associated with; it will be
|
||||
* nullptr for frame trees associated with solar system bodies.
|
||||
|
|
|
@ -56,7 +56,8 @@ static Vector3d slerp(double t, const Vector3d& v0, const Vector3d& v1)
|
|||
* updates due to an active goto operation.
|
||||
*/
|
||||
|
||||
Observer::Observer() : frame(make_shared<ObserverFrame>())
|
||||
Observer::Observer() :
|
||||
frame(new ObserverFrame)
|
||||
{
|
||||
updateUniversal();
|
||||
}
|
||||
|
@ -768,7 +769,7 @@ void Observer::convertFrameCoordinates(const ObserverFrame::SharedConstPtr &newF
|
|||
*/
|
||||
void Observer::setFrame(ObserverFrame::CoordinateSystem cs, const Selection& refObj, const Selection& targetObj)
|
||||
{
|
||||
auto newFrame = make_shared<ObserverFrame>(cs, refObj, targetObj);
|
||||
auto newFrame = shared_ptr<ObserverFrame>(new ObserverFrame(cs, refObj, targetObj));
|
||||
convertFrameCoordinates(newFrame);
|
||||
frame = newFrame;
|
||||
}
|
||||
|
@ -1509,16 +1510,16 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
|
|||
switch (_coordSys)
|
||||
{
|
||||
case Universal:
|
||||
return make_shared<J2000EclipticFrame>(Selection());
|
||||
return shared_ptr<J2000EclipticFrame>(new J2000EclipticFrame(Selection()));
|
||||
|
||||
case Ecliptical:
|
||||
return make_shared<J2000EclipticFrame>(_refObject);
|
||||
return shared_ptr<J2000EclipticFrame>(new J2000EclipticFrame(_refObject));
|
||||
|
||||
case Equatorial:
|
||||
return make_shared<BodyMeanEquatorFrame>(_refObject, _refObject);
|
||||
return shared_ptr<BodyMeanEquatorFrame>(new BodyMeanEquatorFrame(_refObject, _refObject));
|
||||
|
||||
case BodyFixed:
|
||||
return make_shared<BodyFixedFrame>(_refObject, _refObject);
|
||||
return shared_ptr<BodyFixedFrame>(new BodyFixedFrame(_refObject, _refObject));
|
||||
|
||||
case PhaseLock:
|
||||
{
|
||||
|
@ -1537,7 +1538,7 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
|
|||
case PhaseLock_Old:
|
||||
{
|
||||
FrameVector rotAxis(FrameVector::createConstantVector(Vector3d::UnitY(),
|
||||
make_shared<BodyMeanEquatorFrame>(_refObject, _refObject)));
|
||||
shared_ptr<BodyMeanEquatorFrame>(new BodyMeanEquatorFrame(_refObject, _refObject))));
|
||||
return shared_ptr<TwoVectorFrame>(new TwoVectorFrame(_refObject,
|
||||
FrameVector::createRelativePositionVector(_refObject, _targetObject), 3,
|
||||
rotAxis, 2));
|
||||
|
@ -1546,7 +1547,7 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
|
|||
case Chase_Old:
|
||||
{
|
||||
FrameVector rotAxis(FrameVector::createConstantVector(Vector3d::UnitY(),
|
||||
make_shared<BodyMeanEquatorFrame>(_refObject, _refObject)));
|
||||
shared_ptr<BodyMeanEquatorFrame>(new BodyMeanEquatorFrame(_refObject, _refObject))));
|
||||
|
||||
return shared_ptr<TwoVectorFrame>(new TwoVectorFrame(_refObject,
|
||||
FrameVector::createRelativeVelocityVector(_refObject.parent(), _refObject), 3,
|
||||
|
@ -1556,10 +1557,10 @@ ObserverFrame::createFrame(CoordinateSystem _coordSys,
|
|||
case ObserverLocal:
|
||||
// TODO: This is only used for computing up vectors for orientation; it does
|
||||
// define a proper frame for the observer position orientation.
|
||||
return make_shared<J2000EclipticFrame>(Selection());
|
||||
return shared_ptr<J2000EclipticFrame>(new J2000EclipticFrame(Selection()));
|
||||
|
||||
default:
|
||||
return make_shared<J2000EclipticFrame>(_refObject);
|
||||
return shared_ptr<J2000EclipticFrame>(new J2000EclipticFrame(_refObject));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1316,7 +1316,7 @@ CreateBodyFixedFrame(const Universe& universe,
|
|||
if (center.empty())
|
||||
return nullptr;
|
||||
|
||||
return make_shared<BodyFixedFrame>(center, center);
|
||||
return shared_ptr<BodyFixedFrame>(new BodyFixedFrame(center, center));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1344,14 +1344,16 @@ CreateMeanEquatorFrame(const Universe& universe,
|
|||
clog << "CreateMeanEquatorFrame " << center.getName() << ", " << obj.getName() << "\n";
|
||||
|
||||
double freezeEpoch = 0.0;
|
||||
BodyMeanEquatorFrame *ptr;
|
||||
if (ParseDate(frameData, "Freeze", freezeEpoch))
|
||||
{
|
||||
return make_shared<BodyMeanEquatorFrame>(center, obj, freezeEpoch);
|
||||
ptr = new BodyMeanEquatorFrame(center, obj, freezeEpoch);
|
||||
}
|
||||
else
|
||||
{
|
||||
return make_shared<BodyMeanEquatorFrame>(center, obj);
|
||||
ptr = new BodyMeanEquatorFrame(center, obj);
|
||||
}
|
||||
return shared_ptr<BodyMeanEquatorFrame>(ptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1623,15 +1625,15 @@ CreateTwoVectorFrame(const Universe& universe,
|
|||
center,
|
||||
secondaryData);
|
||||
|
||||
shared_ptr<const TwoVectorFrame> frame;
|
||||
TwoVectorFrame *frame = nullptr;
|
||||
if (primaryVector != nullptr && secondaryVector != nullptr)
|
||||
{
|
||||
frame = shared_ptr<TwoVectorFrame>(new TwoVectorFrame(center,
|
||||
*primaryVector, primaryAxis,
|
||||
*secondaryVector, secondaryAxis));
|
||||
frame = new TwoVectorFrame(center,
|
||||
*primaryVector, primaryAxis,
|
||||
*secondaryVector, secondaryAxis);
|
||||
}
|
||||
|
||||
return frame;
|
||||
return shared_ptr<const TwoVectorFrame>(frame);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1645,7 +1647,7 @@ CreateJ2000EclipticFrame(const Universe& universe,
|
|||
if (center.empty())
|
||||
return nullptr;
|
||||
|
||||
return make_shared<J2000EclipticFrame>(center);
|
||||
return shared_ptr<J2000EclipticFrame>(new J2000EclipticFrame(center));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1659,7 +1661,7 @@ CreateJ2000EquatorFrame(const Universe& universe,
|
|||
if (center.empty())
|
||||
return nullptr;
|
||||
|
||||
return make_shared<J2000EquatorFrame>(center);
|
||||
return shared_ptr<J2000EquatorFrame>(new J2000EquatorFrame(center));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1672,7 +1674,7 @@ CreateTopocentricFrame(const Selection& center,
|
|||
const Selection& target,
|
||||
const Selection& observer)
|
||||
{
|
||||
shared_ptr<const BodyMeanEquatorFrame> eqFrame = make_shared<BodyMeanEquatorFrame>(target, target);
|
||||
auto eqFrame = shared_ptr<BodyMeanEquatorFrame>(new BodyMeanEquatorFrame(target, target));
|
||||
FrameVector north = FrameVector::createConstantVector(Vector3d::UnitY(), eqFrame);
|
||||
FrameVector up = FrameVector::createRelativePositionVector(observer, target);
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ std::ofstream hdrlog;
|
|||
#include "boundariesrenderer.h"
|
||||
#include "rendcontext.h"
|
||||
#include "vertexobject.h"
|
||||
#include <celcompat/memory.h>
|
||||
#include <celengine/observer.h>
|
||||
#include <celmath/frustum.h>
|
||||
#include <celmath/distance.h>
|
||||
|
@ -5451,7 +5450,9 @@ Renderer::getShadowFBO(int index) const
|
|||
void
|
||||
Renderer::createShadowFBO()
|
||||
{
|
||||
m_shadowFBO = make_unique<FramebufferObject>(m_shadowMapSize, m_shadowMapSize, FramebufferObject::DepthAttachment);
|
||||
m_shadowFBO = unique_ptr<FramebufferObject>(new FramebufferObject(m_shadowMapSize,
|
||||
m_shadowMapSize,
|
||||
FramebufferObject::DepthAttachment));
|
||||
if (!m_shadowFBO->isValid())
|
||||
{
|
||||
clog << "Error creating shadow FBO.\n";
|
||||
|
|
|
@ -868,7 +868,7 @@ void renderRings_GLSL(RingSystem& rings,
|
|||
ringsTex->bind();
|
||||
|
||||
if (rings.renderData == nullptr)
|
||||
rings.renderData = make_shared<GLRingRenderData>();
|
||||
rings.renderData = shared_ptr<GLRingRenderData>(new GLRingRenderData);
|
||||
auto data = reinterpret_cast<GLRingRenderData*>(rings.renderData.get());
|
||||
|
||||
unsigned nSections = 180;
|
||||
|
|
|
@ -454,7 +454,7 @@ static bool CreateTimeline(Body* body,
|
|||
ReferenceFrame::SharedConstPtr defaultBodyFrame;
|
||||
if (bodyType == SurfaceObject)
|
||||
{
|
||||
defaultOrbitFrame = make_shared<BodyFixedFrame>(parentObject, parentObject);
|
||||
defaultOrbitFrame = shared_ptr<BodyFixedFrame>(new BodyFixedFrame(parentObject, parentObject));
|
||||
defaultBodyFrame = CreateTopocentricFrame(parentObject, parentObject, Selection(body));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -80,14 +80,14 @@ TimelinePhase::CreateTimelinePhase(Universe& universe,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto phase = make_shared<const TimelinePhase>(body,
|
||||
startTime,
|
||||
endTime,
|
||||
orbitFrame,
|
||||
&orbit,
|
||||
bodyFrame,
|
||||
&rotationModel,
|
||||
frameTree);
|
||||
auto phase = shared_ptr<const TimelinePhase>(new TimelinePhase(body,
|
||||
startTime,
|
||||
endTime,
|
||||
orbitFrame,
|
||||
&orbit,
|
||||
bodyFrame,
|
||||
&rotationModel,
|
||||
frameTree));
|
||||
|
||||
frameTree->addChild(phase);
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <celutil/gettext.h>
|
||||
#include <celutil/utf8.h>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <celcompat/memory.h>
|
||||
#include <Eigen/Geometry>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
@ -142,11 +141,11 @@ CelestiaCore::CelestiaCore() :
|
|||
routine will be called much later. */
|
||||
renderer(new Renderer()),
|
||||
timer(new Timer()),
|
||||
m_legacyPlugin(make_unique<LegacyScriptPlugin>(this)),
|
||||
m_legacyPlugin(new LegacyScriptPlugin(this)),
|
||||
#ifdef CELX
|
||||
m_luaPlugin(make_unique<LuaScriptPlugin>(this)),
|
||||
m_luaPlugin(new LuaScriptPlugin(this)),
|
||||
#endif
|
||||
m_scriptMaps(make_shared<ScriptMaps>()),
|
||||
m_scriptMaps(new ScriptMaps()),
|
||||
oldFOV(stdFOV)
|
||||
{
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ SDL_Application::init(const std::string name, int w, int h)
|
|||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
#endif
|
||||
return std::make_shared<SDL_Application>(std::move(name), w, h);
|
||||
return std::shared_ptr<SDL_Application>(new SDL_Application(std::move(name), w, h));
|
||||
}
|
||||
|
||||
SDL_Application::~SDL_Application()
|
||||
|
@ -329,7 +329,7 @@ SDL_Application::handleKeyReleaseEvent(const SDL_KeyboardEvent &event)
|
|||
}
|
||||
if ((event.keysym.mod & KMOD_SHIFT) != 0)
|
||||
mod |= CelestiaCore::ShiftKey;
|
||||
|
||||
|
||||
m_appCore->keyUp(key, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <fstream>
|
||||
#include <string>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <celcompat/memory.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
#include <celutil/gettext.h>
|
||||
#include "legacyscript.h"
|
||||
|
@ -60,7 +59,7 @@ public:
|
|||
|
||||
LegacyScript::LegacyScript(CelestiaCore *core) :
|
||||
m_appCore(core),
|
||||
m_execEnv(make_unique<CoreExecutionEnvironment>(*core))
|
||||
m_execEnv(new CoreExecutionEnvironment(*core))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -75,7 +74,7 @@ bool LegacyScript::load(ifstream &scriptfile, const fs::path &/*path*/, string &
|
|||
errorMsg = (*errors)[0];
|
||||
return false;
|
||||
}
|
||||
m_runningScript = make_unique<Execution>(*script, *m_execEnv);
|
||||
m_runningScript = unique_ptr<Execution>(new Execution(*script, *m_execEnv));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -98,7 +97,7 @@ unique_ptr<IScript> LegacyScriptPlugin::loadScript(const fs::path &path)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto script = make_unique<LegacyScript>(appCore());
|
||||
auto script = unique_ptr<LegacyScript>(new LegacyScript(appCore()));
|
||||
string errorMsg;
|
||||
if (!script->load(scriptfile, path, errorMsg))
|
||||
{
|
||||
|
|
|
@ -716,7 +716,7 @@ static int observer_setframe(lua_State* l)
|
|||
frame = celx.toFrame(2);
|
||||
if (frame != nullptr)
|
||||
{
|
||||
obs->setFrame(make_shared<ObserverFrame>(*frame));
|
||||
obs->setFrame(std::shared_ptr<const ObserverFrame>(new ObserverFrame(*frame)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <fstream>
|
||||
#include <fmt/printf.h>
|
||||
#include <celcompat/filesystem.h>
|
||||
#include <celcompat/memory.h>
|
||||
#include <celephem/scriptobject.h>
|
||||
#include <celestia/configfile.h>
|
||||
#include <celestia/celestiacore.h>
|
||||
|
@ -29,7 +28,7 @@ namespace scripts
|
|||
|
||||
LuaScript::LuaScript(CelestiaCore *appcore) :
|
||||
m_appCore(appcore),
|
||||
m_celxScript(make_unique<LuaState>())
|
||||
m_celxScript(new LuaState)
|
||||
{
|
||||
m_celxScript->init(m_appCore);
|
||||
}
|
||||
|
@ -89,7 +88,7 @@ unique_ptr<IScript> LuaScriptPlugin::loadScript(const fs::path &path)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto script = make_unique<LuaScript>(appCore());
|
||||
auto script = unique_ptr<LuaScript>(new LuaScript(appCore()));
|
||||
string errMsg;
|
||||
if (!script->load(scriptfile, path, errMsg))
|
||||
{
|
||||
|
@ -238,7 +237,7 @@ bool CreateLuaEnvironment(CelestiaCore *appCore, const CelestiaConfig *config, P
|
|||
|
||||
if (luaHook != nullptr)
|
||||
{
|
||||
auto lh = make_unique<LuaHook>(appCore);
|
||||
auto lh = unique_ptr<LuaHook>(new LuaHook(appCore));
|
||||
lh->m_state = unique_ptr<LuaState>(luaHook);
|
||||
appCore->setScriptHook(std::move(lh));
|
||||
|
||||
|
|
Loading…
Reference in New Issue