diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-25 18:20:26 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-12 11:26:27 -0700 |
commit | c2a5894f2dbe9982830066ab9347b059e6e7d845 (patch) | |
tree | c09363c2025b80265de195969ee56cc64e567e70 /include/mbgl/style/source.hpp | |
parent | d3f23b83d42de8ef23ea1dbd8abfc6276009531f (diff) | |
download | qtlocation-mapboxgl-c2a5894f2dbe9982830066ab9347b059e6e7d845.tar.gz |
[core] Immutable Impls
Diffstat (limited to 'include/mbgl/style/source.hpp')
-rw-r--r-- | include/mbgl/style/source.hpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/include/mbgl/style/source.hpp b/include/mbgl/style/source.hpp index 4c82e472a6..d19dfd4e36 100644 --- a/include/mbgl/style/source.hpp +++ b/include/mbgl/style/source.hpp @@ -1,19 +1,25 @@ #pragma once -#include <mbgl/util/feature.hpp> #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/optional.hpp> -#include <mbgl/util/range.hpp> #include <mbgl/util/any.hpp> +#include <mbgl/util/immutable.hpp> #include <mbgl/style/types.hpp> #include <memory> #include <string> -#include <vector> namespace mbgl { + +class FileSource; + namespace style { +class VectorSource; +class RasterSource; +class GeoJSONSource; +class SourceObserver; + /** * The runtime representation of a [source](https://www.mapbox.com/mapbox-gl-style-spec/#sources) from the Mapbox Style * Specification. @@ -49,21 +55,28 @@ public: return is<T>() ? reinterpret_cast<const T*>(this) : nullptr; } + SourceType getType() const; const std::string& getID() const; optional<std::string> getAttribution() const; // Private implementation class Impl; - const std::unique_ptr<Impl> baseImpl; + Immutable<Impl> baseImpl; + + Source(Immutable<Impl>); + + void setObserver(SourceObserver*); + SourceObserver* observer = nullptr; + + virtual void loadDescription(FileSource&) = 0; + void dumpDebugLogs() const; + + bool loaded = false; // For use in SDK bindings, which store a reference to a platform-native peer // object here, so that separately-obtained references to this object share // identical platform-native peers. any peer; - -protected: - const SourceType type; - Source(SourceType, std::unique_ptr<Impl>); }; } // namespace style |