1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-31 09:57:14 +01:00

Add static functions to access and modify string delimiter for bas types since static properties are read only.

This commit is contained in:
Sandu Liviu Catalin 2016-07-24 21:29:37 +03:00
parent 7dc20fcc0c
commit ad1955dbdd
11 changed files with 46 additions and 20 deletions

View File

@ -450,8 +450,6 @@ void Register_AABB(HSQUIRRELVM vm)
.Ctor< Val, Val, Val >()
.Ctor< Val, Val, Val, Val, Val, Val >()
.Ctor< const Vector3 &, const Vector3 & >()
// Static Members
.SetStaticValue(_SC("Delim"), &AABB::Delim)
// Member Variables
.Var(_SC("min"), &AABB::min)
.Var(_SC("max"), &AABB::max)
@ -485,6 +483,9 @@ void Register_AABB(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const AABB & (*)(CSStr) >(_SC("FromStr"), &AABB::Get)
.StaticOverload< const AABB & (*)(CSStr, SQChar) >(_SC("FromStr"), &AABB::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< AABB >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< AABB >)
// Operator Exposure
.Func< AABB & (AABB::*)(const AABB &) >(_SC("opAddAssign"), &AABB::operator +=)
.Func< AABB & (AABB::*)(const AABB &) >(_SC("opSubAssign"), &AABB::operator -=)

View File

@ -506,8 +506,6 @@ void Register_Circle(HSQUIRRELVM vm)
.Ctor< Val >()
.Ctor< const Vector2 &, Val >()
.Ctor< Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Circle::Delim)
// Member Variables
.Var(_SC("pos"), &Circle::pos)
.Var(_SC("rad"), &Circle::rad)
@ -539,6 +537,9 @@ void Register_Circle(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Circle & (*)(CSStr) >(_SC("FromStr"), &Circle::Get)
.StaticOverload< const Circle & (*)(CSStr, SQChar) >(_SC("FromStr"), &Circle::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Circle >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Circle >)
// Operator Exposure
.Func< Circle & (Circle::*)(const Circle &) >(_SC("opAddAssign"), &Circle::operator +=)
.Func< Circle & (Circle::*)(const Circle &) >(_SC("opSubAssign"), &Circle::operator -=)

View File

@ -650,8 +650,6 @@ void Register_Color3(HSQUIRRELVM vm)
.Ctor()
.Ctor< Val >()
.Ctor< Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Color3::Delim)
// Member Variables
.Var(_SC("r"), &Color3::r)
.Var(_SC("g"), &Color3::g)
@ -692,6 +690,9 @@ void Register_Color3(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Color3 & (*)(CSStr) >(_SC("FromStr"), &Color3::Get)
.StaticOverload< const Color3 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Color3::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Color3 >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Color3 >)
// Operator Exposure
.Func< Color3 & (Color3::*)(const Color3 &) >(_SC("opAddAssign"), &Color3::operator +=)
.Func< Color3 & (Color3::*)(const Color3 &) >(_SC("opSubAssign"), &Color3::operator -=)

View File

@ -709,8 +709,6 @@ void Register_Color4(HSQUIRRELVM vm)
.Ctor< Val >()
.Ctor< Val, Val, Val >()
.Ctor< Val, Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Color4::Delim)
// Member Variables
.Var(_SC("r"), &Color4::r)
.Var(_SC("g"), &Color4::g)
@ -754,6 +752,9 @@ void Register_Color4(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Color4 & (*)(CSStr) >(_SC("FromStr"), &Color4::Get)
.StaticOverload< const Color4 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Color4::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Color4 >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Color4 >)
// Operator Exposure
.Func< Color4 & (Color4::*)(const Color4 &) >(_SC("opAddAssign"), &Color4::operator +=)
.Func< Color4 & (Color4::*)(const Color4 &) >(_SC("opSubAssign"), &Color4::operator -=)

View File

@ -507,8 +507,6 @@ void Register_Quaternion(HSQUIRRELVM vm)
.Ctor< Val >()
.Ctor< Val, Val, Val >()
.Ctor< Val, Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Quaternion::Delim)
// Member Variables
.Var(_SC("x"), &Quaternion::x)
.Var(_SC("y"), &Quaternion::y)
@ -548,6 +546,9 @@ void Register_Quaternion(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Quaternion & (*)(CSStr) >(_SC("FromStr"), &Quaternion::Get)
.StaticOverload< const Quaternion & (*)(CSStr, SQChar) >(_SC("FromStr"), &Quaternion::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Quaternion >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Quaternion >)
// Operator Exposure
.Func< Quaternion & (Quaternion::*)(const Quaternion &) >(_SC("opAddAssign"), &Quaternion::operator +=)
.Func< Quaternion & (Quaternion::*)(const Quaternion &) >(_SC("opSubAssign"), &Quaternion::operator -=)

View File

@ -280,6 +280,22 @@ public:
}
};
/* ------------------------------------------------------------------------------------------------
* Retrieve the string delimiter of a base type.
*/
template < typename T > inline SQInteger SqGetDelimiter()
{
return T::Delim;
}
/* ------------------------------------------------------------------------------------------------
* Modify the string delimiter of a base type.
*/
template < typename T > inline void SqSetDelimiter(SQInteger c)
{
T::Delim = ConvTo< SQChar >::From(c);
}
} // Namespace:: SqMod
#endif // _BASE_SHARED_HPP_

