39#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
40#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
50#include "gtest/gtest.h"
63#pragma warning(disable : 4100)
64#pragma warning(disable : 4805)
70 const std::vector<const char*>& names,
const Strings& values);
81template <
typename Po
inter>
82inline const typename Pointer::element_type*
GetRawPointer(
const Pointer& p) {
82inline const typename Pointer::element_type*
GetRawPointer(
const Pointer& p) {
…}
87template <
typename Element>
88inline const Element*
GetRawPointer(
const std::reference_wrapper<Element>& r) {
88inline const Element*
GetRawPointer(
const std::reference_wrapper<Element>& r) {
…}
93template <
typename Element>
102#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
105#define GMOCK_WCHAR_T_IS_NATIVE_ 1
122#define GMOCK_DECLARE_KIND_(type, kind) \
124 struct KindOf<type> { \
125 enum { value = kind }; \
122#define GMOCK_DECLARE_KIND_(type, kind) \ …
143#if GMOCK_WCHAR_T_IS_NATIVE_
152#undef GMOCK_DECLARE_KIND_
155#define GMOCK_KIND_OF_(type) \
156 static_cast< ::testing::internal::TypeKind>( \
157 ::testing::internal::KindOf<type>::value)
155#define GMOCK_KIND_OF_(type) \ …
168template <TypeKind kFromKind,
typename From, TypeKind kToKind,
typename To>
173 (kFromKind ==
kBool) ?
true
176 : (kFromKind != kToKind) ? false
180 (((sizeof(From) < sizeof(To)) &&
181 !(std::is_signed<From>::value && !std::is_signed<To>::value)) ||
184 ((sizeof(From) == sizeof(To)) &&
185 (std::is_signed<From>::value == std::is_signed<To>::value)))
189 : (kFromKind ==
kFloatingPoint && (sizeof(From) <= sizeof(To))) ? true
201template <
typename From,
typename To>
217 const std::string& message) = 0;
228inline void Assert(
bool condition,
const char* file,
int line,
229 const std::string& msg) {
228inline void Assert(
bool condition,
const char* file,
int line, {
…}
235inline void Assert(
bool condition,
const char* file,
int line) {
236 Assert(condition, file, line,
"Assertion failed.");
235inline void Assert(
bool condition,
const char* file,
int line) {
…}
241inline void Expect(
bool condition,
const char* file,
int line,
242 const std::string& msg) {
241inline void Expect(
bool condition,
const char* file,
int line, {
…}
248inline void Expect(
bool condition,
const char* file,
int line) {
249 Expect(condition, file, line,
"Expectation failed.");
248inline void Expect(
bool condition,
const char* file,
int line) {
…}
275GTEST_API_
void Log(
LogSeverity severity,
const std::string& message,
276 int stack_frames_to_skip);
297#pragma warning(disable : 4717)
307 Assert(
false,
"", -1,
"Internal error: attempt to return invalid value");
308#if defined(__GNUC__) || defined(__clang__)
309 __builtin_unreachable();
310#elif defined(_MSC_VER)
337template <
class RawContainer>
344 static_assert(!std::is_const<RawContainer>::value,
345 "RawContainer type must not be const");
348 static type Copy(
const RawContainer& container) {
return container; }
352template <
typename Element,
size_t N>
355 typedef typename std::remove_const<Element>::type
RawElement;
356 typedef internal::NativeArray<RawElement>
type;
365 static_assert(std::is_same<Element, RawElement>::value,
366 "Element type must not be const");
367 return type(array, N, RelationToSourceReference());
370 return type(array, N, RelationToSourceCopy());
376template <
typename ElementPo
inter,
typename Size>
379 typedef typename std::remove_const<
380 typename std::pointer_traits<ElementPointer>::element_type>
::type
382 typedef internal::NativeArray<RawElement>
type;
386 const ::std::tuple<ElementPointer, Size>& array) {
387 return type(std::get<0>(array), std::get<1>(array),
388 RelationToSourceReference());
390 static type Copy(const ::std::tuple<ElementPointer, Size>& array) {
391 return type(std::get<0>(array), std::get<1>(array), RelationToSourceCopy());
390 static type Copy(const ::std::tuple<ElementPointer, Size>& array) {
…}
398class StlContainerView<T&>;
409template <
typename K,
typename V>
418template <
typename F,
typename Tuple,
size_t... Idx>
419auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>)
420 ->
decltype(std::forward<F>(f)(
421 std::get<Idx>(std::forward<Tuple>(args))...)) {
422 return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...);
419auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>) {
…}
426template <
typename F,
typename Tuple>
428 std::forward<F>(f), std::forward<Tuple>(args),
429 MakeIndexSequence<std::tuple_size<
430 typename std::remove_reference<Tuple>::type>::value>())) {
431 return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
432 MakeIndexSequence<std::tuple_size<
433 typename std::remove_reference<Tuple>::type>::value>());
452template <
typename R,
typename... Args>
455 static constexpr size_t ArgumentCount =
sizeof...(Args);
457 using Arg = ElemFromList<I, Args...>;
464template <
typename R,
typename... Args>
465constexpr size_t Function<R(Args...)>::ArgumentCount;
467bool Base64Unescape(
const std::string& encoded, std::string* decoded);
virtual void ReportFailure(FailureType type, const char *file, int line, const std::string &message)=0
virtual ~FailureReporterInterface()
const type const_reference
std::remove_const< typenamestd::pointer_traits< ElementPointer >::element_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)
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])
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_ bool LogIsVisible(LogSeverity severity)
auto ApplyImpl(F &&f, Tuple &&args, IndexSequence< Idx... >) -> decltype(std::forward< F >(f)(std::get< Idx >(std::forward< Tuple >(args))...))
bool Base64Unescape(const std::string &encoded, std::string *decoded)
GTEST_API_ void Log(LogSeverity severity, const std::string &message, int stack_frames_to_skip)
GTEST_API_ FailureReporterInterface * GetFailureReporter()
const char kInfoVerbosity[]
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
void Assert(bool condition, const char *file, int line, const std::string &msg)
GTEST_API_ void IllegalDoDefault(const char *file, int line)
GTEST_API_ std::string JoinAsKeyValueTuple(const std::vector< const char * > &names, const Strings &values)
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[]
LosslessArithmeticConvertibleImpl< GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To > LosslessArithmeticConvertible
IgnoredValue(Args...) MakeResultIgnoredValue
void(Args...) MakeResultVoid
std::tuple< Matcher< Args >... > ArgumentMatcherTuple
ElemFromList< I, Args... > Arg
std::tuple< Args... > ArgumentTuple