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 typename Pointer::element_type*
GetRawPointer(
const Pointer& p) {
80 template <
typename Element>
86 bool operator()(const ::testing::internal::linked_ptr<T>& lhs,
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 132 enum { value = kOther };
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 FailureReporterInterface* GetFailureReporter();
281 inline void Assert(bool condition, const char* file, int line,
284 GetFailureReporter()->ReportFailure(FailureReporterInterface::FATAL,
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::NONFATAL,
301 inline
void Expect(bool condition, const char* file, int line) {
302 Expect(condition, file, line,
"Expectation failed.");
353 template <
typename T>
376 template <
class RawContainer>
388 static type
Copy(
const RawContainer& container) {
return container; }
392 template <
typename Element,
size_t N>
406 testing::StaticAssertTypeEq<Element, RawElement>();
424 #endif // GTEST_OS_SYMBIAN 426 static type
Copy(
const Element (&array)[
N]) {
428 return type(const_cast<Element*>(&array[0]), N,
kCopy);
431 #endif // GTEST_OS_SYMBIAN 437 template <
typename ElementPo
inter,
typename Size>
446 const ::std::tr1::tuple<ElementPointer, Size>& array) {
447 using ::std::tr1::get;
450 static type
Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) {
451 using ::std::tr1::get;
452 return type(get<0>(array), get<1>(array),
kCopy);
463 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ Definition: gmock-actions.h:49
internal::NativeArray< RawElement > type
Definition: gmock-internal-utils.h:396
bool operator()(const ::testing::internal::linked_ptr< T > &lhs, const ::testing::internal::linked_ptr< T > &rhs) const
Definition: gmock-internal-utils.h:86
Definition: gmock-internal-utils.h:127
Definition: gmock-internal-utils.h:377
Definition: gmock-internal-utils.h:185
Definition: InputPrereqs.h:107
Definition: gtest-tuple.h:109
Definition: gmock-internal-utils.h:131
Definition: gtest-internal.h:1032
Output level, used for messages directed to the user (e.g. "Press any key to continue") ...
Definition: OutputDefinitions.h:89
const char kInfoVerbosity[]
Definition: gmock-internal-utils.h:314
const char kWarningVerbosity[]
Definition: gmock-internal-utils.h:316
void Log(LogSeverity severity, const string &message, int stack_frames_to_skip)
Definition: gmock-internal-utils.cc:131
typedef void(ENET_CALLBACK *ENetPacketFreeCallback)(struct _ENetPacket *)
TypeKind
Definition: gmock-internal-utils.h:126
GMOCK_DECLARE_KIND_(bool, kBool)
Definition: gmock-internal-utils.h:346
Definition: gmock-internal-utils.h:127
static type Copy(const RawContainer &container)
Definition: gmock-internal-utils.h:388
void Invalid< void >()
Definition: gmock-internal-utils.h:358
Definition: gmock-internal-utils.h:308
Definition: gmock-internal-utils.h:127
const type & const_reference
Definition: gmock-internal-utils.h:380
Pointer::element_type type
Definition: gmock-internal-utils.h:66
void Expect(bool condition, const char *file, int line, const string &msg)
Definition: gmock-internal-utils.h:294
T type
Definition: gmock-internal-utils.h:346
internal::NativeArray< RawElement > type
Definition: gmock-internal-utils.h:442
const type const_reference
Definition: gmock-internal-utils.h:402
Pointer::element_type * GetRawPointer(const Pointer &p)
Definition: gmock-internal-utils.h:76
Definition: gmock-internal-utils.h:307
static type Copy(const Element(&array)[N])
Definition: gmock-internal-utils.h:426
bool LogIsVisible(LogSeverity severity)
Definition: gmock-internal-utils.cc:110
static const_reference ConstReference(const ::std::tr1::tuple< ElementPointer, Size > &array)
Definition: gmock-internal-utils.h:445
Definition: gmock-internal-utils.h:338
Definition: InputPrereqs.h:78
Definition: gtest-port.h:1463
LogSeverity
Definition: gmock-internal-utils.h:306
Definition: gmock-internal-utils.h:63
T type
Definition: gmock-internal-utils.h:347
static const_reference ConstReference(const RawContainer &container)
Definition: gmock-internal-utils.h:382
const type const_reference
Definition: gmock-internal-utils.h:443
static const_reference ConstReference(const Element(&array)[N])
Definition: gmock-internal-utils.h:404
TypeWithSize< 8 >::UInt UInt64
Definition: gtest-port.h:1735
bool StaticAssertTypeEq()
Definition: gtest.h:2074
static type Copy(const ::std::tr1::tuple< ElementPointer, Size > &array)
Definition: gmock-internal-utils.h:450
T Invalid()
Definition: gmock-internal-utils.h:354
Definition: gtest-internal.h:1019
#define GTEST_REMOVE_CONST_(T)
Definition: gtest-internal.h:811
Definition: gtest-internal.h:1018
TypeWithSize< 8 >::Int Int64
Definition: gtest-port.h:1734
Definition: gmock-internal-utils.h:342
const char kErrorVerbosity[]
Definition: gmock-internal-utils.h:318
T type
Definition: gmock-internal-utils.h:70
Definition: gmock-internal-utils.h:85
string ConvertIdentifierNameToWords(const char *id_name)
Definition: gmock-internal-utils.cc:54
Definition: gmock-internal-utils.h:127
RawContainer type
Definition: gmock-internal-utils.h:379