summaryrefslogtreecommitdiff
path: root/src/mbgl/style/source.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-25 18:20:26 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-12 11:26:27 -0700
commitc2a5894f2dbe9982830066ab9347b059e6e7d845 (patch)
treec09363c2025b80265de195969ee56cc64e567e70 /src/mbgl/style/source.cpp
parentd3f23b83d42de8ef23ea1dbd8abfc6276009531f (diff)
downloadqtlocation-mapboxgl-c2a5894f2dbe9982830066ab9347b059e6e7d845.tar.gz
[core] Immutable Impls
Diffstat (limited to 'src/mbgl/style/source.cpp')
-rw-r--r--src/mbgl/style/source.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mbgl/style/source.cpp b/src/mbgl/style/source.cpp
index cfb268006b..4fcebc8377 100644
--- a/src/mbgl/style/source.cpp
+++ b/src/mbgl/style/source.cpp
@@ -1,15 +1,24 @@
#include <mbgl/style/source.hpp>
#include <mbgl/style/source_impl.hpp>
+#include <mbgl/style/source_observer.hpp>
+#include <mbgl/util/logging.hpp>
namespace mbgl {
namespace style {
-Source::Source(SourceType type_, std::unique_ptr<Impl> baseImpl_)
- : baseImpl(std::move(baseImpl_)), type(type_) {
+static SourceObserver nullObserver;
+
+Source::Source(Immutable<Impl> impl)
+ : baseImpl(std::move(impl)),
+ observer(&nullObserver) {
}
Source::~Source() = default;
+SourceType Source::getType() const {
+ return baseImpl->type;
+}
+
const std::string& Source::getID() const {
return baseImpl->id;
}
@@ -18,5 +27,14 @@ optional<std::string> Source::getAttribution() const {
return baseImpl->getAttribution();
}
+void Source::setObserver(SourceObserver* observer_) {
+ observer = observer_ ? observer_ : &nullObserver;
+}
+
+void Source::dumpDebugLogs() const {
+ Log::Info(Event::General, "Source::id: %s", getID().c_str());
+ Log::Info(Event::General, "Source::loaded: %d", loaded);
+}
+
} // namespace style
} // namespace mbgl