[core, darwin] Object identity for MGLSource*, MGLStyleLayer*
All `MGLSource` pointers referencing the same logical source will now be object identical; similarly for `MGLStyleLayer`.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/util/any.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
#include <memory>
|
||||
@@ -118,6 +119,11 @@ public:
|
||||
// Private implementation
|
||||
const std::unique_ptr<Impl> baseImpl;
|
||||
|
||||
// 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;
|
||||
|
||||
friend std::string layoutKey(const Layer&);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/util/optional.hpp>
|
||||
#include <mbgl/util/range.hpp>
|
||||
#include <mbgl/util/any.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/style/query.hpp>
|
||||
|
||||
@@ -64,6 +65,11 @@ public:
|
||||
class Impl;
|
||||
const std::unique_ptr<Impl> baseImpl;
|
||||
|
||||
// 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>);
|
||||
|
||||
10
include/mbgl/util/any.hpp
Normal file
10
include/mbgl/util/any.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <linb/any.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using linb::any;
|
||||
using linb::any_cast;
|
||||
|
||||
} // namespace mbgl
|
||||
Reference in New Issue
Block a user