equal
deleted
inserted
replaced
103 }; |
103 }; |
104 |
104 |
105 template<class From, class To> |
105 template<class From, class To> |
106 struct StaticCastSelectorClass<From, To, sizeof(int)> |
106 struct StaticCastSelectorClass<From, To, sizeof(int)> |
107 { |
107 { |
108 static inline int cast() { return (int)((intptr_t)static_cast<To *>((From *)0x10000000)) - 0x10000000; } |
108 static inline int cast() { return int(reinterpret_cast<intptr_t>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } |
109 }; |
109 }; |
110 |
110 |
111 template<class From, class To> |
111 template<class From, class To> |
112 struct StaticCastSelector |
112 struct StaticCastSelector |
113 { |
113 { |
117 static yes_type check(To *); |
117 static yes_type check(To *); |
118 static no_type check(...); |
118 static no_type check(...); |
119 |
119 |
120 static inline int cast() |
120 static inline int cast() |
121 { |
121 { |
122 return StaticCastSelectorClass<From, To, sizeof(check((From *)0))>::cast(); |
122 return StaticCastSelectorClass<From, To, sizeof(check(reinterpret_cast<From *>(0)))>::cast(); |
123 } |
123 } |
124 }; |
124 }; |
125 |
125 |
126 template <typename T> |
126 template <typename T> |
127 struct has_attachedPropertiesMember |
127 struct has_attachedPropertiesMember |
130 }; |
130 }; |
131 |
131 |
132 template <typename T, bool hasMember> |
132 template <typename T, bool hasMember> |
133 class has_attachedPropertiesMethod |
133 class has_attachedPropertiesMethod |
134 { |
134 { |
|
135 public: |
135 typedef int yes_type; |
136 typedef int yes_type; |
136 typedef char no_type; |
137 typedef char no_type; |
137 |
138 |
138 template<typename ReturnType> |
139 template<typename ReturnType> |
139 static yes_type check(ReturnType *(*)(QObject *)); |
140 static yes_type check(ReturnType *(*)(QObject *)); |
140 static no_type check(...); |
141 static no_type check(...); |
141 |
142 |
142 public: |
|
143 static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); |
143 static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); |
144 }; |
144 }; |
145 |
145 |
146 template <typename T> |
146 template <typename T> |
147 class has_attachedPropertiesMethod<T, false> |
147 class has_attachedPropertiesMethod<T, false> |