39#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
40#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
60# pragma warning(disable:4100)
61# pragma warning(disable:4805)
78template <
typename Po
inter>
82 typedef typename Pointer::element_type
type;
91template <
typename Po
inter>
92inline const typename Pointer::element_type*
GetRawPointer(
const Pointer&
p) {
96template <
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)
167template <TypeKind kFromKind,
typename From, TypeKind kToKind,
typename To>
172 (kFromKind ==
kBool) ?
true
175 : (kFromKind != kToKind) ?
false
179 (((
sizeof(From) <
sizeof(
To)) &&
180 !(std::is_signed<From>::value && !std::is_signed<To>::value)) ||
183 ((
sizeof(From) ==
sizeof(
To)) &&
184 (std::is_signed<From>::value == std::is_signed<To>::value)))
200template <
typename From,
typename To>
218 const std::string& message) = 0;
229inline void Assert(
bool condition,
const char* file,
int line,
230 const std::string& msg) {
236inline void Assert(
bool condition,
const char* file,
int line) {
237 Assert(condition, file, line,
"Assertion failed.");
242inline void Expect(
bool condition,
const char* file,
int line,
243 const std::string& msg) {
249inline 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)
311 Assert(
false,
"", -1,
"Internal error: attempt to return invalid value");
338template <
class RawContainer>
345 static_assert(!std::is_const<RawContainer>::value,
346 "RawContainer type must not be const");
353template <
typename Element,
size_t N>
356 typedef typename std::remove_const<Element>::type
RawElement;
366 static_assert(std::is_same<Element, RawElement>::value,
367 "Element type must not be const");
377template <
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) {
397template <
typename T>
class StlContainerView<
T&>;
408template <
typename K,
typename V>
417template <
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))...);
424template <
typename F,
typename Tuple>
425auto 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>());
450template <
typename R,
typename... Args>
453 static constexpr size_t ArgumentCount =
sizeof...(Args);
462template <
typename R,
typename... Args>
463constexpr size_t Function<
R(Args...)>::ArgumentCount;
virtual void ReportFailure(FailureType type, const char *file, int line, const std::string &message)=0
virtual ~FailureReporterInterface()
internal::NativeArray< RawElement > type
const type const_reference
std::remove_const< Element >::type RawElement
static const_reference ConstReference(const Element(&array)[N])
static type Copy(const Element(&array)[N])
const type const_reference
std::remove_const< typenameinternal::PointeeOf< ElementPointer >::type >::type RawElement
internal::NativeArray< RawElement > type
static type Copy(const ::std::tuple< ElementPointer, Size > &array)
static const_reference ConstReference(const ::std::tuple< ElementPointer, Size > &array)
static const_reference ConstReference(const RawContainer &container)
static type Copy(const RawContainer &container)
const type & const_reference
friend GTEST_API_ WithoutMatchers GetWithoutMatchers()
#define GMOCK_KIND_OF_(type)
#define GMOCK_DECLARE_KIND_(type, kind)
GTEST_API_ std::string ConvertIdentifierNameToWords(const char *id_name)
const char kErrorVerbosity[]
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 >()))
GTEST_API_ std::string JoinAsTuple(const Strings &fields)
::std::vector< ::std::string > Strings
GTEST_API_ bool LogIsVisible(LogSeverity severity)
auto ApplyImpl(F &&f, Tuple &&args, IndexSequence< Idx... >) -> decltype(std::forward< F >(f)(std::get< Idx >(std::forward< Tuple >(args))...))
GTEST_API_ void Log(LogSeverity severity, const std::string &message, int stack_frames_to_skip)
GTEST_API_ FailureReporterInterface * GetFailureReporter()
const char kInfoVerbosity[]
void Assert(bool condition, const char *file, int line, const std::string &msg)
GTEST_API_ void IllegalDoDefault(const char *file, int line)
LosslessArithmeticConvertibleImpl< GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To > LosslessArithmeticConvertible
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
GTEST_API_ WithoutMatchers GetWithoutMatchers()
const Pointer::element_type * GetRawPointer(const Pointer &p)
void Expect(bool condition, const char *file, int line, const std::string &msg)
const char kWarningVerbosity[]
IgnoredValue(Args...) MakeResultIgnoredValue
void(Args...) MakeResultVoid
std::tuple< Matcher< Args >... > ArgumentMatcherTuple
std::tuple< Args... > ArgumentTuple
Pointer::element_type type