diff --git a/sdk/include/loki/HierarchyGenerators.h b/sdk/include/loki/HierarchyGenerators.h index 17108017814..a59753d26ed 100644 --- a/sdk/include/loki/HierarchyGenerators.h +++ b/sdk/include/loki/HierarchyGenerators.h @@ -29,9 +29,302 @@ #define HIERARCHYGENERATORS_INC_ #include "Typelist.h" +#include "TypeManip.h" +#include "EmptyType.h" namespace Loki { +//////////////////////////////////////////////////////////////////////////////// +// class template GenScatterHierarchy +// Generates a scattered hierarchy starting from a typelist and a template +// Invocation (TList is a typelist, Model is a template of one arg): +// GenScatterHierarchy +// The generated class inherits all classes generated by instantiating the +// template 'Model' with the types contained in TList +//////////////////////////////////////////////////////////////////////////////// + + + template class Unit> + class GenScatterHierarchy; + + namespace Private + { + // for some reason VC7 needs the base definition altough not in use + template + struct GenScatterHierarchyHelper1 + { + template class Unit> + struct In + { + typedef typename T::ERROR_THIS_INSTANCE_SELECTED Result; + }; + }; + + template + struct GenScatterHierarchyHelper2 + { + template class Unit> + struct In + { + typedef typename T::ERROR_THIS_INSTANCE_SELECTED Result; + }; + }; + + + template <> + struct GenScatterHierarchyHelper1 + { + template class Unit> + struct In + { + typedef GenScatterHierarchy Result; + }; + }; + + template <> + struct GenScatterHierarchyHelper2 + { + template class Unit> + struct In + { + typedef GenScatterHierarchy Result; + }; + }; + + + template <> + struct GenScatterHierarchyHelper1 + { + template class Unit> + struct In { typedef Unit Result; }; + }; + + template <> + struct GenScatterHierarchyHelper2 + { + template class Unit> + struct In { struct Result {}; }; + }; + + + template <> + struct GenScatterHierarchyHelper1 + { + template class Unit> + struct In { struct Result {}; }; + }; + + template <> + struct GenScatterHierarchyHelper2 + { + template class Unit> + struct In { struct Result {}; }; + }; + + } // namespace Private + + template class Unit> + class GenScatterHierarchy + : public Private::GenScatterHierarchyHelper1 + < + typename TL::is_Typelist::type_tag + > + ::template In::Result + + , public Private::GenScatterHierarchyHelper2 + < + typename TL::is_Typelist::type_tag + > + ::template In::Result + { + public: + + typedef typename Private::GenScatterHierarchyHelper1 + < + typename TL::is_Typelist::type_tag + > + ::template In::Result LeftBase; + + typedef typename Private::GenScatterHierarchyHelper2 + < + typename TL::is_Typelist::type_tag + > + ::template In::Result RightBase; + + + typedef typename Select + < + TL::is_Typelist::value, T, void + > + ::Result TList; + + template struct Rebind + { + typedef Unit Result; + }; + }; + + +//////////////////////////////////////////////////////////////////////////////// +// function template Field +// Accesses a field in an object of a type generated with GenScatterHierarchy +// Invocation (obj is an object of a type H generated with GenScatterHierarchy, +// T is a type in the typelist used to generate H): +// Field(obj) +// returns a reference to Unit, where Unit is the template used to generate H +//////////////////////////////////////////////////////////////////////////////// + + template + typename H::template Rebind::Result & + Field(H& obj) + { + return obj; + } + + template + typename H::template Rebind::Result const & + Field(H const & obj) + { + return obj; + } + +//////////////////////////////////////////////////////////////////////////////// +// function template TupleUnit +// The building block of tuples +//////////////////////////////////////////////////////////////////////////////// + + template + struct TupleUnit + { + T value_; + operator T&() { return value_; } + operator const T&() const { return value_; } + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template Tuple +// Implements a tuple class that holds a number of values and provides field +// access to them via the Field function (below) +//////////////////////////////////////////////////////////////////////////////// + + template + struct Tuple : public GenScatterHierarchy + { + }; + + +//////////////////////////////////////////////////////////////////////////////// +// helper class template FieldHelper +// See Field below +//////////////////////////////////////////////////////////////////////////////// + + template + struct FieldHelper + { + template + struct In + { + private: + typedef typename TL::TypeAt::Result ElementType; + typedef typename H::template Rebind::Result UnitType; + + static constexpr bool isConst = std::is_const_v; + + typedef typename Select + < + isConst, + const typename H::RightBase, + typename H::RightBase + > + ::Result RightBase; + + typedef typename Select + < + IsSameType >::value, + ElementType, + UnitType + > + ::Result UnqualifiedResultType; + + public: + typedef typename Select + < + isConst, + const UnqualifiedResultType, + UnqualifiedResultType + > + ::Result ResultType; + + static ResultType& Do(H& obj) + { + RightBase& rightBase = obj; + return FieldHelper::template In::Do(rightBase); + } + }; + }; + + template <> + struct FieldHelper<0> + { + template + struct In + { + private: + typedef typename H::TList::Head ElementType; + typedef typename H::template Rebind::Result UnitType; + + static constexpr bool isConst = std::is_const_v; + + typedef typename Select + < + isConst, + const typename H::LeftBase, + typename H::LeftBase + > + ::Result LeftBase; + + typedef typename Select + < + IsSameType >::value, + ElementType, + UnitType + > + ::Result UnqualifiedResultType; + + public: + typedef typename Select + < + isConst, + const UnqualifiedResultType, + UnqualifiedResultType + > + ::Result ResultType; + + static ResultType& Do(H& obj) + { + LeftBase& leftBase = obj; + return leftBase; + } + }; + }; + +//////////////////////////////////////////////////////////////////////////////// +// function template Field +// Accesses a field in an object of a type generated with GenScatterHierarchy +// Invocation (obj is an object of a type H generated with GenScatterHierarchy, +// i is the index of a type in the typelist used to generate H): +// Field(obj) +// returns a reference to Unit, where Unit is the template used to generate H +// and T is the i-th type in the typelist +//////////////////////////////////////////////////////////////////////////////// + + template + typename FieldHelper::template In::ResultType& + Field(H& obj) + { + return FieldHelper::template In::Do(obj); + } + //////////////////////////////////////////////////////////////////////////////// // class template GenLinearHierarchy // Generates a linear hierarchy starting from a typelist and a template @@ -39,18 +332,80 @@ namespace Loki // GenLinearHierarchy //////////////////////////////////////////////////////////////////////////////// - template typename, typename Root = EmptyType> - struct GenLinearHierarchy; + template + < + class TList, + template class Unit, + class Root = EmptyType + > + class GenLinearHierarchy; + + namespace Private + { + + template + struct GenLinearHierarchyHelper + { + template class Unit, class Root> + struct In + { + typedef typename TList::ERROR_THIS_INSTANCE_SELECTED Result; + }; + }; + + template <> + struct GenLinearHierarchyHelper + { + template class Unit, class Root> + struct In + { + private: + typedef typename TList::Head Head; + typedef typename TList::Tail Tail; - template typename Unit, typename Root> - struct GenLinearHierarchy, Unit, Root> - : Unit - { }; + public: + typedef Unit< Head, GenLinearHierarchy > Result; + }; + }; - template typename Unit, typename Root> - struct GenLinearHierarchy, Unit, Root> - : Unit, Unit, Root>> - { }; + template <> + struct GenLinearHierarchyHelper + { + template class Unit, class Root> + struct In + { + private: + typedef typename TList::Head Head; + + public: + typedef Unit Result; + }; + }; + + } // namespace Private + + template + < + class TList, + template class Unit, + class Root + > + class GenLinearHierarchy + : public Private::GenLinearHierarchyHelper + < + typename TL::is_Typelist::type_tag + > + ::template In::Result + { + ASSERT_TYPELIST(TList); // TList must not be NullType + + public: + typedef typename Private::GenLinearHierarchyHelper + < + typename TL::is_Typelist::type_tag + > + ::template In::Result LinBase; + }; } // namespace Loki @@ -62,3 +417,7 @@ namespace Loki #endif // HIERARCHYGENERATORS_INC_ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif // _MSC_VER + diff --git a/sdk/include/loki/TypeManip.h b/sdk/include/loki/TypeManip.h index 33a4b6fcaca..dc175fa6843 100644 --- a/sdk/include/loki/TypeManip.h +++ b/sdk/include/loki/TypeManip.h @@ -60,17 +60,7 @@ namespace Loki template struct Select { - private: - template - struct In - { typedef T Result; }; - - template<> - struct In - { typedef U Result; }; - - public: - typedef typename In::Result Result; + using Result = std::conditional_t; }; @@ -84,20 +74,8 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// template - struct IsSameType - { - private: - template - struct In - { enum { value = false }; }; - - template<> - struct In - { enum { value = true }; }; - - public: - enum { value = In::value }; - }; + struct IsSameType : std::is_same + {}; //////////////////////////////////////////////////////////////////////////////// // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) diff --git a/sdk/include/loki/Typelist.h b/sdk/include/loki/Typelist.h index 04de2072891..7f2e3a7a0a0 100644 --- a/sdk/include/loki/Typelist.h +++ b/sdk/include/loki/Typelist.h @@ -19,8 +19,334 @@ #ifndef TYPELIST_INC_ #define TYPELIST_INC_ -#include -#include "EmptyType.h" +#include "static_check.h" +#include "NullType.h" + +//////////////////////////////////////////////////////////////////////////////// +// macros TYPELIST_1, TYPELIST_2, ... TYPELIST_50 +// Each takes a number of arguments equal to its numeric suffix +// The arguments are type names. TYPELIST_NN generates a typelist containing +// all types passed as arguments, in that order. +// Example: TYPELIST_2(char, int) generates a type containing char and int. +//////////////////////////////////////////////////////////////////////////////// + +#define TYPELIST_1(T1) ::Loki::Typelist + +#define TYPELIST_2(T1, T2) ::Loki::Typelist + +#define TYPELIST_3(T1, T2, T3) ::Loki::Typelist + +#define TYPELIST_4(T1, T2, T3, T4) \ + ::Loki::Typelist + +#define TYPELIST_5(T1, T2, T3, T4, T5) \ + ::Loki::Typelist + +#define TYPELIST_6(T1, T2, T3, T4, T5, T6) \ + ::Loki::Typelist + +#define TYPELIST_7(T1, T2, T3, T4, T5, T6, T7) \ + ::Loki::Typelist + +#define TYPELIST_8(T1, T2, T3, T4, T5, T6, T7, T8) \ + ::Loki::Typelist + +#define TYPELIST_9(T1, T2, T3, T4, T5, T6, T7, T8, T9) \ + ::Loki::Typelist + +#define TYPELIST_10(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) \ + ::Loki::Typelist + +#define TYPELIST_11(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) \ + ::Loki::Typelist + +#define TYPELIST_12(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) \ + ::Loki::Typelist + +#define TYPELIST_13(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) \ + ::Loki::Typelist + +#define TYPELIST_14(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14) \ + ::Loki::Typelist + +#define TYPELIST_15(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15) \ + ::Loki::Typelist + +#define TYPELIST_16(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16) \ + ::Loki::Typelist + +#define TYPELIST_17(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17) \ + ::Loki::Typelist + +#define TYPELIST_18(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18) \ + ::Loki::Typelist + +#define TYPELIST_19(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19) \ + ::Loki::Typelist + +#define TYPELIST_20(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) \ + ::Loki::Typelist + +#define TYPELIST_21(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) \ + ::Loki::Typelist + +#define TYPELIST_22(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) \ + ::Loki::Typelist + +#define TYPELIST_23(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23) \ + ::Loki::Typelist + +#define TYPELIST_24(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24) \ + ::Loki::Typelist + +#define TYPELIST_25(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25) \ + ::Loki::Typelist + +#define TYPELIST_26(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26) \ + ::Loki::Typelist + +#define TYPELIST_27(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27) \ + ::Loki::Typelist + +#define TYPELIST_28(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28) \ + ::Loki::Typelist + +#define TYPELIST_29(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29) \ + ::Loki::Typelist + +#define TYPELIST_30(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30) \ + ::Loki::Typelist + +#define TYPELIST_31(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31) \ + ::Loki::Typelist + +#define TYPELIST_32(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32) \ + ::Loki::Typelist + +#define TYPELIST_33(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33) \ + ::Loki::Typelist + +#define TYPELIST_34(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34) \ + ::Loki::Typelist + +#define TYPELIST_35(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35) \ + ::Loki::Typelist + +#define TYPELIST_36(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36) \ + ::Loki::Typelist + +#define TYPELIST_37(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37) \ + ::Loki::Typelist + +#define TYPELIST_38(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38) \ + ::Loki::Typelist + +#define TYPELIST_39(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39) \ + ::Loki::Typelist + +#define TYPELIST_40(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40) \ + ::Loki::Typelist + +#define TYPELIST_41(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41) \ + ::Loki::Typelist + +#define TYPELIST_42(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42) \ + ::Loki::Typelist + +#define TYPELIST_43(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43) \ + ::Loki::Typelist + +#define TYPELIST_44(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44) \ + ::Loki::Typelist + +#define TYPELIST_45(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ + T41, T42, T43, T44, T45) \ + ::Loki::Typelist + +#define TYPELIST_46(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ + T41, T42, T43, T44, T45, T46) \ + ::Loki::Typelist + +#define TYPELIST_47(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ + T41, T42, T43, T44, T45, T46, T47) \ + ::Loki::Typelist + +#define TYPELIST_48(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ + T41, T42, T43, T44, T45, T46, T47, T48) \ + ::Loki::Typelist + +#define TYPELIST_49(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ + T41, T42, T43, T44, T45, T46, T47, T48, T49) \ + ::Loki::Typelist + +#define TYPELIST_50(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, \ + T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, \ + T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, \ + T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, \ + T41, T42, T43, T44, T45, T46, T47, T48, T49, T50) \ + ::Loki::Typelist namespace Loki { @@ -33,32 +359,121 @@ namespace Loki // Tail (second element, can be another typelist) //////////////////////////////////////////////////////////////////////////////// - template struct Typelist; - - template - struct Typelist { - using Head = T; - }; - - template <> struct Typelist<> { - using Head = EmptyType; + template + struct Typelist + { + typedef T Head; + typedef U Tail; }; namespace TL { +//////////////////////////////////////////////////////////////////////////////// +// class template MakeTypelist +// Takes a number of arguments equal to its numeric suffix +// The arguments are type names. +// MakeTypelist::Result +// returns a typelist that is of T1, T2, ... +//////////////////////////////////////////////////////////////////////////////// + + template + < + typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, + typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, + typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, + typename T10 = NullType, typename T11 = NullType, typename T12 = NullType, + typename T13 = NullType, typename T14 = NullType, typename T15 = NullType, + typename T16 = NullType, typename T17 = NullType, typename T18 = NullType + > + struct MakeTypelist + { + private: + typedef typename MakeTypelist + < + T2 , T3 , T4 , + T5 , T6 , T7 , + T8 , T9 , T10, + T11, T12, T13, + T14, T15, T16, + T17, T18 + > + ::Result TailResult; + + public: + typedef Typelist Result; + }; + + template<> + struct MakeTypelist + < + NullType, NullType, NullType, + NullType, NullType, NullType, + NullType, NullType, NullType, + NullType, NullType, NullType, + NullType, NullType, NullType, + NullType, NullType, NullType + >{ + typedef NullType Result; + }; + + //////////////////////////////////////////////////////////////////////////////// // class template is_Typelist // detects if type is Typelist (including Nulltype) // Invocation : // is_Typelist::value // returns a compile-time boolean constant containing true iff T is some Typelist +// is_Typelist::type_tag +// returns a compile-time unsigned constant containing +// 1 iff T == Typelist, 2 iff T == NullType and 3 otherwise //////////////////////////////////////////////////////////////////////////////// - template - struct is_Typelist : std::false_type { }; + struct Typelist_tag {}; + struct NullType_tag {}; + struct NoneList_tag {}; + + enum + { + Typelist_ID = 1, + NullType_ID = 2, + NoneList_ID = 3 + }; - template - struct is_Typelist> : std::true_type { }; + template + struct is_Typelist : std::false_type + { + static constexpr int type_it = NoneList_ID; + using type_tag = NoneList_tag; + }; + + template + struct is_Typelist> : std::true_type + { + static constexpr int type_id = Typelist_ID; + using type_tag = Typelist_tag; + }; + + template<> + struct is_Typelist : std::true_type + { + static constexpr int type_id = NullType_ID; + using type_tag = NullType_tag; + }; + + +#ifndef TL_FAST_COMPILATION + +// this macro will cause compile time error if _type_ is not a Typelist or NullType +#define ASSERT_TYPELIST(_type_) \ +STATIC_CHECK( ::Loki::TL::is_Typelist<_type_>::value, TList_is_not_legal_Typelist ) + +#else + +// might improve the compilation time +#define ASSERT_TYPELIST(_type_) \ +typedef char _type_##_is_not_a_Typelist[true] + +#endif // ndef TL_FAST_COMPILATION //////////////////////////////////////////////////////////////////////////////// // class template Length @@ -69,13 +484,15 @@ namespace Loki // the end terminator (which by convention is NullType) //////////////////////////////////////////////////////////////////////////////// - // Length - template - struct Length; + template struct Length; + + template <> + struct Length + : std::integral_constant {}; - template - struct Length> - : std::integral_constant { }; + template + struct Length> + : std::integral_constant::value> {}; //////////////////////////////////////////////////////////////////////////////// // class template TypeAt @@ -87,19 +504,21 @@ namespace Loki // If you pass an out-of-bounds index, the result is a compile-time error //////////////////////////////////////////////////////////////////////////////// - template - struct TypeAt; + template + struct TypeAt + { + using Result = typename TypeAt::Result; - template - struct TypeAt, 0> { - using type = T; + private: + ASSERT_TYPELIST(TList); }; - template - struct TypeAt, ix> { - using type = typename TypeAt, ix - 1>::type; + template + struct TypeAt + { + using Result = typename TList::Head; }; - + //////////////////////////////////////////////////////////////////////////////// // class template TypeAtNonStrict // Finds the type at a given index in a typelist @@ -113,22 +532,26 @@ namespace Loki //////////////////////////////////////////////////////////////////////////////// - template - struct TypeAtNonStrict; + template + struct TypeAtNonStrict + { + using Tail = typename TList::Tail; + using Result = typename TypeAtNonStrict::Result; - template - struct TypeAtNonStrict, ix> { - using type = EmptyType; + private: + ASSERT_TYPELIST(TList); }; - template - struct TypeAtNonStrict, 0> { - using type = T; + template + struct TypeAtNonStrict + { + using Result = DefaultType; }; - template - struct TypeAtNonStrict, ix> { - using type = typename TypeAtNonStrict, ix - 1>::type; + template + struct TypeAtNonStrict + { + using Result = typename TList::Head; }; //////////////////////////////////////////////////////////////////////////////// @@ -136,36 +559,310 @@ namespace Loki // Finds the index of a type in a typelist // Invocation (TList is a typelist and T is a type): // IndexOf::value -// returns the position of T in TList, or NullType if T is not found in TList +// returns the position of T in TList, or -1 if T is not found in TList //////////////////////////////////////////////////////////////////////////////// - template + template struct IndexOf; - template - struct IndexOf, T> - : std::integral_constant + template + struct IndexOf + : std::integral_constant {}; - template - struct IndexOf, T> - : std::integral_constant, T>::value> + template + struct IndexOf, T> + : std::integral_constant {}; - template - struct IndexOf, T> - : std::integral_constant + template + struct IndexOf, T> + : std::integral_constant::value> {}; +//////////////////////////////////////////////////////////////////////////////// +// class template Append +// Appends a type or a typelist to another +// Invocation (TList is a typelist and T is either a type or a typelist): +// Append::Result +// returns a typelist that is TList followed by T and NullType-terminated +//////////////////////////////////////////////////////////////////////////////// + + template + struct Append; + + template + struct Append, T> + { + using Result = Typelist::Result>; + }; + + template + struct Append + { + using Result = std::conditional_t::value, + T, + TYPELIST_1(T)>; + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template Erase +// Erases the first occurence, if any, of a type in a typelist +// Invocation (TList is a typelist and T is a type): +// Erase::Result +// returns a typelist that is TList without the first occurence of T +//////////////////////////////////////////////////////////////////////////////// - template - struct Prepend; + template + struct Erase; + + template + struct Erase, T> + { + using Result = std::conditional_t, + Tail, + Typelist::Result>>; + }; + + template + struct Erase + { + using Result = NullType; + }; + + +//////////////////////////////////////////////////////////////////////////////// +// class template EraseAll +// Erases all first occurences, if any, of a type in a typelist +// Invocation (TList is a typelist and T is a type): +// EraseAll::Result +// returns a typelist that is TList without any occurence of T +//////////////////////////////////////////////////////////////////////////////// + + template + struct EraseAll; + + template + struct EraseAll, T> + { + using Result = std::conditional_t, + typename EraseAll::Result, + Typelist::Result>>; + }; + + template + struct EraseAll + { + using Result = NullType; + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template NoDuplicates +// Removes all duplicate types in a typelist +// Invocation (TList is a typelist): +// NoDuplicates::Result +//////////////////////////////////////////////////////////////////////////////// + + template + struct NoDuplicates + { + private: + typedef typename TList::Head Head; + typedef typename TList::Tail Tail; + + ASSERT_TYPELIST(TList); + + typedef typename NoDuplicates::Result L1; + typedef typename Erase::Result L2; + + public: + typedef Typelist Result; + }; + + template <> + struct NoDuplicates + { + typedef NullType Result; + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template Replace +// Replaces the first occurence of a type in a typelist, with another type +// Invocation (TList is a typelist, T, U are types): +// Replace::Result +// returns a typelist in which the first occurence of T is replaced with U +//////////////////////////////////////////////////////////////////////////////// + + template + struct Replace; + + template + struct Replace, T, U> + { + using Result = std::conditional_t, + Typelist, + Typelist::Result>>; + }; + + template + struct Replace + { + using Result = NullType; + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template ReplaceAll +// Replaces all occurences of a type in a typelist, with another type +// Invocation (TList is a typelist, T, U are types): +// Replace::Result +// returns a typelist in which all occurences of T is replaced with U +//////////////////////////////////////////////////////////////////////////////// + + template + struct ReplaceAll; + + template + struct ReplaceAll, T, U> + { + using Result = std::conditional_t, + Typelist::Result>, + Typelist::Result>>; + }; + + template + struct ReplaceAll + { + using Result = NullType; + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template Reverse +// Reverses a typelist +// Invocation (TList is a typelist): +// Reverse::Result +// returns a typelist that is TList reversed +//////////////////////////////////////////////////////////////////////////////// + + template struct Reverse; + + template <> + struct Reverse + { + typedef NullType Result; + }; + + template + struct Reverse + { + private: + typedef typename TList::Head Head; + typedef typename TList::Tail Tail; + + ASSERT_TYPELIST(TList); + + public: + typedef typename Append< + typename Reverse::Result, Head>::Result Result; + }; + + +//////////////////////////////////////////////////////////////////////////////// +// class template MostDerived +// Finds the type in a typelist that is the most derived from a given type +// Invocation (TList is a typelist, T is a type): +// Replace::Result +// returns the type in TList that's the most derived from T +//////////////////////////////////////////////////////////////////////////////// + + template + struct MostDerived; + + template + struct MostDerived, T> + { + private: + using Candidate = typename MostDerived::Result; + + public: + using Result = std::conditional_t, + Head, + Candidate>; + }; + + template + struct MostDerived + { + using Result = T; + }; + +//////////////////////////////////////////////////////////////////////////////// +// class template DerivedToFront +// Arranges the types in a typelist so that the most derived types appear first +// Invocation (TList is a typelist): +// DerivedToFront::Result +// returns the reordered TList +//////////////////////////////////////////////////////////////////////////////// + + template struct DerivedToFront; + + template <> + struct DerivedToFront + { + typedef NullType Result; + }; + + template + struct DerivedToFront + { + private: + ASSERT_TYPELIST(TList); + + typedef typename TList::Head Head; + typedef typename TList::Tail Tail; + + typedef typename MostDerived::Result TheMostDerived; + typedef typename Replace::Result Temp; + typedef typename DerivedToFront::Result L; + + public: + typedef Typelist Result; + }; + + +//////////////////////////////////////////////////////////////////////////////// +// class template DerivedToFrontAll +// Arranges all the types in a typelist so that the most derived types appear first +// Invocation (TList is a typelist): +// DerivedToFront::Result +// returns the reordered TList +//////////////////////////////////////////////////////////////////////////////// + + template struct DerivedToFrontAll; + + template <> + struct DerivedToFrontAll + { + typedef NullType Result; + }; + + template + struct DerivedToFrontAll + { + private: + ASSERT_TYPELIST(TList); + + typedef typename TList::Head Head; + typedef typename TList::Tail Tail; + + typedef typename MostDerived::Result TheMostDerived; + typedef typename Replace::Result L; + + typedef typename DerivedToFrontAll::Result TailResult; - template - struct Prepend> - { - using result = Typelist; + public: + typedef Typelist Result; }; + } // namespace TL } // namespace Loki diff --git a/src/Common/PlatformLinux.inl b/src/Common/PlatformLinux.inl index 6fa73c445ba..989cc1d9052 100644 --- a/src/Common/PlatformLinux.inl +++ b/src/Common/PlatformLinux.inl @@ -49,6 +49,7 @@ #define CALLBACK #define TEXT(x) strdup(x) +/* inline char* _strlwr_l(char* str, locale_t loc) { //TODO @@ -58,6 +59,7 @@ inline char* _strupr_l(char* str, locale_t loc) { //TODO } +*/ #define VOID void #define HKL void* diff --git a/src/utils/xrSE_Factory/xrSE_Factory.vcxproj b/src/utils/xrSE_Factory/xrSE_Factory.vcxproj index 1f7ddd97dd0..4a2bd7654b3 100644 --- a/src/utils/xrSE_Factory/xrSE_Factory.vcxproj +++ b/src/utils/xrSE_Factory/xrSE_Factory.vcxproj @@ -244,7 +244,14 @@ $(IntDir)$(ProjectName)_script.pch $(IntDir)$(ProjectName)_script.pch - + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + pch_script.h diff --git a/src/xrGame/accumulative_states.h b/src/xrGame/accumulative_states.h index e4ee75a36fd..713522bde87 100644 --- a/src/xrGame/accumulative_states.h +++ b/src/xrGame/accumulative_states.h @@ -56,9 +56,10 @@ struct accumulative_pair_t }; // struct accumulative_pair_t } // namespace detail -#define ACCUMULATIVE_STATE_LIST Loki::Typelist<> -#define ADD_ACCUMULATIVE_STATE(id, type) using Accumulative_State_Type_##type = \ - Loki::TL::Prepend, ACCUMULATIVE_STATE_LIST>::result +#define ACCUMULATIVE_STATE_LIST Loki::NullType +#define ADD_ACCUMULATIVE_STATE(id, type) \ + typedef Loki::Typelist, ACCUMULATIVE_STATE_LIST> \ + Accumulative_State_Type_##type; #define SAVE_TYPE_LIST(id, type) Accumulative_State_Type_##type } // namespace award_system diff --git a/src/xrGame/alife_registry_container.cpp b/src/xrGame/alife_registry_container.cpp index 6c90a7fca33..da7e7887e8d 100644 --- a/src/xrGame/alife_registry_container.cpp +++ b/src/xrGame/alife_registry_container.cpp @@ -12,35 +12,35 @@ #include "alife_space.h" #include "Common/object_type_traits.h" -template +template struct RegistryHelper; template -struct RegistryHelper> +struct RegistryHelper { static void Save(TContainer*, IWriter&) {}; static void Load(TContainer*, IReader&) {}; }; -template -struct RegistryHelper> +template +struct RegistryHelper> { - static constexpr bool isSerializable = object_type_traits::is_base_and_derived::value; + static constexpr bool isSerializable = + object_type_traits::is_base_and_derived::value; static void Save(TContainer* self, IWriter& writer) { if constexpr (isSerializable) - self->T::save(writer); - RegistryHelper>::Save(self, writer); + self->Head::save(writer); + RegistryHelper::Save(self, writer); }; static void Load(TContainer* self, IReader& reader) { if constexpr (isSerializable) - self->T::load(reader); - RegistryHelper>::Load(self, reader); + self->Head::load(reader); + RegistryHelper::Load(self, reader); } - }; void CALifeRegistryContainer::load(IReader& file_stream) diff --git a/src/xrGame/alife_registry_container.h b/src/xrGame/alife_registry_container.h index a77947ba9ad..d67b71a9999 100644 --- a/src/xrGame/alife_registry_container.h +++ b/src/xrGame/alife_registry_container.h @@ -17,7 +17,7 @@ struct CLinearRegistryType : public _base, public _type { }; -class CALifeRegistryContainer : public Loki::GenLinearHierarchy +class CALifeRegistryContainer : public Loki::GenLinearHierarchy::LinBase { private: typedef registry_type_list TYPE_LIST; diff --git a/src/xrGame/alife_registry_container_space.h b/src/xrGame/alife_registry_container_space.h index aa692f619d8..7c96fa368d2 100644 --- a/src/xrGame/alife_registry_container_space.h +++ b/src/xrGame/alife_registry_container_space.h @@ -9,7 +9,7 @@ #pragma once #include -#define registry_type_list Loki::Typelist<> -#define add_to_registry_type_list(a) using registry_##a = Loki::TL::Prepend::result; +#define registry_type_list Loki::NullType +#define add_to_registry_type_list(a) typedef Loki::Typelist registry_##a; #define define_constant(a) (a*)0 #define save_registry_type_list(a) registry_##a diff --git a/src/xrGame/alife_simulator_script.cpp b/src/xrGame/alife_simulator_script.cpp index 795dda59a5c..537ccebe469 100644 --- a/src/xrGame/alife_simulator_script.cpp +++ b/src/xrGame/alife_simulator_script.cpp @@ -348,10 +348,9 @@ SCRIPT_EXPORT(CALifeSimulator, (), { .def("actor", &get_actor) .def("has_info", &has_info) .def("dont_has_info", &dont_has_info) -#ifndef LINUX // FIXME!!! - .def("switch_distance", &CALifeSimulator::switch_distance) - .def("set_switch_distance", &CALifeSimulator::set_switch_distance) //Alundaio: renamed to set_switch_distance from switch_distance -#endif + .def("switch_distance", (float (CALifeSimulator::*)())(&CALifeSimulator::switch_distance)) + .def("set_switch_distance", (void (CALifeSimulator::*)(float)) + (&CALifeSimulator::set_switch_distance)) //Alundaio: renamed to set_switch_distance from switch_distance //Alundaio: extend alife simulator exports .def("teleport_object", &teleport_object) //Alundaio: END diff --git a/src/xrGame/base_client_classes_wrappers.h b/src/xrGame/base_client_classes_wrappers.h index 19507116251..9b02f0e7dad 100644 --- a/src/xrGame/base_client_classes_wrappers.h +++ b/src/xrGame/base_client_classes_wrappers.h @@ -34,8 +34,9 @@ struct linear_registrator<_type, Loki::EmptyType> : public _type template struct heritage { - using tl = Loki::Typelist<_1, _2>; - using result = Loki::GenLinearHierarchy; + typedef Loki::Typelist<_1, Loki::Typelist<_2, Loki::NullType>> tl; + typedef typename Loki::TL::Erase::Result pure_tl; + typedef typename Loki::GenLinearHierarchy::LinBase result; }; template diff --git a/src/xrGame/game_state_accumulator.h b/src/xrGame/game_state_accumulator.h index 51768c4deac..ea1a4d0dbbf 100644 --- a/src/xrGame/game_state_accumulator.h +++ b/src/xrGame/game_state_accumulator.h @@ -81,7 +81,6 @@ class game_state_accumulator : public game_events_handler bool check_accumulative_value(enum_accumulative_player_values param_id, u32_binary_function* func, u32 right_arg); using accumulative_values_collection_t = AssociativeVector; - private: // average_values_collection_t m_average_values; accumulative_values_collection_t m_accumulative_values; diff --git a/src/xrGame/game_state_accumulator_inline.h b/src/xrGame/game_state_accumulator_inline.h new file mode 100644 index 00000000000..a64e42fe249 --- /dev/null +++ b/src/xrGame/game_state_accumulator_inline.h @@ -0,0 +1,11 @@ +template +void game_state_accumulator::init_acpv_list() +{ + static_assert(Loki::TL::is_Typelist::value, + "Type must have a Loki Type List type use ADD_ACCUMULATIVE_STATE macro define."); + init_acpv_list(); + + player_state_param* tmp_obj_inst = new typename TypeListElement::Head::value_type(this); + + m_accumulative_values.insert(std::make_pair(TypeListElement::Head::value_id, tmp_obj_inst)); +} diff --git a/src/xrGame/game_state_accumulator_state_register.cpp b/src/xrGame/game_state_accumulator_state_register.cpp index b3b987a4483..3819406bcde 100644 --- a/src/xrGame/game_state_accumulator_state_register.cpp +++ b/src/xrGame/game_state_accumulator_state_register.cpp @@ -32,25 +32,26 @@ namespace award_system { + template struct AccumulatorHelper; template <> -struct AccumulatorHelper> { +struct AccumulatorHelper { static void init_acpv(game_state_accumulator*, game_state_accumulator::accumulative_values_collection_t&) { } }; -template -struct AccumulatorHelper> { +template +struct AccumulatorHelper> { static void init_acpv(game_state_accumulator* self, game_state_accumulator::accumulative_values_collection_t& accumulative_values) { - AccumulatorHelper>::init_acpv(self, accumulative_values); - player_state_param* tmp_obj_inst = new typename T::value_type(self); - accumulative_values.insert(std::make_pair(T::value_id, tmp_obj_inst)); + AccumulatorHelper::init_acpv(self, accumulative_values); + player_state_param* tmp_obj_inst = new typename Head::value_type(self); + accumulative_values.insert(std::make_pair(Head::value_id, tmp_obj_inst)); } }; diff --git a/src/xrGame/level_script.cpp b/src/xrGame/level_script.cpp index 14d70bafd23..f36d9d8abd2 100644 --- a/src/xrGame/level_script.cpp +++ b/src/xrGame/level_script.cpp @@ -781,9 +781,7 @@ IC static void CLevel_Export(lua_State* luaState) ]; module(luaState)[def("command_line", &command_line), -#ifndef LINUX // FIXME!!! - def("IsGameTypeSingle", &IsGameTypeSingle), -#endif + def("IsGameTypeSingle", (bool (*)())&IsGameTypeSingle), def("IsDynamicMusic", &IsDynamicMusic), def("render_get_dx_level", &render_get_dx_level), def("IsImportantSave", &IsImportantSave)]; diff --git a/src/xrGame/login_manager_script.cpp b/src/xrGame/login_manager_script.cpp index 38c11c31776..f634038b145 100644 --- a/src/xrGame/login_manager_script.cpp +++ b/src/xrGame/login_manager_script.cpp @@ -32,13 +32,13 @@ SCRIPT_EXPORT(profile, (), { luaState)[class_("profile").def("unique_nick", &profile::unique_nick).def("online", &profile::online)]; }); +#ifndef LINUX // FIXME!!! SCRIPT_EXPORT(login_operation_cb, (), { module(luaState)[class_("login_operation_cb") .def(constructor<>()) .def(constructor()) -#ifndef LINUX // FIXME!!! .def("bind", &gamespy_gp::login_operation_cb::bind) -#endif .def("clear", &gamespy_gp::login_operation_cb::clear)]; }); +#endif \ No newline at end of file diff --git a/src/xrGame/profile_data_types_script.cpp b/src/xrGame/profile_data_types_script.cpp index 72b00c1d889..3f14be70908 100644 --- a/src/xrGame/profile_data_types_script.cpp +++ b/src/xrGame/profile_data_types_script.cpp @@ -20,13 +20,13 @@ SCRIPT_EXPORT(profile_data_script_registrator, (), { .def_readonly("second", &all_best_scores_t::value_type::second)]; }); +#ifndef LINUX // FIXME!!! SCRIPT_EXPORT(store_operation_cb, (), { module(luaState)[class_("store_operation_cb") .def(constructor<>()) .def(constructor()) -#ifndef LINUX // FIXME!!! .def("bind", &gamespy_profile::store_operation_cb::bind) -#endif .def("clear", &gamespy_profile::store_operation_cb::clear)]; }); +#endif diff --git a/src/xrGame/ui/UIListBox_script.cpp b/src/xrGame/ui/UIListBox_script.cpp index e7f5ba1538c..118ffb96f7d 100644 --- a/src/xrGame/ui/UIListBox_script.cpp +++ b/src/xrGame/ui/UIListBox_script.cpp @@ -64,15 +64,15 @@ SCRIPT_EXPORT(SServerFilters, (), { .def_readwrite("listen_servers", &SServerFilters::listen_servers)]; }); +#ifndef LINUX // FIXME!!! SCRIPT_EXPORT(connect_error_cb, (), { module(luaState)[class_("connect_error_cb") .def(constructor<>()) .def(constructor()) -#ifndef LINUX // FIXME!!! .def("bind", &connect_error_cb::bind) -#endif .def("clear", &connect_error_cb::clear)]; }); +#endif SCRIPT_EXPORT(CServerList, (CUIWindow), { module(luaState)[class_("CServerList") diff --git a/src/xrGame/ui/UIWindow.h b/src/xrGame/ui/UIWindow.h index cc156aee3d1..1c7ee6add0e 100644 --- a/src/xrGame/ui/UIWindow.h +++ b/src/xrGame/ui/UIWindow.h @@ -81,7 +81,7 @@ class CUIWindow : public CUISimpleWindow void ShowChildren(bool show); //абсолютные координаты - IC void GetAbsoluteRect(Frect& r); + void GetAbsoluteRect(Frect& r); IC void GetAbsolutePos(Fvector2& p) { Frect abs; diff --git a/src/xrGame/xrGame.vcxproj b/src/xrGame/xrGame.vcxproj index c141fd8388a..2d7682b4180 100644 --- a/src/xrGame/xrGame.vcxproj +++ b/src/xrGame/xrGame.vcxproj @@ -856,6 +856,7 @@ + @@ -1642,7 +1643,14 @@ pch_script.h $(IntDir)$(ProjectName)_script.pch - + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + pch_script.h $(IntDir)$(ProjectName)_script.pch diff --git a/src/xrGame/xrGame.vcxproj.filters b/src/xrGame/xrGame.vcxproj.filters index 7e335f0c41c..870d092c18c 100644 --- a/src/xrGame/xrGame.vcxproj.filters +++ b/src/xrGame/xrGame.vcxproj.filters @@ -5682,6 +5682,9 @@ Core\Server\Games\client\mp\award_system\player_state + + Core\Server\Games\client\mp\award_system\player_state + Core\Server\Games\client\mp\award_system\player_state diff --git a/src/xrPhysics/xrPhysics.vcxproj b/src/xrPhysics/xrPhysics.vcxproj index e968aceb71c..2b7849c3b1f 100644 --- a/src/xrPhysics/xrPhysics.vcxproj +++ b/src/xrPhysics/xrPhysics.vcxproj @@ -138,7 +138,14 @@ - + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + diff --git a/src/xrServerEntities/script_flags_script.cpp b/src/xrServerEntities/script_flags_script.cpp index 48b5749646d..c38dee66496 100644 --- a/src/xrServerEntities/script_flags_script.cpp +++ b/src/xrServerEntities/script_flags_script.cpp @@ -53,17 +53,16 @@ void one(T* self) self->assign(typename T::TYPE(-1)); } +#ifndef LINUX // FIXME!!! SCRIPT_EXPORT(Flags8, (), { module(luaState) [ class_("flags8") .def(constructor<>()) -#ifndef LINUX // FIXME!!! .def("get", &Flags8::get) .def("zero", &Flags8::zero) .def("one", &one) -#endif .def("invert", (Flags8 & (Flags8::*)())(&Flags8::invert)) .def("invert", (Flags8 & (Flags8::*)(const Flags8&))(&Flags8::invert)) .def("invert", (Flags8 & (Flags8::*)(const Flags8::TYPE))(&Flags8::invert)) @@ -88,11 +87,9 @@ SCRIPT_EXPORT(Flags16, (), [ class_("flags16") .def(constructor<>()) -#ifndef LINUX // FIXME!!! .def("get", &Flags16::get) .def("zero", &Flags16::zero) .def("one", &one) -#endif .def("invert", (Flags16 & (Flags16::*)())(&Flags16::invert)) .def("invert", (Flags16 & (Flags16::*)(const Flags16&))(&Flags16::invert)) .def("invert", (Flags16 & (Flags16::*)(const Flags16::TYPE))(&Flags16::invert)) @@ -117,11 +114,9 @@ SCRIPT_EXPORT(Flags32, (), [ class_("flags32") .def(constructor<>()) -#ifndef LINUX // FIXME!!! .def("get", &Flags32::get) .def("zero", &Flags32::zero) .def("one", &Flags32::one) -#endif .def("invert", (Flags32 & (Flags32::*)())(&Flags32::invert)) .def("invert", (Flags32 & (Flags32::*)(const Flags32&))(&Flags32::invert)) .def("invert", (Flags32 & (Flags32::*)(const Flags32::TYPE))(&Flags32::invert)) @@ -139,3 +134,4 @@ SCRIPT_EXPORT(Flags32, (), .def("equal", (bool(*)(Flags32*, const Flags32&, const Flags32::TYPE))(&equal)) ]; }); +#endif diff --git a/src/xrServerEntities/smart_cast_impl0.h b/src/xrServerEntities/smart_cast_impl0.h index 95929c629d1..9d7e0dd8f7f 100644 --- a/src/xrServerEntities/smart_cast_impl0.h +++ b/src/xrServerEntities/smart_cast_impl0.h @@ -41,16 +41,16 @@ struct CTypeHelper }; template <> - struct add + struct add { - typedef Loki::Typelist>, List> result; + typedef Loki::Typelist>, List> result; }; typedef typename add::result result; }; }; -#define cast_type_list Loki::EmptyType +#define cast_type_list Loki::NullType #define add_to_cast_list(B, A) typedef SmartDynamicCast::CTypeHelper::result TypeList_##A##B #define save_cast_list(B, A) TypeList_##A##B diff --git a/src/xrServerEntities/smart_cast_impl1.h b/src/xrServerEntities/smart_cast_impl1.h index d49012282db..bac443b9457 100644 --- a/src/xrServerEntities/smart_cast_impl1.h +++ b/src/xrServerEntities/smart_cast_impl1.h @@ -59,7 +59,7 @@ struct exists }; template <> - struct iterator + struct iterator { enum { @@ -83,7 +83,7 @@ struct merge }; template <> - struct iterator + struct iterator { typedef List2 result; }; @@ -116,9 +116,9 @@ struct has_conversion }; template <> - struct search_base + struct search_base { - typedef Loki::EmptyType result; + typedef Loki::NullType result; }; template @@ -149,7 +149,7 @@ struct has_conversion }; template <> - struct search_conversion + struct search_conversion { enum { @@ -197,7 +197,7 @@ struct has_any_conversion }; template <> - struct iterator + struct iterator { enum { @@ -233,14 +233,14 @@ struct CMatcher template struct _selector { - typedef Loki::Typelist> result; + typedef Loki::Typelist> result; }; template <> struct _selector { typedef Loki::Typelist>> + Loki::Typelist>> result; }; @@ -258,7 +258,7 @@ struct CMatcher }; template <> - struct CMatchHelper3 + struct CMatchHelper3 { typedef typename CMatchHelper::result result; }; @@ -290,9 +290,9 @@ struct CMatcher }; template <> - struct CMatchHelper + struct CMatchHelper { - typedef Loki::EmptyType result; + typedef Loki::NullType result; }; typedef typename CMatchHelper::result result; @@ -326,7 +326,7 @@ struct conversion_sequence typedef search_result result; }; - typedef typename selector::value>::result result; + typedef typename selector::value>::result result; }; template @@ -346,7 +346,7 @@ struct conversion_sequence typedef typename list_iterator::result result; }; - typedef typename _selector::value>::result result; + typedef typename _selector::value>::result result; }; template <> @@ -369,7 +369,7 @@ struct conversion_sequence typedef typename list_iterator::result result; }; - typedef typename _selector2::value>::result result; + typedef typename _selector2::value>::result result; }; template <> @@ -386,9 +386,9 @@ struct conversion_sequence }; template <> - struct list_iterator + struct list_iterator { - typedef Loki::EmptyType result; + typedef Loki::NullType result; }; template @@ -410,7 +410,7 @@ struct conversion_sequence typedef typename list_iterator::result result; }; - typedef typename _selector::value>::result result; + typedef typename _selector::value>::result result; }; template <> @@ -422,7 +422,7 @@ struct conversion_sequence template <> struct selector<0> { - typedef Loki::EmptyType result; + typedef Loki::NullType result; }; typedef typename selector::result result; @@ -451,7 +451,7 @@ struct CSmartCaster }; template <> - struct CHelper + struct CHelper { IC static Target* smart_cast(Head* p) { return (SmartDynamicCast::smart_cast(p)); } }; @@ -474,7 +474,7 @@ struct CSmartMatcher } template <> - IC static T1* smart_cast(T2* p) + IC static T1* smart_cast(T2* p) { #ifdef SHOW_SMART_CAST_UNOPTIMIZED_CASES #pragma todo("Dima to all : this smart_cast is not optimized!")