38 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
39 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
62 template <
typename Po
inter>
66 typedef typename Pointer::element_type
type;
75 template <
typename Po
inter>
76 inline const typename Pointer::element_type*
GetRawPointer(
const Pointer&
p) {
80 template <
typename Element>
87 const ::testing::internal::linked_ptr<T>&
rhs)
const {
88 return lhs.get() < rhs.get();
100 #if (GTEST_OS_SYMBIAN && defined(_STLP_NO_WCHAR_T)) || \
101 (defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED))
104 # define GMOCK_WCHAR_T_IS_NATIVE_ 1
118 # define GMOCK_HAS_SIGNED_WCHAR_T_ 1
136 #define GMOCK_DECLARE_KIND_(type, kind) \
137 template <> struct KindOf<type> { enum { value = kind }; }
152 #if GMOCK_WCHAR_T_IS_NATIVE_
165 #undef GMOCK_DECLARE_KIND_
168 #define GMOCK_KIND_OF_(type) \
169 static_cast< ::testing::internal::TypeKind>( \
170 ::testing::internal::KindOf<type>::value)
173 #define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0)
184 template <TypeKind kFromKind,
typename From, TypeKind kToKind,
typename To>
193 template <
typename To>
198 template <
typename To>
203 template <
typename From>
209 template <
typename From,
typename To>
214 ((sizeof(From) < sizeof(To)) &&
215 (!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) ||
217 ((sizeof(From) == sizeof(To)) &&
218 (GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {};
220 #undef GMOCK_IS_SIGNED_
224 template <typename From, typename To>
225 struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To>
226 : public false_type {};
229 template <typename From>
230 struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool>
231 : public false_type {};
234 template <typename From, typename To>
235 struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To>
236 : public false_type {};
240 template <typename From, typename To>
241 struct LosslessArithmeticConvertibleImpl<
242 kFloatingPoint, From, kFloatingPoint, To>
243 : public bool_constant<sizeof(From) <= sizeof(To)> {};
252 template <typename From, typename To>
253 struct LosslessArithmeticConvertible
254 : public LosslessArithmeticConvertibleImpl<
255 GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {};
259 class FailureReporterInterface {
266 virtual ~FailureReporterInterface() {}
269 virtual void ReportFailure(FailureType type, const char* file, int line,
270 const string& message) = 0;
274 GTEST_API_ FailureReporterInterface* GetFailureReporter();
281 inline void Assert(bool condition, const char* file, int line,
284 GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
288 inline void Assert(bool condition, const char* file, int line) {
289 Assert(condition, file, line, "Assertion failed.");
294 inline void Expect(bool condition, const char* file, int line,
297 GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal,
301 inline void
Expect(bool condition, const char* file, int line) {
333 int stack_frames_to_skip);
367 # pragma warning(push)
368 # pragma warning(disable:4717)
376 template <
typename T>
378 Assert(
false,
"", -1,
"Internal error: attempt to return invalid value");
386 # pragma warning(pop)
405 template <
class RawContainer>
421 template <
typename Element,
size_t N>
435 testing::StaticAssertTypeEq<Element, RawElement>();
450 return type(const_cast<Element*>(&
array[0]), N,
454 #endif // GTEST_OS_SYMBIAN
461 #endif // GTEST_OS_SYMBIAN
467 template <
typename ElementPo
inter,
typename Size>
476 const ::testing::tuple<ElementPointer, Size>&
array) {
486 template <
typename T>
class StlContainerView<
T&>;
491 template <
typename T>
497 template <
typename K,
typename V>
504 template <
bool kValue>
510 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_