mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
'ported' scripting code to work with unicode and the rest of MSE
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@14 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+35
-1
@@ -14,7 +14,14 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
// MOVEME
|
||||
/// Using intrusive_ptr where possible? (as opposed to smart_ptr)
|
||||
#define USE_INTRUSIVE_PTR
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#ifdef USE_INTRUSIVE_PTR
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#endif
|
||||
using namespace boost;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Declaring
|
||||
@@ -31,7 +38,6 @@ template <typename T>
|
||||
inline shared_ptr<T> new_shared() {
|
||||
return shared_ptr<T>(new T());
|
||||
}
|
||||
|
||||
/// Allocate a new shared-pointed object, given one argument to pass to the ctor of T
|
||||
template <typename T, typename A0>
|
||||
inline shared_ptr<T> new_shared1(const A0& a0) {
|
||||
@@ -58,5 +64,33 @@ inline shared_ptr<T> new_shared7(const A0& a0, const A1& a1, const A2& a2, const
|
||||
return shared_ptr<T>(new T(a0, a1, a2, a3, a4, a5, a6));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Intrusive pointers
|
||||
|
||||
#ifdef USE_INTRUSIVE_PTR
|
||||
|
||||
/// Allocate a new intrusive-pointed object
|
||||
template <typename T>
|
||||
inline intrusive_ptr<T> new_intrusive() {
|
||||
return intrusive_ptr<T>(new T());
|
||||
}
|
||||
/// Allocate a new intrusive-pointed object, given one argument to pass to the ctor of T
|
||||
template <typename T, typename A0>
|
||||
inline intrusive_ptr<T> new_intrusive1(const A0& a0) {
|
||||
return intrusive_ptr<T>(new T(a0));
|
||||
}
|
||||
/// Allocate a new intrusive-pointed object, given two arguments to pass to the ctor of T
|
||||
template <typename T, typename A0, typename A1>
|
||||
inline intrusive_ptr<T> new_intrusive2(const A0& a0, const A1& a1) {
|
||||
return intrusive_ptr<T>(new T(a0, a1));
|
||||
}
|
||||
|
||||
#else
|
||||
#define intrusive_ptr smart_ptr
|
||||
#define new_intrusive new_smart
|
||||
#define new_intrusive1 new_smart1
|
||||
#define new_intrusive2 new_smart2
|
||||
#define new_intrusive3 new_smart3
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user