1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update sqratConst.h

This commit is contained in:
Sandu Liviu Catalin 2021-03-20 12:08:51 +02:00
parent d7804ab321
commit 5885c3f10b

View File

@ -65,49 +65,49 @@ struct EnumElement
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructors that can identify the type and perform the proper conversion. /// Constructors that can identify the type and perform the proper conversion.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EnumElement(const SQChar * name, const SQChar * value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, const SQChar * value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mSTR(value), Type(SQET_STRING) : Name(name), mSTR(value), Type(SQET_STRING)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, bool value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, bool value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mBOOL(value), Type(SQET_BOOL) : Name(name), mBOOL(value), Type(SQET_BOOL)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, signed char value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, signed char value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, unsigned char value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, unsigned char value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, signed short value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, signed short value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, unsigned short value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, unsigned short value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, signed int value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, signed int value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, unsigned int value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, unsigned int value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, signed long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, signed long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, unsigned long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, unsigned long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, signed long long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, signed long long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, unsigned long long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, unsigned long long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, float value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, float value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL) : Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL)
{ /* ... */ } { /* ... */ }
EnumElement(const SQChar * name, double value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) constexpr EnumElement(const SQChar * name, double value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL) : Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL)
{ /* ... */ } { /* ... */ }
template < typename T > EnumElement(const SQChar * name, T value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init) template < typename T > constexpr EnumElement(const SQChar * name, T value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT) : Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
{ /* ... */ } { /* ... */ }
}; };
@ -326,8 +326,8 @@ public:
/// \return The ConstTable itself so the call can be chained /// \return The ConstTable itself so the call can be chained
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual ConstTable& Const(const SQChar* name, const int val) { virtual ConstTable& Const(const SQChar* name, const bool val) {
Enumeration::Const(name, val); Enumeration::Const(name, val ? 1 : 0);
return *this; return *this;
} }
@ -340,7 +340,35 @@ public:
/// \return The ConstTable itself so the call can be chained /// \return The ConstTable itself so the call can be chained
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual ConstTable& Const(const SQChar* name, const float val) { virtual ConstTable& Const(const SQChar* name, const SQInteger val) {
Enumeration::Const(name, val);
return *this;
}
#ifdef _SQ64
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a constant value
///
/// \param name Name of the value as it will appear in Squirrel
/// \param val Value to bind
///
/// \return The ConstTable itself so the call can be chained
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual ConstTable& Const(const SQChar* name, const int val) {
Enumeration::Const(name, val);
return *this;
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Binds a constant value
///
/// \param name Name of the value as it will appear in Squirrel
/// \param val Value to bind
///
/// \return The ConstTable itself so the call can be chained
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual ConstTable& Const(const SQChar* name, const SQFloat val) {
Enumeration::Const(name, val); Enumeration::Const(name, val);
return *this; return *this;
} }