38 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ 39 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ 45 #include "gmock/internal/gmock-generated-internal-utils.h" 46 #include "gmock/internal/gmock-port.h" 47 #include "gtest/gtest.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>
85 struct LinkedPtrLessThan {
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 131 template <
typename T>
struct KindOf {
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>
185 struct LosslessArithmeticConvertibleImpl :
public false_type {};
189 struct LosslessArithmeticConvertibleImpl<
kBool, bool,
kBool, bool>
193 template <
typename To>
194 struct LosslessArithmeticConvertibleImpl<
kBool, bool,
kInteger, To>
198 template <
typename To>
203 template <
typename From>
204 struct LosslessArithmeticConvertibleImpl<
kInteger, From,
kBool, bool>
209 template <
typename From,
typename To>
211 :
public bool_constant<
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) {
302 Expect(condition, file, line,
"Expectation failed.");
332 const string& message,
333 int stack_frames_to_skip);
340 template <
typename T>
struct is_reference :
public false_type {};
341 template <
typename T>
struct is_reference<T&> :
public true_type {};
344 template <
typename T1,
typename T2>
struct type_equals :
public false_type {};
345 template <
typename T>
struct type_equals<T, T> :
public true_type {};
354 template <
typename T,
size_t N>
struct DecayArray<T[N]> {
360 template <
typename T>
struct DecayArray<T[]> {
368 template <
typename T>
392 template <
class RawContainer>
393 class StlContainerView {
404 static type Copy(
const RawContainer& container) {
return container; }
408 template <
typename Element,
size_t N>
409 class StlContainerView<Element[N]> {
422 testing::StaticAssertTypeEq<Element, RawElement>();
440 #endif // GTEST_OS_SYMBIAN 444 return type(const_cast<Element*>(&array[0]), N,
kCopy);
447 #endif // GTEST_OS_SYMBIAN 453 template <
typename ElementPo
inter,
typename Size>
462 const ::std::tr1::tuple<ElementPointer, Size>& array) {
463 using ::std::tr1::get;
466 static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) {
467 using ::std::tr1::get;
468 return type(get<0>(array), get<1>(array),
kCopy);
474 template <
typename T>
class StlContainerView<T&>;
479 template <
typename T>
480 struct RemoveConstFromKey {
485 template <
typename K,
typename V>
492 template <
bool kValue>
498 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ Definition: dsd/test/gtest/include/gtest/internal/gtest-internal.h:950
TypeWithSize< 8 >::Int Int64
Definition: dsd/test/gtest/include/gtest/internal/gtest-port.h:1902
Definition: dsd/test/gmock/include/gmock/gmock-actions.h:49
internal::NativeArray< RawElement > type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:458
Definition: dsd/test/gtest/include/gtest/internal/gtest-internal.h:964
GTEST_API_ string ConvertIdentifierNameToWords(const char *id_name)
static const_reference ConstReference(const ::std::tr1::tuple< ElementPointer, Size > &array)
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:461
static type Copy(const ::std::tr1::tuple< ElementPointer, Size > &array)
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:466
const char kErrorVerbosity[]
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:318
static const_reference ConstReference(const RawContainer &container)
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:398
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:353
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:480
T type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:353
T type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:70
#define GTEST_API_
Definition: dsd/test/gtest/include/gtest/internal/gtest-port.h:768
internal::NativeArray< RawElement > type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:412
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:63
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:493
Definition: dsd/test/gtest/include/gtest/internal/gtest-tuple.h:111
TypeWithSize< 8 >::UInt UInt64
Definition: dsd/test/gtest/include/gtest/internal/gtest-port.h:1903
static const_reference ConstReference(const Element(&array)[N])
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:420
const char kInfoVerbosity[]
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:314
bool_constant< true > true_type
Definition: dsd/test/gtest/include/gtest/internal/gtest-port.h:1618
TypeKind
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:126
GMOCK_DECLARE_KIND_(bool, kBool)
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:348
bool operator()(const ::testing::internal::linked_ptr< T > &lhs, const ::testing::internal::linked_ptr< T > &rhs) const
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:86
void Invalid< void >()
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:374
const type const_reference
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:418
const T * type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:361
void Expect(bool condition, const char *file, int line, const string &msg)
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:294
const char kWarningVerbosity[]
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:316
T type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:348
const type const_reference
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:459
GTEST_API_ void Log(LogSeverity severity, const string &message, int stack_frames_to_skip)
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:132
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:308
#define GTEST_REMOVE_CONST_(T)
Definition: dsd/test/gtest/include/gtest/internal/gtest-internal.h:743
T type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:349
LogSeverity
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:306
const type & const_reference
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:396
GTEST_API_ bool LogIsVisible(LogSeverity severity)
Pointer::element_type type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:66
RawContainer type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:395
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:127
static type Copy(const RawContainer &container)
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:404
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:307
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:127
const T * type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:355
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:127
const Pointer::element_type * GetRawPointer(const Pointer &p)
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:76
bool_constant< false > false_type
Definition: dsd/test/gtest/include/gtest/internal/gtest-port.h:1617
std::pair< K, V > type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:487
bool StaticAssertTypeEq()
Definition: dsd/test/gtest/include/gtest/gtest.h:2205
T Invalid()
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:369
static type Copy(const Element(&array)[N])
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:442
Definition: dsd/test/gtest/include/gtest/internal/gtest-internal.h:951
Definition: dsd/test/gmock/include/gmock/internal/gmock-internal-utils.h:127
T type
Definition: mbelib/test/gmock/include/gmock/internal/gmock-internal-utils.h:481