View File

@ -507,8 +507,6 @@ void Register_Sphere(HSQUIRRELVM vm)
.Ctor< Val >()
.Ctor< const Vector3 &, Val >()
.Ctor< Val, Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Sphere::Delim)
// Member Variables
.Var(_SC("pos"), &Sphere::pos)
.Var(_SC("rad"), &Sphere::rad)
@ -540,6 +538,9 @@ void Register_Sphere(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Sphere & (*)(CSStr) >(_SC("FromStr"), &Sphere::Get)
.StaticOverload< const Sphere & (*)(CSStr, SQChar) >(_SC("FromStr"), &Sphere::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Sphere >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Sphere >)
// Operator Exposure
.Func< Sphere & (Sphere::*)(const Sphere &) >(_SC("opAddAssign"), &Sphere::operator +=)
.Func< Sphere & (Sphere::*)(const Sphere &) >(_SC("opSubAssign"), &Sphere::operator -=)

View File

@ -422,8 +422,6 @@ void Register_Vector2(HSQUIRRELVM vm)
.Ctor()
.Ctor< Val >()
.Ctor< Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Vector2::Delim)
// Member Variables
.Var(_SC("x"), &Vector2::x)
.Var(_SC("y"), &Vector2::y)
@ -457,6 +455,9 @@ void Register_Vector2(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Vector2 & (*)(CSStr) >(_SC("FromStr"), &Vector2::Get)
.StaticOverload< const Vector2 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Vector2::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Vector2 >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Vector2 >)
// Operator Exposure
.Func< Vector2 & (Vector2::*)(const Vector2 &) >(_SC("opAddAssign"), &Vector2::operator +=)
.Func< Vector2 & (Vector2::*)(const Vector2 &) >(_SC("opSubAssign"), &Vector2::operator -=)

View File

@ -548,8 +548,6 @@ void Register_Vector2i(HSQUIRRELVM vm)
.Ctor()
.Ctor< Val >()
.Ctor< Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Vector2i::Delim)
// Member Variables
.Var(_SC("x"), &Vector2i::x)
.Var(_SC("y"), &Vector2i::y)
@ -583,6 +581,9 @@ void Register_Vector2i(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Vector2i & (*)(CSStr) >(_SC("FromStr"), &Vector2i::Get)
.StaticOverload< const Vector2i & (*)(CSStr, SQChar) >(_SC("FromStr"), &Vector2i::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Vector2i >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Vector2i >)
// Operator Exposure
.Func< Vector2i & (Vector2i::*)(const Vector2i &) >(_SC("opAddAssign"), &Vector2i::operator +=)
.Func< Vector2i & (Vector2i::*)(const Vector2i &) >(_SC("opSubAssign"), &Vector2i::operator -=)

View File

@ -456,8 +456,6 @@ void Register_Vector3(HSQUIRRELVM vm)
.Ctor()
.Ctor< Val >()
.Ctor< Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Vector3::Delim)
// Member Variables
.Var(_SC("x"), &Vector3::x)
.Var(_SC("y"), &Vector3::y)
@ -494,6 +492,9 @@ void Register_Vector3(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Vector3 & (*)(CSStr) >(_SC("FromStr"), &Vector3::Get)
.StaticOverload< const Vector3 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Vector3::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Vector3 >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Vector3 >)
// Operator Exposure
.Func< Vector3 & (Vector3::*)(const Vector3 &) >(_SC("opAddAssign"), &Vector3::operator +=)
.Func< Vector3 & (Vector3::*)(const Vector3 &) >(_SC("opSubAssign"), &Vector3::operator -=)

View File

@ -504,8 +504,6 @@ void Register_Vector4(HSQUIRRELVM vm)
.Ctor< Val >()
.Ctor< Val, Val, Val >()
.Ctor< Val, Val, Val, Val >()
// Static Members
.SetStaticValue(_SC("Delim"), &Vector4::Delim)
// Member Variables
.Var(_SC("x"), &Vector4::x)
.Var(_SC("y"), &Vector4::y)
@ -545,6 +543,9 @@ void Register_Vector4(HSQUIRRELVM vm)
// Static Overloads
.StaticOverload< const Vector4 & (*)(CSStr) >(_SC("FromStr"), &Vector4::Get)
.StaticOverload< const Vector4 & (*)(CSStr, SQChar) >(_SC("FromStr"), &Vector4::Get)
// Static Functions
.StaticFunc(_SC("GetDelimiter"), &SqGetDelimiter< Vector4 >)
.StaticFunc(_SC("SetDelimiter"), &SqSetDelimiter< Vector4 >)
// Operator Exposure
.Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opAddAssign"), &Vector4::operator +=)
.Func< Vector4 & (Vector4::*)(const Vector4 &) >(_SC("opSubAssign"), &Vector4::operator -=)