mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 15:26:49 +01:00
Rename stdext::shared_object_ptr to compile in gcc 4.6
This commit is contained in:
@@ -33,11 +33,11 @@ class ScheduledEvent;
|
||||
class FileStream;
|
||||
class BinaryTree;
|
||||
|
||||
typedef stdext::shared_object_ptr<Module> ModulePtr;
|
||||
typedef stdext::shared_object_ptr<Event> EventPtr;
|
||||
typedef stdext::shared_object_ptr<ScheduledEvent> ScheduledEventPtr;
|
||||
typedef stdext::shared_object_ptr<FileStream> FileStreamPtr;
|
||||
typedef stdext::shared_object_ptr<BinaryTree> BinaryTreePtr;
|
||||
typedef boost::intrusive_ptr<Module> ModulePtr;
|
||||
typedef boost::intrusive_ptr<Event> EventPtr;
|
||||
typedef boost::intrusive_ptr<ScheduledEvent> ScheduledEventPtr;
|
||||
typedef boost::intrusive_ptr<FileStream> FileStreamPtr;
|
||||
typedef boost::intrusive_ptr<BinaryTree> BinaryTreePtr;
|
||||
|
||||
typedef std::vector<BinaryTreePtr> BinaryTreeVec;
|
||||
|
||||
|
||||
@@ -44,21 +44,21 @@ class ParticleSystem;
|
||||
class ParticleEffect;
|
||||
class ParticleEffectType;
|
||||
|
||||
typedef stdext::shared_object_ptr<Image> ImagePtr;
|
||||
typedef stdext::shared_object_ptr<Texture> TexturePtr;
|
||||
typedef stdext::shared_object_ptr<AnimatedTexture> AnimatedTexturePtr;
|
||||
typedef stdext::shared_object_ptr<BitmapFont> BitmapFontPtr;
|
||||
typedef stdext::shared_object_ptr<CachedText> CachedTextPtr;
|
||||
typedef stdext::shared_object_ptr<FrameBuffer> FrameBufferPtr;
|
||||
typedef stdext::shared_object_ptr<Shader> ShaderPtr;
|
||||
typedef stdext::shared_object_ptr<ShaderProgram> ShaderProgramPtr;
|
||||
typedef stdext::shared_object_ptr<PainterShaderProgram> PainterShaderProgramPtr;
|
||||
typedef stdext::shared_object_ptr<Particle> ParticlePtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEmitter> ParticleEmitterPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleAffector> ParticleAffectorPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleSystem> ParticleSystemPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEffect> ParticleEffectPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEffectType> ParticleEffectTypePtr;
|
||||
typedef boost::intrusive_ptr<Image> ImagePtr;
|
||||
typedef boost::intrusive_ptr<Texture> TexturePtr;
|
||||
typedef boost::intrusive_ptr<AnimatedTexture> AnimatedTexturePtr;
|
||||
typedef boost::intrusive_ptr<BitmapFont> BitmapFontPtr;
|
||||
typedef boost::intrusive_ptr<CachedText> CachedTextPtr;
|
||||
typedef boost::intrusive_ptr<FrameBuffer> FrameBufferPtr;
|
||||
typedef boost::intrusive_ptr<Shader> ShaderPtr;
|
||||
typedef boost::intrusive_ptr<ShaderProgram> ShaderProgramPtr;
|
||||
typedef boost::intrusive_ptr<PainterShaderProgram> PainterShaderProgramPtr;
|
||||
typedef boost::intrusive_ptr<Particle> ParticlePtr;
|
||||
typedef boost::intrusive_ptr<ParticleEmitter> ParticleEmitterPtr;
|
||||
typedef boost::intrusive_ptr<ParticleAffector> ParticleAffectorPtr;
|
||||
typedef boost::intrusive_ptr<ParticleSystem> ParticleSystemPtr;
|
||||
typedef boost::intrusive_ptr<ParticleEffect> ParticleEffectPtr;
|
||||
typedef boost::intrusive_ptr<ParticleEffectType> ParticleEffectTypePtr;
|
||||
typedef std::vector<ShaderPtr> ShaderList;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,6 @@ class LuaObject;
|
||||
|
||||
typedef std::function<int(LuaInterface*)> LuaCppFunction;
|
||||
typedef std::unique_ptr<LuaCppFunction> LuaCppFunctionPtr;
|
||||
typedef stdext::shared_object_ptr<LuaObject> LuaObjectPtr;
|
||||
typedef boost::intrusive_ptr<LuaObject> LuaObjectPtr;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -152,18 +152,18 @@ namespace luabinder
|
||||
|
||||
/// Create member function lambdas
|
||||
template<typename Ret, typename C, typename... Args>
|
||||
std::function<Ret(const stdext::shared_object_ptr<C>&, const Args&...)> make_mem_func(Ret (C::* f)(Args...)) {
|
||||
std::function<Ret(const boost::intrusive_ptr<C>&, const Args&...)> make_mem_func(Ret (C::* f)(Args...)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](const stdext::shared_object_ptr<C>& obj, const Args&... args) mutable -> Ret {
|
||||
return [=](const boost::intrusive_ptr<C>& obj, const Args&... args) mutable -> Ret {
|
||||
if(!obj)
|
||||
throw LuaException("failed to call a member function because the passed object is nil");
|
||||
return mf(obj.get(), args...);
|
||||
};
|
||||
}
|
||||
template<typename C, typename... Args>
|
||||
std::function<void(const stdext::shared_object_ptr<C>&, const Args&...)> make_mem_func(void (C::* f)(Args...)) {
|
||||
std::function<void(const boost::intrusive_ptr<C>&, const Args&...)> make_mem_func(void (C::* f)(Args...)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](const stdext::shared_object_ptr<C>& obj, const Args&... args) mutable -> void {
|
||||
return [=](const boost::intrusive_ptr<C>& obj, const Args&... args) mutable -> void {
|
||||
if(!obj)
|
||||
throw LuaException("failed to call a member function because the passed object is nil");
|
||||
mf(obj.get(), args...);
|
||||
@@ -186,7 +186,7 @@ namespace luabinder
|
||||
/// Bind member functions
|
||||
template<typename C, typename Ret, class FC, typename... Args>
|
||||
LuaCppFunction bind_mem_fun(Ret (FC::* f)(Args...)) {
|
||||
typedef typename std::tuple<stdext::shared_object_ptr<FC>, typename remove_const_ref<Args>::type...> Tuple;
|
||||
typedef typename std::tuple<boost::intrusive_ptr<FC>, typename remove_const_ref<Args>::type...> Tuple;
|
||||
auto lambda = make_mem_func<Ret,FC>(f);
|
||||
return bind_fun_specializer<typename remove_const_ref<Ret>::type,
|
||||
decltype(lambda),
|
||||
@@ -209,7 +209,7 @@ namespace luabinder
|
||||
LuaCppFunction bind_mem_fun(int (C::*f)(LuaInterface*)) {
|
||||
auto mf = std::mem_fn(f);
|
||||
return [=](LuaInterface* lua) -> int {
|
||||
auto obj = lua->castValue<stdext::shared_object_ptr<C>>(1);
|
||||
auto obj = lua->castValue<boost::intrusive_ptr<C>>(1);
|
||||
lua->remove(1);
|
||||
return mf(obj, lua);
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ bool luavalue_cast(int index, LuaObjectPtr& obj);
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_base_of<LuaObject, T>::value, bool>::type
|
||||
luavalue_cast(int index, stdext::shared_object_ptr<T>& ptr);
|
||||
luavalue_cast(int index, boost::intrusive_ptr<T>& ptr);
|
||||
|
||||
// std::function
|
||||
template<typename Ret, typename... Args>
|
||||
@@ -186,7 +186,7 @@ push_luavalue(const T& obj) {
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<std::is_base_of<LuaObject, T>::value, bool>::type
|
||||
luavalue_cast(int index, stdext::shared_object_ptr<T>& ptr) {
|
||||
luavalue_cast(int index, boost::intrusive_ptr<T>& ptr) {
|
||||
LuaObjectPtr obj;
|
||||
if(!luavalue_cast(index, obj))
|
||||
return false;
|
||||
|
||||
@@ -34,10 +34,10 @@ class Connection;
|
||||
class Protocol;
|
||||
class Server;
|
||||
|
||||
typedef stdext::shared_object_ptr<InputMessage> InputMessagePtr;
|
||||
typedef stdext::shared_object_ptr<OutputMessage> OutputMessagePtr;
|
||||
typedef stdext::shared_object_ptr<Connection> ConnectionPtr;
|
||||
typedef stdext::shared_object_ptr<Protocol> ProtocolPtr;
|
||||
typedef stdext::shared_object_ptr<Server> ServerPtr;
|
||||
typedef boost::intrusive_ptr<InputMessage> InputMessagePtr;
|
||||
typedef boost::intrusive_ptr<OutputMessage> OutputMessagePtr;
|
||||
typedef boost::intrusive_ptr<Connection> ConnectionPtr;
|
||||
typedef boost::intrusive_ptr<Protocol> ProtocolPtr;
|
||||
typedef boost::intrusive_ptr<Server> ServerPtr;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,8 @@ class OTMLDocument;
|
||||
class OTMLParser;
|
||||
class OTMLEmitter;
|
||||
|
||||
typedef stdext::shared_object_ptr<OTMLNode> OTMLNodePtr;
|
||||
typedef stdext::shared_object_ptr<OTMLDocument> OTMLDocumentPtr;
|
||||
typedef boost::intrusive_ptr<OTMLNode> OTMLNodePtr;
|
||||
typedef boost::intrusive_ptr<OTMLDocument> OTMLDocumentPtr;
|
||||
typedef std::vector<OTMLNodePtr> OTMLNodeList;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,11 +38,11 @@ class StreamSoundSource;
|
||||
class CombinedSoundSource;
|
||||
class OggSoundFile;
|
||||
|
||||
typedef stdext::shared_object_ptr<SoundSource> SoundSourcePtr;
|
||||
typedef stdext::shared_object_ptr<SoundFile> SoundFilePtr;
|
||||
typedef stdext::shared_object_ptr<SoundBuffer> SoundBufferPtr;
|
||||
typedef stdext::shared_object_ptr<StreamSoundSource> StreamSoundSourcePtr;
|
||||
typedef stdext::shared_object_ptr<CombinedSoundSource> CombinedSoundSourcePtr;
|
||||
typedef stdext::shared_object_ptr<OggSoundFile> OggSoundFilePtr;
|
||||
typedef boost::intrusive_ptr<SoundSource> SoundSourcePtr;
|
||||
typedef boost::intrusive_ptr<SoundFile> SoundFilePtr;
|
||||
typedef boost::intrusive_ptr<SoundBuffer> SoundBufferPtr;
|
||||
typedef boost::intrusive_ptr<StreamSoundSource> StreamSoundSourcePtr;
|
||||
typedef boost::intrusive_ptr<CombinedSoundSource> CombinedSoundSourcePtr;
|
||||
typedef boost::intrusive_ptr<OggSoundFile> OggSoundFilePtr;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
|
||||
namespace stdext {
|
||||
|
||||
template<typename T>
|
||||
using shared_object_ptr = boost::intrusive_ptr<T>;
|
||||
|
||||
class shared_object
|
||||
{
|
||||
public:
|
||||
@@ -44,16 +41,16 @@ public:
|
||||
bool is_unique_ref() { return m_refs == 1; }
|
||||
unsigned long ref_count() { return m_refs; }
|
||||
template<typename T>
|
||||
shared_object_ptr<T> self_cast() { return shared_object_ptr<T>(static_cast<T*>(this)); }
|
||||
boost::intrusive_ptr<T> self_cast() { return boost::intrusive_ptr<T>(static_cast<T*>(this)); }
|
||||
template<typename T>
|
||||
shared_object_ptr<T> dynamic_self_cast() { return shared_object_ptr<T>(dynamic_cast<T*>(this)); }
|
||||
boost::intrusive_ptr<T> dynamic_self_cast() { return boost::intrusive_ptr<T>(dynamic_cast<T*>(this)); }
|
||||
|
||||
private:
|
||||
unsigned int m_refs;
|
||||
};
|
||||
|
||||
template<class T, typename... Args>
|
||||
shared_object_ptr<T> make_shared_object(Args... args) { return shared_object_ptr<T>(new T(args...)); }
|
||||
boost::intrusive_ptr<T> make_shared_object(Args... args) { return boost::intrusive_ptr<T>(new T(args...)); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,15 +36,15 @@ class UIGridLayout;
|
||||
class UIAnchorLayout;
|
||||
class UIParticles;
|
||||
|
||||
typedef stdext::shared_object_ptr<UIWidget> UIWidgetPtr;
|
||||
typedef stdext::shared_object_ptr<UIParticles> UIParticlesPtr;
|
||||
typedef stdext::shared_object_ptr<UITextEdit> UITextEditPtr;
|
||||
typedef stdext::shared_object_ptr<UILayout> UILayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIBoxLayout> UIBoxLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIHorizontalLayout> UIHorizontalLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIVerticalLayout> UIVerticalLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIGridLayout> UIGridLayoutPtr;
|
||||
typedef stdext::shared_object_ptr<UIAnchorLayout> UIAnchorLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIWidget> UIWidgetPtr;
|
||||
typedef boost::intrusive_ptr<UIParticles> UIParticlesPtr;
|
||||
typedef boost::intrusive_ptr<UITextEdit> UITextEditPtr;
|
||||
typedef boost::intrusive_ptr<UILayout> UILayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIBoxLayout> UIBoxLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIHorizontalLayout> UIHorizontalLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIVerticalLayout> UIVerticalLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIGridLayout> UIGridLayoutPtr;
|
||||
typedef boost::intrusive_ptr<UIAnchorLayout> UIAnchorLayoutPtr;
|
||||
|
||||
typedef std::deque<UIWidgetPtr> UIWidgetList;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user