#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
+// To disable copy constructors and assignment operations for some class
+// 'Foobar', add the macro DISABLE_CLASS_COPY(Foobar) as a private member.
+// Note this also disables copying for any classes derived from 'Foobar' as well
+// as classes having a 'Foobar' member.
+#define DISABLE_CLASS_COPY(C) \
+ C(const C &); \
+ C &operator=(const C &)
+
#endif
// TODO: Add callback to update these when g_settings changes
bool m_cache_smooth_lighting;
bool m_cache_enable_shaders;
+
+ DISABLE_CLASS_COPY(Client);
};
#endif // !CLIENT_HEADER
bool popBlockEmergeData(v3s16 pos, BlockEmergeData *bedata);
friend class EmergeThread;
+
+ DISABLE_CLASS_COPY(EmergeManager);
};
#endif
private:
Mutex m_time_lock;
+ DISABLE_CLASS_COPY(Environment);
};
/*
u32 m_unprocessed_count;
u32 m_inc_trending_up_start_time; // milliseconds
bool m_queue_size_timer_started;
+
+ DISABLE_CLASS_COPY(Map);
};
/*
virtual void makeChunk(BlockMakeData *data) {}
virtual int getGroundLevelAtPoint(v2s16 p) { return 0; }
+
+private:
+ DISABLE_CLASS_COPY(Mapgen);
};
struct MapgenFactory {
INodeDefManager *m_ndef;
std::vector<ObjDef *> m_objects;
ObjDefType m_objtype;
+
+private:
+ DISABLE_CLASS_COPY(ObjDefManager);
};
#endif
Particles
*/
std::vector<u32> m_particlespawner_ids;
+
+ DISABLE_CLASS_COPY(Server);
};
/*
#include <pthread.h>
#endif
+#include "basicmacros.h"
class Mutex
{
#else // pthread
pthread_mutex_t mutex;
#endif
+
+ DISABLE_CLASS_COPY(Mutex);
};
#endif // C++11
#include <semaphore.h>
#endif
+#include "basicmacros.h"
class Semaphore {
public:
#else
sem_t semaphore;
#endif
+
+ DISABLE_CLASS_COPY(Semaphore);
};
#endif
std::thread *m_thread_obj;
#endif
+ DISABLE_CLASS_COPY(Thread);
};
#endif