Clean up placefile shared pointer usage with const references

This commit is contained in:
Dan Paulat 2023-08-22 21:52:11 -05:00
parent 232fafc9fa
commit 9955c4ccbe
12 changed files with 33 additions and 31 deletions

View file

@ -28,7 +28,7 @@ public:
std::uint64_t textureAtlasBuildCount_ {};
};
DrawLayer::DrawLayer(std::shared_ptr<MapContext> context) :
DrawLayer::DrawLayer(const std::shared_ptr<MapContext>& context) :
GenericLayer(context), p(std::make_unique<DrawLayerImpl>(context))
{
}
@ -76,7 +76,7 @@ void DrawLayer::Deinitialize()
}
}
void DrawLayer::AddDrawItem(std::shared_ptr<gl::draw::DrawItem> drawItem)
void DrawLayer::AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem)
{
p->drawList_.push_back(drawItem);
}

View file

@ -15,7 +15,7 @@ class DrawLayerImpl;
class DrawLayer : public GenericLayer
{
public:
explicit DrawLayer(std::shared_ptr<MapContext> context);
explicit DrawLayer(const std::shared_ptr<MapContext>& context);
virtual ~DrawLayer();
virtual void Initialize();
@ -23,7 +23,7 @@ public:
virtual void Deinitialize();
protected:
void AddDrawItem(std::shared_ptr<gl::draw::DrawItem> drawItem);
void AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem);
private:
std::unique_ptr<DrawLayerImpl> p;

View file

@ -22,9 +22,9 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
class PlacefileLayer::Impl
{
public:
explicit Impl(PlacefileLayer* self,
std::shared_ptr<MapContext> context,
const std::string& placefileName) :
explicit Impl(PlacefileLayer* self,
const std::shared_ptr<MapContext>& context,
const std::string& placefileName) :
self_ {self},
placefileName_ {placefileName},
placefileIcons_ {std::make_shared<gl::draw::PlacefileIcons>(context)},
@ -53,8 +53,8 @@ public:
std::shared_ptr<gl::draw::PlacefileText> placefileText_;
};
PlacefileLayer::PlacefileLayer(std::shared_ptr<MapContext> context,
const std::string& placefileName) :
PlacefileLayer::PlacefileLayer(const std::shared_ptr<MapContext>& context,
const std::string& placefileName) :
DrawLayer(context),
p(std::make_unique<PlacefileLayer::Impl>(this, context, placefileName))
{

View file

@ -16,8 +16,8 @@ class PlacefileLayer : public DrawLayer
Q_OBJECT
public:
explicit PlacefileLayer(std::shared_ptr<MapContext> context,
const std::string& placefileName);
explicit PlacefileLayer(const std::shared_ptr<MapContext>& context,
const std::string& placefileName);
~PlacefileLayer();
std::string placefile_name() const;