summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-08-02 09:00:25 (GMT)
committerTobias Markmann <tm@ayena.de>2018-08-02 09:00:25 (GMT)
commit091f6e520694360a0407ab0cf3bb036fb461e6e3 (patch)
tree717ff863e8cd799842e5c82fc2d833ae026c9b20 /Swiften/StreamStack/StreamStack.cpp
parent80f74201f0a35718642e434c58b631b238fd85df (diff)
downloadswift-091f6e520694360a0407ab0cf3bb036fb461e6e3.zip
swift-091f6e520694360a0407ab0cf3bb036fb461e6e3.tar.bz2
Have StreamStack own the top and bottom layer
Test-Information: Builds, unit tests and integration tests pass on macOS with clang 7.0 master. Change-Id: I0db411e49339ccb2301edd1a16612cb1ad2c927c
Diffstat (limited to 'Swiften/StreamStack/StreamStack.cpp')
-rw-r--r--Swiften/StreamStack/StreamStack.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/StreamStack/StreamStack.cpp b/Swiften/StreamStack/StreamStack.cpp
index 75fb1ce..cf80fb1 100644
--- a/Swiften/StreamStack/StreamStack.cpp
+++ b/Swiften/StreamStack/StreamStack.cpp
@@ -8,25 +8,25 @@
#include <boost/bind.hpp>
+#include <Swiften/StreamStack/HighLayer.h>
#include <Swiften/StreamStack/LowLayer.h>
#include <Swiften/StreamStack/StreamLayer.h>
-#include <Swiften/StreamStack/HighLayer.h>
namespace Swift {
-StreamStack::StreamStack(HighLayer* topLayer, LowLayer* bottomLayer) : topLayer_(topLayer), bottomLayer_(bottomLayer) {
- bottomLayer_->setParentLayer(topLayer_);
- topLayer_->setChildLayer(bottomLayer_);
+StreamStack::StreamStack(std::unique_ptr<HighLayer> topLayer, std::unique_ptr<LowLayer> bottomLayer) : topLayer_(std::move(topLayer)), bottomLayer_(std::move(bottomLayer)) {
+ bottomLayer_->setParentLayer(topLayer_.get());
+ topLayer_->setChildLayer(bottomLayer_.get());
}
StreamStack::~StreamStack() {
}
void StreamStack::addLayer(std::unique_ptr<StreamLayer> streamLayer) {
- LowLayer* lowLayer = layers_.empty() ? bottomLayer_ : layers_.rbegin()->get();
+ auto* lowLayer = layers_.empty() ? bottomLayer_.get() : layers_.rbegin()->get();
topLayer_->setChildLayer(streamLayer.get());
- streamLayer->setParentLayer(topLayer_);
+ streamLayer->setParentLayer(topLayer_.get());
lowLayer->setParentLayer(streamLayer.get());
streamLayer->setChildLayer(lowLayer);