39 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
40 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
45 #include <type_traits>
59 # pragma warning(push)
60 # pragma warning(disable:4100)
61 # pragma warning(disable:4805)
78 template <
typename Po
inter>
82 typedef typename Pointer::element_type
type;
91 template <
typename Po
inter>
92 inline const typename Pointer::element_type*
GetRawPointer(
const Pointer&
p) {
96 template <
typename Element>
103 #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
106 # define GMOCK_WCHAR_T_IS_NATIVE_ 1
124 #define GMOCK_DECLARE_KIND_(type, kind) \
125 template <> struct KindOf<type> { enum { value = kind }; }
142 #if GMOCK_WCHAR_T_IS_NATIVE_
151 #undef GMOCK_DECLARE_KIND_
154 #define GMOCK_KIND_OF_(type) \
155 static_cast< ::testing::internal::TypeKind>( \
156 ::testing::internal::KindOf<type>::value)
167 template <TypeKind kFromKind,
typename From, TypeKind kToKind,
typename To>
172 (kFromKind ==
kBool) ?
true
175 : (kFromKind != kToKind) ?
false
179 (((
sizeof(From) <
sizeof(To)) &&
183 ((
sizeof(From) ==
sizeof(To)) &&
188 : (kFromKind ==
kFloatingPoint && (
sizeof(From) <=
sizeof(To))) ?
true
200 template <
typename From,
typename To>
218 const std::string& message) = 0;
229 inline void Assert(
bool condition,
const char* file,
int line,
230 const std::string& msg) {
236 inline void Assert(
bool condition,
const char* file,
int line) {
237 Assert(condition, file, line,
"Assertion failed.");
242 inline void Expect(
bool condition,
const char* file,
int line,
243 const std::string& msg) {
249 inline void Expect(
bool condition,
const char* file,
int line) {
250 Expect(condition, file, line,
"Expectation failed.");
280 int stack_frames_to_skip);
300 # pragma warning(push)
301 # pragma warning(disable:4717)
309 template <
typename T>
311 Assert(
false,
"", -1,
"Internal error: attempt to return invalid value");
319 # pragma warning(pop)
338 template <
class RawContainer>
346 "RawContainer type must not be const");
353 template <
typename Element,
size_t N>
356 typedef typename std::remove_const<Element>::type
RawElement;
367 "Element type must not be const");
377 template <
typename ElementPo
inter,
typename Size>
380 typedef typename std::remove_const<
386 const ::std::tuple<ElementPointer, Size>& array) {
387 return type(std::get<0>(array), std::get<1>(array),
390 static type Copy(const ::std::tuple<ElementPointer, Size>& array) {
397 template <
typename T>
class StlContainerView<
T&>;
402 template <
typename T>
408 template <
typename K,
typename V>
417 template <
typename F,
typename Tuple,
size_t... Idx>
419 std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...)) {
420 return std::forward<F>(
f)(std::get<Idx>(std::forward<Tuple>(args))...);
424 template <
typename F,
typename Tuple>
425 auto Apply(
F&& f, Tuple&& args) -> decltype(
426 ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
428 typename std::remove_reference<Tuple>::type>::
value>())) {
429 return ApplyImpl(std::forward<F>(
f), std::forward<Tuple>(args),
431 typename std::remove_reference<Tuple>::type>::
value>());
447 template <
typename T>
450 template <
typename R,
typename... Args>
453 static constexpr
size_t ArgumentCount =
sizeof...(Args);
462 template <
typename R,
typename... Args>
463 constexpr
size_t Function<
R(Args...)>::ArgumentCount;
466 # pragma warning(pop)
472 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
Sacado::Fad::DFad< double > F
#define GMOCK_KIND_OF_(type)
friend GTEST_API_ WithoutMatchers GetWithoutMatchers()
virtual ~FailureReporterInterface()
GTEST_API_ void IllegalDoDefault(const char *file, int line)
auto ApplyImpl(F &&f, Tuple &&args, IndexSequence< Idx...>) -> decltype(std::forward< F >(f)(std::get< Idx >(std::forward< Tuple >(args))...))
auto Apply(F &&f, Tuple &&args) -> decltype(ApplyImpl(std::forward< F >(f), std::forward< Tuple >(args), MakeIndexSequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
std::remove_const< typename internal::PointeeOf< ElementPointer >::type >::type RawElement
internal::NativeArray< RawElement > type
static const_reference ConstReference(const RawContainer &container)
GTEST_API_ FailureReporterInterface * GetFailureReporter()
const type const_reference
internal::NativeArray< RawElement > type
::std::vector< ::std::string > Strings
std::integral_constant< bool,(kFromKind==kBool)?true:(kFromKind!=kToKind)?false:(kFromKind==kInteger &&(((sizeof(From)< sizeof(To))&&!(std::is_signed< From >::value &&!std::is_signed< To >::value))||((sizeof(From)==sizeof(To))&&(std::is_signed< From >::value==std::is_signed< To >::value))))?true:(kFromKind==kFloatingPoint &&(sizeof(From)<=sizeof(To)))?true:false > LosslessArithmeticConvertibleImpl
std::tuple< Args...> ArgumentTuple
static type Copy(const ::std::tuple< ElementPointer, Size > &array)
static const_reference ConstReference(const Element(&array)[N])
const char kInfoVerbosity[]
const char kWarningVerbosity[]
Sacado::Rad::ADvar< double > R
GTEST_API_ std::string ConvertIdentifierNameToWords(const char *id_name)
GMOCK_DECLARE_KIND_(bool, kBool)
const type const_reference
void(Args...) MakeResultVoid
GTEST_API_ std::string JoinAsTuple(const Strings &fields)
virtual void ReportFailure(FailureType type, const char *file, int line, const std::string &message)=0
std::remove_const< Element >::type RawElement
const type & const_reference
GTEST_API_ bool LogIsVisible(LogSeverity severity)
Pointer::element_type type
LosslessArithmeticConvertibleImpl< GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To > LosslessArithmeticConvertible
static type Copy(const RawContainer &container)
static const_reference ConstReference(const ::std::tuple< ElementPointer, Size > &array)
void Assert(bool condition, const char *file, int line, const std::string &msg)
IgnoredValue(Args...) MakeResultIgnoredValue
static type Copy(const Element(&array)[N])
std::tuple< Matcher< Args >...> ArgumentMatcherTuple
const char kErrorVerbosity[]
const Pointer::element_type * GetRawPointer(const Pointer &p)
void Expect(bool condition, const char *file, int line, const std::string &msg)
GTEST_API_ WithoutMatchers GetWithoutMatchers()
GTEST_API_ void Log(LogSeverity severity, const std::string &message, int stack_frames_to_skip)