1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 07:07:13 +02:00

Discard instances of constant StackStrF parameters. This should always be non-const if possible.

This commit is contained in:
Sandu Liviu Catalin
2019-02-17 17:23:59 +02:00
parent baee2d5c33
commit 600c21d45f
68 changed files with 250 additions and 227 deletions

View File

@ -307,7 +307,7 @@ CSStr AABB::ToString() const
}
// ------------------------------------------------------------------------------------------------
void AABB::SetStr(SQChar delim, const StackStrF & values)
void AABB::SetStr(SQChar delim, StackStrF & values)
{
DefineAABB(AABB::GetEx(delim, values));
}
@ -734,13 +734,13 @@ Int32 AABB::IsSphereInsideFastEx(Value x, Value y, Value z, Value r) const
}
// ------------------------------------------------------------------------------------------------
const AABB & AABB::Get(const StackStrF & str)
const AABB & AABB::Get(StackStrF & str)
{
return AABB::GetEx(AABB::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const AABB & AABB::GetEx(SQChar delim, const StackStrF & str)
const AABB & AABB::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f , %f , %f , %f , %f ");

View File

@ -300,7 +300,7 @@ struct AABB
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Clear the component values to default.
@ -470,12 +470,12 @@ struct AABB
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the AABB type from a string.
*/
static const AABB & Get(const StackStrF & str);
static const AABB & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the AABB type from a string.
*/
static const AABB & GetEx(SQChar delim, const StackStrF & str);
static const AABB & GetEx(SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -409,7 +409,7 @@ void Circle::SetPositionEx(Value nx, Value ny)
}
// ------------------------------------------------------------------------------------------------
void Circle::SetStr(SQChar delim, const StackStrF & values)
void Circle::SetStr(SQChar delim, StackStrF & values)
{
SetCircle(Circle::GetEx(delim, values));
}
@ -468,13 +468,13 @@ Circle Circle::Abs() const
}
// ------------------------------------------------------------------------------------------------
const Circle & Circle::Get(const StackStrF & str)
const Circle & Circle::Get(StackStrF & str)
{
return Circle::GetEx(Circle::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Circle & Circle::GetEx(SQChar delim, const StackStrF & str)
const Circle & Circle::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f , %f ");

View File

@ -376,7 +376,7 @@ struct Circle
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate a randomly sized and positioned circle.
@ -415,12 +415,12 @@ struct Circle
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Circle type from a string.
*/
static const Circle & Get(const StackStrF & str);
static const Circle & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Circle type from a string.
*/
static const Circle & GetEx(SQChar delim, const StackStrF & str);
static const Circle & GetEx(SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -530,13 +530,13 @@ void Color3::SetColor4Ex(Value nr, Value ng, Value nb, Value /*na*/)
}
// ------------------------------------------------------------------------------------------------
void Color3::SetStr(SQChar delim, const StackStrF & values)
void Color3::SetStr(SQChar delim, StackStrF & values)
{
SetColor3(Color3::GetEx(delim, values));
}
// ------------------------------------------------------------------------------------------------
void Color3::SetName(const StackStrF & name)
void Color3::SetName(StackStrF & name)
{
SetColor3(GetColor(name));
}
@ -632,13 +632,13 @@ void Color3::Inverse()
}
// ------------------------------------------------------------------------------------------------
const Color3 & Color3::Get(const StackStrF & str)
const Color3 & Color3::Get(StackStrF & str)
{
return Color3::GetEx(Color3::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Color3 & Color3::GetEx(SQChar delim, const StackStrF & str)
const Color3 & Color3::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %u , %u , %u ");

View File

@ -429,12 +429,12 @@ struct Color3
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & str);
void SetStr(SQChar delim, StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Set the values from the identified color.
*/
void SetName(const StackStrF & name);
void SetName(StackStrF & name);
/* --------------------------------------------------------------------------------------------
* Get the component values packed inside an integer value.
@ -502,12 +502,12 @@ struct Color3
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Color3 type from a string.
*/
static const Color3 & Get(const StackStrF & str);
static const Color3 & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Color3 type from a string.
*/
static const Color3 & GetEx( SQChar delim, const StackStrF & str);
static const Color3 & GetEx( SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -559,13 +559,13 @@ void Color4::SetColor4Ex(Value nr, Value ng, Value nb, Value na)
}
// ------------------------------------------------------------------------------------------------
void Color4::SetStr(SQChar delim, const StackStrF & values)
void Color4::SetStr(SQChar delim, StackStrF & values)
{
SetColor4(Color4::GetEx(delim, values));
}
// ------------------------------------------------------------------------------------------------
void Color4::SetName(const StackStrF & name)
void Color4::SetName(StackStrF & name)
{
SetColor3(GetColor(name));
}
@ -667,13 +667,13 @@ void Color4::Inverse()
}
// ------------------------------------------------------------------------------------------------
const Color4 & Color4::Get(const StackStrF & str)
const Color4 & Color4::Get(StackStrF & str)
{
return Color4::GetEx(Color4::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Color4 & Color4::GetEx(SQChar delim, const StackStrF & str)
const Color4 & Color4::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %u , %u , %u , %u ");

View File

@ -429,12 +429,12 @@ struct Color4
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & name);
void SetStr(SQChar delim, StackStrF & name);
/* --------------------------------------------------------------------------------------------
* Set the values from the identified color.
*/
void SetName(const StackStrF & name);
void SetName(StackStrF & name);
/* --------------------------------------------------------------------------------------------
* Get the component values packed inside an integer value.
@ -502,12 +502,12 @@ struct Color4
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Color4 type from a string.
*/
static const Color4 & Get(const StackStrF & str);
static const Color4 & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Color4 type from a string.
*/
static const Color4 & GetEx(SQChar delim, const StackStrF & str);
static const Color4 & GetEx(SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -431,7 +431,7 @@ void Quaternion::SetVector4(const Vector4 & v)
}
// ------------------------------------------------------------------------------------------------
void Quaternion::SetStr(SQChar delim, const StackStrF & values)
void Quaternion::SetStr(SQChar delim, StackStrF & values)
{
SetQuaternion(Quaternion::GetEx(delim, values));
}
@ -714,13 +714,13 @@ Quaternion Quaternion::NlerpEx(const Quaternion & quat, Value t, bool shortest_p
}
// ------------------------------------------------------------------------------------------------
const Quaternion & Quaternion::Get(const StackStrF & str)
const Quaternion & Quaternion::Get(StackStrF & str)
{
return Quaternion::GetEx(Quaternion::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Quaternion & Quaternion::GetEx(SQChar delim, const StackStrF & str)
const Quaternion & Quaternion::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f , %f , %f ");

View File

@ -330,7 +330,7 @@ struct Quaternion
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate random values for all components of this instance.
@ -443,12 +443,12 @@ struct Quaternion
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Quaternion type from a string.
*/
static const Quaternion & Get(const StackStrF & str);
static const Quaternion & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Quaternion type from a string.
*/
static const Quaternion & GetEx(SQChar delim, const StackStrF & str);
static const Quaternion & GetEx(SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -324,7 +324,7 @@ const Color3 & GetRandomColor()
}
// ------------------------------------------------------------------------------------------------
Color3 GetColor(const StackStrF & name)
Color3 GetColor(StackStrF & name)
{
return name.mLen <= 0 ? Color3() : GetColorStr(name.mPtr);
}

View File

@ -231,7 +231,7 @@ Color3 GetColorStr(CSStr name);
/* ------------------------------------------------------------------------------------------------
* Attempt to identify the color in the specified name and return it.
*/
Color3 GetColor(const StackStrF & name);
Color3 GetColor(StackStrF & name);
/* ------------------------------------------------------------------------------------------------
* Throw the last system error as an exception.

View File

@ -409,7 +409,7 @@ void Sphere::SetPositionEx(Value nx, Value ny, Value nz)
}
// ------------------------------------------------------------------------------------------------
void Sphere::SetStr(SQChar delim, const StackStrF & values)
void Sphere::SetStr(SQChar delim, StackStrF & values)
{
SetSphere(Sphere::GetEx(delim, values));
}
@ -468,13 +468,13 @@ Sphere Sphere::Abs() const
}
// ------------------------------------------------------------------------------------------------
const Sphere & Sphere::Get(const StackStrF & str)
const Sphere & Sphere::Get(StackStrF & str)
{
return Sphere::GetEx(Sphere::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Sphere & Sphere::GetEx(SQChar delim, const StackStrF & str)
const Sphere & Sphere::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f , %f , %f ");

View File

@ -376,7 +376,7 @@ struct Sphere
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate a randomly sized and positioned sphere.
@ -414,12 +414,12 @@ struct Sphere
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Sphere type from a string.
*/
static const Sphere & Get(const StackStrF & str);
static const Sphere & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Sphere type from a string.
*/
static const Sphere & GetEx(SQChar delim, const StackStrF & str);
static const Sphere & GetEx(SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -333,7 +333,7 @@ void Vector2::SetVector2i(const Vector2i & v)
}
// ------------------------------------------------------------------------------------------------
void Vector2::SetStr(SQChar delim, const StackStrF & values)
void Vector2::SetStr(SQChar delim, StackStrF & values)
{
SetVector2(Vector2::GetEx(delim, values));
}
@ -376,13 +376,13 @@ Vector2 Vector2::Abs() const
}
// ------------------------------------------------------------------------------------------------
const Vector2 & Vector2::Get(const StackStrF & str)
const Vector2 & Vector2::Get(StackStrF & str)
{
return Vector2::GetEx(Vector2::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Vector2 & Vector2::GetEx(SQChar delim, const StackStrF & str)
const Vector2 & Vector2::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f ");

View File

@ -314,7 +314,7 @@ struct Vector2
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate random values for all components of this instance.
@ -347,12 +347,12 @@ struct Vector2
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector2 type from a string.
*/
static const Vector2 & Get(const StackStrF & str);
static const Vector2 & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector2 type from a string.
*/
static const Vector2 & GetEx(SQChar delim, const StackStrF & str);
static const Vector2 & GetEx(SQChar delim, StackStrF & str);
};
} // Namespace:: SqMod

View File

@ -479,7 +479,7 @@ void Vector2i::SetVector2(const Vector2 & v)
}
// ------------------------------------------------------------------------------------------------
void Vector2i::SetStr(SQChar delim, const StackStrF & values)
void Vector2i::SetStr(SQChar delim, StackStrF & values)
{
SetVector2i(Vector2i::GetEx(delim, values));
}
@ -522,13 +522,13 @@ Vector2i Vector2i::Abs() const
}
// ------------------------------------------------------------------------------------------------
const Vector2i & Vector2i::Get(const StackStrF & str)
const Vector2i & Vector2i::Get(StackStrF & str)
{
return Vector2i::GetEx(Vector2i::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Vector2i & Vector2i::GetEx(SQChar delim, const StackStrF & str)
const Vector2i & Vector2i::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %d , %d ");

View File

@ -414,7 +414,7 @@ struct Vector2i
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate random values for all components of this instance.
@ -447,12 +447,12 @@ struct Vector2i
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector2i type from a string.
*/
static const Vector2i & Get(const StackStrF & str);
static const Vector2i & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector2i type from a string.
*/
static const Vector2i & GetEx(SQChar delim, const StackStrF & str);
static const Vector2i & GetEx(SQChar delim, StackStrF & str);
};

View File

@ -415,7 +415,7 @@ void Vector3::SetQuaternionEx(Value qx, Value qy, Value qz, Value qw)
}
// ------------------------------------------------------------------------------------------------
void Vector3::SetStr(SQChar delim, const StackStrF & values)
void Vector3::SetStr(SQChar delim, StackStrF & values)
{
SetVector3(Vector3::GetEx(delim, values));
}
@ -629,13 +629,13 @@ void Vector3::CenterRotateYZBy(Value degrees, const Vector3 & center)
}
// ------------------------------------------------------------------------------------------------
const Vector3 & Vector3::Get(const StackStrF & str)
const Vector3 & Vector3::Get(StackStrF & str)
{
return Vector3::GetEx(Vector3::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Vector3 & Vector3::GetEx(SQChar delim, const StackStrF & str)
const Vector3 & Vector3::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f , %f ");

View File

@ -336,7 +336,7 @@ struct Vector3
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate random values for all components of this instance.
@ -493,12 +493,12 @@ struct Vector3
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector3 type from a string.
*/
static const Vector3 & Get(const StackStrF & str);
static const Vector3 & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector3 type from a string.
*/
static const Vector3 & GetEx(SQChar delim, const StackStrF & str);
static const Vector3 & GetEx(SQChar delim, StackStrF & str);
};

View File

@ -416,7 +416,7 @@ void Vector4::SetQuaternionEx(Value nx, Value ny, Value nz, Value nw)
}
// ------------------------------------------------------------------------------------------------
void Vector4::SetStr(SQChar delim, const StackStrF & values)
void Vector4::SetStr(SQChar delim, StackStrF & values)
{
SetVector4(Vector4::GetEx(delim, values));
}
@ -465,13 +465,13 @@ Vector4 Vector4::Abs() const
}
// ------------------------------------------------------------------------------------------------
const Vector4 & Vector4::Get(const StackStrF & str)
const Vector4 & Vector4::Get(StackStrF & str)
{
return Vector4::GetEx(Vector4::Delim, str);
}
// ------------------------------------------------------------------------------------------------
const Vector4 & Vector4::GetEx(SQChar delim, const StackStrF & str)
const Vector4 & Vector4::GetEx(SQChar delim, StackStrF & str)
{
// The format specifications that will be used to scan the string
static SQChar fs[] = _SC(" %f , %f , %f , %f ");

View File

@ -334,7 +334,7 @@ struct Vector4
/* --------------------------------------------------------------------------------------------
* Set the values extracted from the specified string using the specified delimiter.
*/
void SetStr(SQChar delim, const StackStrF & values);
void SetStr(SQChar delim, StackStrF & values);
/* --------------------------------------------------------------------------------------------
* Generate random values for all components of this instance.
@ -367,12 +367,12 @@ struct Vector4
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector4 type from a string.
*/
static const Vector4 & Get(const StackStrF & str);
static const Vector4 & Get(StackStrF & str);
/* --------------------------------------------------------------------------------------------
* Extract the values for components of the Vector4 type from a string.
*/
static const Vector4 & GetEx(SQChar delim, const StackStrF & str);
static const Vector4 & GetEx(SQChar delim, StackStrF & str);
};