summaryrefslogtreecommitdiff
path: root/include/mbgl/style
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-10-10 12:24:45 -0400
committerMike Morris <michael.patrick.morris@gmail.com>2014-10-10 12:24:45 -0400
commit2d1219fa5154c489cd856bedd04b84573d45ac04 (patch)
treea8e42e6acd79f73aac228e0fe6876917067db8c4 /include/mbgl/style
parent8f6e8eead12c6b2c2de0ce76fa7df39ca2445006 (diff)
parentf390dab0ea7d449bdd89855c84e47f4a07606fe4 (diff)
downloadqtlocation-mapboxgl-2d1219fa5154c489cd856bedd04b84573d45ac04.tar.gz
Merge branch 'master' into libuv-0.10-headless-display
Conflicts: common/curl_request.cpp common/glfw_view.cpp common/glfw_view.hpp include/mbgl/platform/request.hpp ios/mapbox-gl-cocoa setup-libraries.sh src/map/map.cpp src/platform/request.cpp test/fixtures/fixture_request.cpp
Diffstat (limited to 'include/mbgl/style')
-rw-r--r--include/mbgl/style/style.hpp4
-rw-r--r--include/mbgl/style/style_bucket.hpp6
-rw-r--r--include/mbgl/style/style_layer.hpp7
-rw-r--r--include/mbgl/style/style_layer_group.hpp2
-rw-r--r--include/mbgl/style/style_parser.hpp18
-rw-r--r--include/mbgl/style/style_source.hpp14
6 files changed, 26 insertions, 25 deletions
diff --git a/include/mbgl/style/style.hpp b/include/mbgl/style/style.hpp
index c09de6ebba..56f318ecbb 100644
--- a/include/mbgl/style/style.hpp
+++ b/include/mbgl/style/style.hpp
@@ -6,6 +6,7 @@
#include <mbgl/util/time.hpp>
#include <mbgl/util/uv.hpp>
+#include <mbgl/util/ptr.hpp>
#include <cstdint>
#include <map>
@@ -13,7 +14,6 @@
#include <unordered_map>
#include <vector>
#include <set>
-#include <memory>
namespace mbgl {
@@ -49,7 +49,7 @@ public:
const std::string &getSpriteURL() const;
public:
- std::shared_ptr<StyleLayerGroup> layers;
+ util::ptr<StyleLayerGroup> layers;
std::vector<std::string> appliedClasses;
std::string glyph_url;
diff --git a/include/mbgl/style/style_bucket.hpp b/include/mbgl/style/style_bucket.hpp
index c2cde52aa5..c4a8f6037e 100644
--- a/include/mbgl/style/style_bucket.hpp
+++ b/include/mbgl/style/style_bucket.hpp
@@ -8,8 +8,8 @@
#include <mbgl/util/vec.hpp>
#include <mbgl/util/variant.hpp>
#include <mbgl/util/noncopyable.hpp>
+#include <mbgl/util/ptr.hpp>
-#include <memory>
#include <forward_list>
namespace mbgl {
@@ -93,12 +93,12 @@ typedef mapbox::util::variant<StyleBucketFill, StyleBucketLine, StyleBucketSymbo
class StyleBucket {
public:
- typedef std::shared_ptr<StyleBucket> Ptr;
+ typedef util::ptr<StyleBucket> Ptr;
StyleBucket(StyleLayerType type);
std::string name;
- std::shared_ptr<StyleSource> style_source;
+ util::ptr<StyleSource> style_source;
std::string source_layer;
FilterExpression filter;
StyleBucketRender render = std::false_type();
diff --git a/include/mbgl/style/style_layer.hpp b/include/mbgl/style/style_layer.hpp
index 84981e3fb4..641dc1e71c 100644
--- a/include/mbgl/style/style_layer.hpp
+++ b/include/mbgl/style/style_layer.hpp
@@ -6,8 +6,9 @@
#include <mbgl/style/style_properties.hpp>
#include <mbgl/style/applied_class_properties.hpp>
+#include <mbgl/util/ptr.hpp>
+
#include <vector>
-#include <memory>
#include <string>
#include <map>
#include <set>
@@ -64,7 +65,7 @@ public:
// Bucket information, telling the renderer how to generate the geometries
// for this layer (feature property filters, tessellation instructions, ...).
- std::shared_ptr<StyleBucket> bucket;
+ util::ptr<StyleBucket> bucket;
// Contains all style classes that can be applied to this layer.
const std::map<ClassID, ClassProperties> styles;
@@ -80,7 +81,7 @@ public:
StyleProperties properties;
// Child layer array (if this layer has child layers).
- std::shared_ptr<StyleLayerGroup> layers;
+ util::ptr<StyleLayerGroup> layers;
};
}
diff --git a/include/mbgl/style/style_layer_group.hpp b/include/mbgl/style/style_layer_group.hpp
index 983dd136f0..1af6e23bd7 100644
--- a/include/mbgl/style/style_layer_group.hpp
+++ b/include/mbgl/style/style_layer_group.hpp
@@ -15,7 +15,7 @@ public:
bool hasTransitions() const;
public:
- std::vector<std::shared_ptr<StyleLayer>> layers;
+ std::vector<util::ptr<StyleLayer>> layers;
};
}
diff --git a/include/mbgl/style/style_parser.hpp b/include/mbgl/style/style_parser.hpp
index e4e1b7f632..fc253bb1dd 100644
--- a/include/mbgl/style/style_parser.hpp
+++ b/include/mbgl/style/style_parser.hpp
@@ -27,7 +27,7 @@ public:
void parse(JSVal document);
- std::shared_ptr<StyleLayerGroup> getLayers() {
+ util::ptr<StyleLayerGroup> getLayers() {
return root;
}
@@ -46,14 +46,14 @@ private:
void parseSources(JSVal value);
std::unique_ptr<StyleLayerGroup> createLayers(JSVal value);
- std::shared_ptr<StyleLayer> createLayer(JSVal value);
+ util::ptr<StyleLayer> createLayer(JSVal value);
void parseLayers();
- void parseLayer(std::pair<JSVal, std::shared_ptr<StyleLayer>> &pair);
+ void parseLayer(std::pair<JSVal, util::ptr<StyleLayer>> &pair);
void parseStyles(JSVal value, std::map<ClassID, ClassProperties> &styles);
void parseStyle(JSVal, ClassProperties &properties);
- void parseReference(JSVal value, std::shared_ptr<StyleLayer> &layer);
- void parseBucket(JSVal value, std::shared_ptr<StyleLayer> &layer);
- void parseRender(JSVal value, std::shared_ptr<StyleLayer> &layer);
+ void parseReference(JSVal value, util::ptr<StyleLayer> &layer);
+ void parseBucket(JSVal value, util::ptr<StyleLayer> &layer);
+ void parseRender(JSVal value, util::ptr<StyleLayer> &layer);
void parseSprite(JSVal value);
void parseGlyphURL(JSVal value);
@@ -94,13 +94,13 @@ private:
private:
std::unordered_map<std::string, const rapidjson::Value *> constants;
- std::unordered_map<std::string, const std::shared_ptr<StyleSource>> sources;
+ std::unordered_map<std::string, const util::ptr<StyleSource>> sources;
// This stores the root layer.
- std::shared_ptr<StyleLayerGroup> root;
+ util::ptr<StyleLayerGroup> root;
// This maps ids to Layer objects, with all items being at the root level.
- std::unordered_map<std::string, std::pair<JSVal, std::shared_ptr<StyleLayer>>> layers;
+ std::unordered_map<std::string, std::pair<JSVal, util::ptr<StyleLayer>>> layers;
// Store a stack of layers we're parsing right now. This is to prevent reference cycles.
std::forward_list<StyleLayer *> stack;
diff --git a/include/mbgl/style/style_source.hpp b/include/mbgl/style/style_source.hpp
index b598550c65..00c48431a1 100644
--- a/include/mbgl/style/style_source.hpp
+++ b/include/mbgl/style/style_source.hpp
@@ -2,18 +2,18 @@
#define MBGL_STYLE_STYLE_SOURCE
#include <mbgl/style/types.hpp>
+#include <mbgl/util/ptr.hpp>
+#include <mbgl/util/noncopyable.hpp>
+#include <rapidjson/document.h>
-#include <memory>
#include <vector>
#include <string>
-#include <rapidjson/document.h>
-
namespace mbgl {
class Source;
-class SourceInfo {
+class SourceInfo : private util::noncopyable {
public:
SourceType type = SourceType::Vector;
std::string url;
@@ -31,12 +31,12 @@ public:
class StyleSource : public std::enable_shared_from_this<StyleSource> {
public:
- SourceInfo info;
+ util::ptr<SourceInfo> info;
bool enabled = false;
- std::shared_ptr<Source> source;
+ util::ptr<Source> source;
- StyleSource(const SourceInfo &info)
+ StyleSource(const util::ptr<SourceInfo> &info)
: info(info)
{}
};