mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-22 16:57:12 +02:00
Dumped the old implementation. Started with a more simple approach.
This commit is contained in:
@@ -2,57 +2,52 @@
|
||||
#define _BASE_SHARED_HPP_
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Config.hpp"
|
||||
#include "SqBase.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <vcmp.h>
|
||||
#include <sqrat.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#ifdef PI
|
||||
#undef PI
|
||||
#endif
|
||||
extern const SQChar * g_EmptyStr;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
* Proxies to comunicate with the server.
|
||||
*/
|
||||
const Float32 PI = 3.14159265359f;
|
||||
const Float32 RECIPROCAL_PI = 1.0f/PI;
|
||||
const Float32 HALF_PI = PI/2.0f;
|
||||
extern PluginFuncs* _Func;
|
||||
extern PluginCallbacks* _Clbk;
|
||||
extern PluginInfo* _Info;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#ifdef PI64
|
||||
#undef PI64
|
||||
#endif
|
||||
template < typename T > struct NumLimit;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
const Float64 PI64 = 3.1415926535897932384626433832795028841971693993751;
|
||||
const Float64 RECIPROCAL_PI64 = 1.0/PI64;
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct NumLimit< char > { static const char Min, Max; };
|
||||
template <> struct NumLimit< signed char > { static const signed char Min, Max; };
|
||||
template <> struct NumLimit< unsigned char > { static const unsigned char Min, Max; };
|
||||
template <> struct NumLimit< signed short > { static const signed short Min, Max; };
|
||||
template <> struct NumLimit< unsigned short > { static const unsigned short Min, Max; };
|
||||
template <> struct NumLimit< signed int > { static const signed int Min, Max; };
|
||||
template <> struct NumLimit< unsigned int > { static const unsigned int Min, Max; };
|
||||
template <> struct NumLimit< signed long > { static const signed long Min, Max; };
|
||||
template <> struct NumLimit< unsigned long > { static const unsigned long Min, Max; };
|
||||
template <> struct NumLimit< signed long long > { static const signed long long Min, Max; };
|
||||
template <> struct NumLimit< unsigned long long > { static const unsigned long long Min, Max; };
|
||||
template <> struct NumLimit< float > { static const float Min, Max; };
|
||||
template <> struct NumLimit< double > { static const double Min, Max; };
|
||||
template <> struct NumLimit< long double > { static const long double Min, Max; };
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
const Float32 DEGTORAD = PI / 180.0f;
|
||||
const Float32 RADTODEG = 180.0f / PI;
|
||||
const Float64 DEGTORAD64 = PI64 / 180.0;
|
||||
const Float64 RADTODEG64 = 180.0 / PI64;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template< typename T > inline bool EpsEq(const T a, const T b)
|
||||
{
|
||||
return abs(a - b) <= std::numeric_limits<T>::epsilon();
|
||||
return abs(a - b) <= 0;
|
||||
}
|
||||
|
||||
template <> inline bool EpsEq(const Float32 a, const Float32 b)
|
||||
@@ -65,361 +60,188 @@ template <> inline bool EpsEq(const Float64 a, const Float64 b)
|
||||
return fabs(a - b) <= 0.000000001d;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template< typename T > inline bool EpsLt(const T a, const T b)
|
||||
{
|
||||
return !EpsEq(a, b) && (a < b);
|
||||
}
|
||||
|
||||
template <> inline bool EpsLt(const Float32 a, const Float32 b)
|
||||
{
|
||||
return !EpsEq(a, b) && (a - b) < 0.000001f;
|
||||
}
|
||||
|
||||
template <> inline bool EpsLt(const Float64 a, const Float64 b)
|
||||
{
|
||||
return !EpsEq(a, b) && (a - b) < 0.000000001d;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template< typename T > inline bool EpsGt(const T a, const T b)
|
||||
{
|
||||
return !EpsEq(a, b) && (a > b);
|
||||
}
|
||||
|
||||
template <> inline bool EpsGt(const Float32 a, const Float32 b)
|
||||
{
|
||||
return !EpsEq(a, b) && (a - b) > 0.000001f;
|
||||
}
|
||||
|
||||
template <> inline bool EpsGt(const Float64 a, const Float64 b)
|
||||
{
|
||||
return !EpsEq(a, b) && (a - b) > 0.000000001d;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template< typename T > inline bool EpsLtEq(const T a, const T b)
|
||||
{
|
||||
return !EpsEq(a, b) || (a < b);
|
||||
}
|
||||
|
||||
template <> inline bool EpsLtEq(const Float32 a, const Float32 b)
|
||||
{
|
||||
return !EpsEq(a, b) || (a - b) < 0.000001f;
|
||||
}
|
||||
|
||||
template <> inline bool EpsLtEq(const Float64 a, const Float64 b)
|
||||
{
|
||||
return !EpsEq(a, b) || (a - b) < 0.000000001d;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template< typename T > inline bool EpsGtEq(const T a, const T b)
|
||||
{
|
||||
return !EpsEq(a, b) || (a > b);
|
||||
}
|
||||
|
||||
template <> inline bool EpsGtEq(const Float32 a, const Float32 b)
|
||||
{
|
||||
return !EpsEq(a, b) || (a - b) > 0.000001f;
|
||||
}
|
||||
|
||||
template <> inline bool EpsGtEq(const Float64 a, const Float64 b)
|
||||
{
|
||||
return !EpsEq(a, b) || (a - b) > 0.000000001d;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template< typename T > inline T Clamp(T val, T min, T max)
|
||||
{
|
||||
return val < min ? min : (val > max ? max : val);
|
||||
}
|
||||
|
||||
template<> inline Float32 Clamp(const Float32 val, const Float32 min, const Float32 max)
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Compute the next power of two for the specified number.
|
||||
*/
|
||||
inline Uint32 NextPow2(Uint32 num)
|
||||
{
|
||||
return std::isless(val, min) ? min : (std::isgreater(val, max) ? max : val);
|
||||
--num;
|
||||
num |= num >> 1;
|
||||
num |= num >> 2;
|
||||
num |= num >> 4;
|
||||
num |= num >> 8;
|
||||
num |= num >> 16;
|
||||
return ++num;
|
||||
}
|
||||
|
||||
template<> inline Float64 Clamp(const Float64 val, const Float64 min, const Float64 max)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void LogDbg(CCStr fmt, ...);
|
||||
void LogUsr(CCStr fmt, ...);
|
||||
void LogScs(CCStr fmt, ...);
|
||||
void LogInf(CCStr fmt, ...);
|
||||
void LogWrn(CCStr fmt, ...);
|
||||
void LogErr(CCStr fmt, ...);
|
||||
void LogFtl(CCStr fmt, ...);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void LogSDbg(CCStr fmt, ...);
|
||||
void LogSUsr(CCStr fmt, ...);
|
||||
void LogSScs(CCStr fmt, ...);
|
||||
void LogSInf(CCStr fmt, ...);
|
||||
void LogSWrn(CCStr fmt, ...);
|
||||
void LogSErr(CCStr fmt, ...);
|
||||
void LogSFtl(CCStr fmt, ...);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool cLogDbg(bool cond, CCStr fmt, ...);
|
||||
bool cLogUsr(bool cond, CCStr fmt, ...);
|
||||
bool cLogScs(bool cond, CCStr fmt, ...);
|
||||
bool cLogInf(bool cond, CCStr fmt, ...);
|
||||
bool cLogWrn(bool cond, CCStr fmt, ...);
|
||||
bool cLogErr(bool cond, CCStr fmt, ...);
|
||||
bool cLogFtl(bool cond, CCStr fmt, ...);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool cLogSDbg(bool cond, CCStr fmt, ...);
|
||||
bool cLogSUsr(bool cond, CCStr fmt, ...);
|
||||
bool cLogSScs(bool cond, CCStr fmt, ...);
|
||||
bool cLogSInf(bool cond, CCStr fmt, ...);
|
||||
bool cLogSWrn(bool cond, CCStr fmt, ...);
|
||||
bool cLogSErr(bool cond, CCStr fmt, ...);
|
||||
bool cLogSFtl(bool cond, CCStr fmt, ...);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SqThrow(CCStr fmt, ...);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object & NullObject();
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Array & NullArray();
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Function & NullFunction();
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template < typename T > Object MakeObject(const T & v)
|
||||
{
|
||||
return std::isless(val, min) ? min : (std::isgreater(val, max) ? max : val);
|
||||
PushVar< T >(DefaultVM::Get(), v);
|
||||
Var< Object > var(DefaultVM::Get(), -1);
|
||||
sq_pop(DefaultVM::Get(), 1);
|
||||
return var.value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Simple functions to quickly forward logging messages without including the logging system.
|
||||
*/
|
||||
void LogDbg(const char * fmt, ...);
|
||||
void LogMsg(const char * fmt, ...);
|
||||
void LogScs(const char * fmt, ...);
|
||||
void LogInf(const char * fmt, ...);
|
||||
void LogWrn(const char * fmt, ...);
|
||||
void LogErr(const char * fmt, ...);
|
||||
void LogFtl(const char * fmt, ...);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Simple functions to quickly forward debugging messages without including the debugging system.
|
||||
*/
|
||||
void DbgWrn(const char * fmt, ...);
|
||||
void DbgErr(const char * fmt, ...);
|
||||
void DbgFtl(const char * fmt, ...);
|
||||
|
||||
void DbgWrn(const char * func, const char * fmt, ...);
|
||||
void DbgErr(const char * func, const char * fmt, ...);
|
||||
void DbgFtl(const char * func, const char * fmt, ...);
|
||||
|
||||
void DbgWrn(const char * type, const char * func, const char * fmt, ...);
|
||||
void DbgErr(const char * type, const char * func, const char * fmt, ...);
|
||||
void DbgFtl(const char * type, const char * func, const char * fmt, ...);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
const SQChar * ToStrF(const char * fmt, ...);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
const SQChar * ToStringF(const char * fmt, ...);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
void InitMTRG64();
|
||||
void InitMTRG64();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Int8 GetRandomInt8();
|
||||
Int8 GetRandomInt8(Int8 min, Int8 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Uint8 GetRandomUint8();
|
||||
Uint8 GetRandomUint8(Uint8 min, Uint8 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Int16 GetRandomInt16();
|
||||
Int16 GetRandomInt16(Int16 min, Int16 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Uint16 GetRandomUint16();
|
||||
Uint16 GetRandomUint16(Uint16 min, Uint16 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Int32 GetRandomInt32();
|
||||
Int32 GetRandomInt32(Int32 min, Int32 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Uint32 GetRandomUint32();
|
||||
Uint32 GetRandomUint32(Uint32 min, Uint32 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Int64 GetRandomInt64();
|
||||
Int64 GetRandomInt64(Int64 min, Int64 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Uint64 GetRandomUint64();
|
||||
Uint64 GetRandomUint64(Uint64 min, Uint64 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Float32 GetRandomFloat32();
|
||||
Float32 GetRandomFloat32(Float32 min, Float32 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Float64 GetRandomFloat64();
|
||||
Float64 GetRandomFloat64(Float64 min, Float64 max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
String GetRandomString(String::size_type len);
|
||||
String GetRandomString(String::size_type len, String::value_type min, String::value_type max);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
bool GetRandomBool();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <typename T> struct RandomVal
|
||||
{ /* ... */ };
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<Int8>
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template < typename T > Object MakeObject(HSQUIRRELVM vm, const T & v)
|
||||
{
|
||||
static inline Int8 Get() { return GetRandomInt8(); }
|
||||
static inline Int8 Get(Int8 min, Int8 max) { return GetRandomInt8(min, max); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal<Uint8>
|
||||
{
|
||||
static inline Uint8 Get() { return GetRandomUint8(); }
|
||||
static inline Uint8 Get(Uint8 min, Uint8 max) { return GetRandomUint8(min, max); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<Int16>
|
||||
{
|
||||
static inline Int16 Get() { return GetRandomInt16(); }
|
||||
static inline Int16 Get(Int16 min, Int16 max) { return GetRandomInt16(min, max); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal<Uint16>
|
||||
{
|
||||
static inline Uint16 Get() { return GetRandomUint16(); }
|
||||
static inline Uint16 Get(Uint16 min, Uint16 max) { return GetRandomUint16(min, max); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<Int32>
|
||||
{
|
||||
static inline Int32 Get() { return GetRandomInt32(); }
|
||||
static inline Int32 Get(Int32 min, Int32 max) { return GetRandomInt32(min, max); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal<Uint32>
|
||||
{
|
||||
static inline Uint32 Get() { return GetRandomUint32(); }
|
||||
static inline Uint32 Get(Uint32 min, Uint32 max) { return GetRandomUint32(min, max); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<Int64>
|
||||
{
|
||||
static inline Int64 Get() { return GetRandomInt64(); }
|
||||
static inline Int64 Get(Int64 min, Int64 max) { return GetRandomInt64(min, max); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal<Uint64>
|
||||
{
|
||||
static inline Uint64 Get() { return GetRandomUint64(); }
|
||||
static inline Uint64 Get(Uint64 min, Uint64 max) { return GetRandomUint64(min, max); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<Float32>
|
||||
{
|
||||
static inline Float32 Get() { return GetRandomFloat32(); }
|
||||
static inline Float32 Get(Float32 min, Float32 max) { return GetRandomFloat32(min, max); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal<Float64>
|
||||
{
|
||||
static inline Float64 Get() { return GetRandomFloat64(); }
|
||||
static inline Float64 Get(Float64 min, Float64 max) { return GetRandomFloat64(min, max); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<String>
|
||||
{
|
||||
static inline String Get(String::size_type len) { return GetRandomString(len); }
|
||||
static inline String Get(String::size_type len, String::value_type min, String::value_type max)
|
||||
{ return GetRandomString(len, min, max); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
template <> struct RandomVal<bool>
|
||||
{
|
||||
static inline bool Get() { return GetRandomBool(); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
const Color3 & GetRandomColor();
|
||||
PushVar< T >(vm, v);
|
||||
Var< Object > var(vm, -1);
|
||||
sq_pop(vm, 1);
|
||||
return var.value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Simple function to check whether the specified string can be considered as a boolean value
|
||||
*/
|
||||
bool SToB(const SQChar * str);
|
||||
bool SToB(CSStr str);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Utility used to unify the string converstion functions under one name.
|
||||
*
|
||||
*/
|
||||
template < typename T > struct SToI { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template < typename T > struct SToF { static constexpr auto Fn = static_cast< float(*)(const String &, std::size_t*) >(std::stof); };
|
||||
CSStr ToStrF(CCStr fmt, ...);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
CSStr ToStringF(CCStr fmt, ...);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct SToI < char > { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template <> struct SToI < signed char > { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template <> struct SToI < unsigned char > { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template <> struct SToI < short > { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template <> struct SToI < unsigned short > { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template <> struct SToI < int > { static constexpr auto Fn = static_cast< int(*)(const String &, std::size_t*, int) >(std::stoi); };
|
||||
template <> struct SToI < unsigned int > { static constexpr auto Fn = static_cast< unsigned long(*)(const String &, std::size_t*, int) >(std::stoul); };
|
||||
template <> struct SToI < long > { static constexpr auto Fn = static_cast< long(*)(const String &, std::size_t*, int) >(std::stol); };
|
||||
template <> struct SToI < unsigned long > { static constexpr auto Fn = static_cast< unsigned long(*)(const String &, std::size_t*, int) >(std::stoul); };
|
||||
template <> struct SToI < long long > { static constexpr auto Fn = static_cast< long long(*)(const String &, std::size_t*, int b) >(std::stoll); };
|
||||
template <> struct SToI < unsigned long long > { static constexpr auto Fn = static_cast< unsigned long long(*)(const String &, std::size_t*, int) >(std::stoull); };
|
||||
template <> struct SToF < float > { static constexpr auto Fn = static_cast< float(*)(const String &, std::size_t*) >(std::stof); };
|
||||
template <> struct SToF < double > { static constexpr auto Fn = static_cast< double(*)(const String &, std::size_t*) >(std::stod); };
|
||||
template <> struct SToF < long double > { static constexpr auto Fn = static_cast< long double(*)(const String &, std::size_t*) >(std::stold); };
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template < typename T > inline String NToS(T n) { return std::to_string(n); }
|
||||
template < typename T > inline const SQChar * NToCS(T n) { return std::to_string(n).c_str(); }
|
||||
const Color3 & GetRandomColor();
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
* Value extractors.
|
||||
*/
|
||||
Color3 GetColor(const SQChar * name);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Circle GetCircle(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
AABB GetAABB(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Color3 GetColor3(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Color4 GetColor4(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Quaternion GetQuaternion(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Sphere GetSphere(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Vector2f GetVector2f(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Vector2i GetVector2i(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Vector2u GetVector2u(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Vector3 GetVector3(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
*/
|
||||
Vector4 GetVector4(const SQChar * str, SQChar delim);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Fake deleter meant for classes that should not be deleted by smart pointers
|
||||
*/
|
||||
template <typename T> struct FakeDeleter
|
||||
{
|
||||
void operator () (T * /* ptr */) const { /* Ignored... */ }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Utility used to generate a string with an arbitrary text surrounded by a specific character
|
||||
*/
|
||||
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w = 72);
|
||||
const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w = 72, SQUint32 o = 0);
|
||||
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w = 72);
|
||||
const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w = 72, SQUint32 o = 0);
|
||||
const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w = 72);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Function used insert arbitrary text at certain positions within a string
|
||||
*/
|
||||
const SQChar * InsertStr(const SQChar * f, const std::vector< const SQChar * > & a);
|
||||
|
||||
// Utility for the <InsertStr> function
|
||||
const SQChar * InsStr(const SQChar * f);
|
||||
|
||||
template < typename... Args > const SQChar * InsStr(const SQChar * f, Args... args)
|
||||
{
|
||||
return InsertStr(f, {{args...}});
|
||||
}
|
||||
Color3 GetColor(CSStr name);
|
||||
AABB GetAABB(CSStr str, SQChar delim);
|
||||
Circle GetCircle(CSStr str, SQChar delim);
|
||||
Color3 GetColor3(CSStr str, SQChar delim);
|
||||
Color4 GetColor4(CSStr str, SQChar delim);
|
||||
Quaternion GetQuaternion(CSStr str, SQChar delim);
|
||||
Sphere GetSphere(CSStr str, SQChar delim);
|
||||
Vector2 GetVector2(CSStr str, SQChar delim);
|
||||
Vector2i GetVector2i(CSStr str, SQChar delim);
|
||||
Vector3 GetVector3(CSStr str, SQChar delim);
|
||||
Vector4 GetVector4(CSStr str, SQChar delim);
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
|
Reference in New Issue
Block a user