Go to the documentation of this file.
39 #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
40 #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
46 #include <type_traits>
49 #include "gmock/internal/gmock-port.h"
50 #include "gtest/gtest.h"
62 # pragma warning(push)
63 # pragma warning(disable:4100)
64 # pragma warning(disable:4805)
81 template <
typename Po
inter>
87 template <
typename Element>
88 inline const Element*
GetRawPointer(
const std::reference_wrapper<Element>&
r) {
93 template <
typename Element>
100 #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
103 # define GMOCK_WCHAR_T_IS_NATIVE_ 1
116 template <
typename T>
struct KindOf {
121 #define GMOCK_DECLARE_KIND_(type, kind) \
122 template <> struct KindOf<type> { enum { value = kind }; }
139 #if GMOCK_WCHAR_T_IS_NATIVE_
148 #undef GMOCK_DECLARE_KIND_
151 #define GMOCK_KIND_OF_(type) \
152 static_cast< ::testing::internal::TypeKind>( \
153 ::testing::internal::KindOf<type>::value)
164 template <TypeKind kFromKind,
typename From, TypeKind kToKind,
typename To>
169 (kFromKind ==
kBool) ?
true
172 : (kFromKind != kToKind) ?
false
176 (((
sizeof(From) <
sizeof(To)) &&
180 ((
sizeof(From) ==
sizeof(To)) &&
197 template <
typename From,
typename To>
277 int stack_frames_to_skip);
285 class WithoutMatchers {
297 # pragma warning(push)
298 # pragma warning(disable:4717)
306 template <
typename T>
308 Assert(
false,
"", -1,
"Internal error: attempt to return invalid value");
316 # pragma warning(pop)
335 template <
class RawContainer>
336 class StlContainerView {
343 "RawContainer type must not be const");
350 template <
typename Element,
size_t N>
351 class StlContainerView<Element[
N]> {
364 "Element type must not be const");
374 template <
typename ElementPo
inter,
typename Size>
375 class StlContainerView< ::std::tuple<ElementPointer, Size> > {
377 typedef typename std::remove_const<
378 typename std::pointer_traits<ElementPointer>::element_type>
::type
384 const ::std::tuple<ElementPointer, Size>&
array) {
395 template <
typename T>
class StlContainerView<
T&>;
400 template <
typename T>
401 struct RemoveConstFromKey {
406 template <
typename K,
typename V>
415 template <
typename F,
typename Tuple,
size_t... Idx>
417 std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(
args))...)) {
418 return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(
args))...);
422 template <
typename F,
typename Tuple>
423 auto Apply(F&& f, Tuple&&
args) -> decltype(
427 return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(
args),
445 template <
typename T>
448 template <
typename R,
typename...
Args>
451 static constexpr
size_t ArgumentCount =
sizeof...(Args);
460 template <
typename R,
typename...
Args>
466 # pragma warning(pop)
472 #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
GTEST_API_ void IllegalDoDefault(const char *file, int line)
virtual void ReportFailure(FailureType type, const char *file, int line, const std::string &message)=0
GTEST_API_ FailureReporterInterface * GetFailureReporter()
const char kErrorVerbosity[]
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_ void Log(LogSeverity severity, const std::string &message, int stack_frames_to_skip)
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
GTEST_API_ std::string ConvertIdentifierNameToWords(const char *id_name)
static type Copy(const RawContainer &container)
#define T(upbtypeconst, upbtype, ctype, default_value)
const char kInfoVerbosity[]
internal::NativeArray< RawElement > type
static type Copy(const ::std::tuple< ElementPointer, Size > &array)
bool Base64Unescape(const std::string &encoded, std::string *decoded)
static const_reference ConstReference(const ::std::tuple< ElementPointer, Size > &array)
std::tuple< Args... > ArgumentTuple
typename AllocatorTraits< A >::pointer Pointer
auto ApplyImpl(F &&f, Tuple &&args, IndexSequence< Idx... >) -> decltype(std::forward< F >(f)(std::get< Idx >(std::forward< Tuple >(args))...))
const char kWarningVerbosity[]
static const_reference ConstReference(const Element(&array)[N])
GMOCK_DECLARE_KIND_(bool, kBool)
typename MakeIndexSequenceImpl< N >::type MakeIndexSequence
virtual ~FailureReporterInterface()
void(Args...) MakeResultVoid
auto Apply(F &&f, Tuple &&args) -> decltype(ApplyImpl(std::forward< F >(f), std::forward< Tuple >(args), MakeIndexSequence< std::tuple_size< Tuple >::value >()))
const Pointer::element_type * GetRawPointer(const Pointer &p)
#define GMOCK_KIND_OF_(type)
static const_reference ConstReference(const RawContainer &container)
void Assert(bool condition, const char *file, int line)
IgnoredValue(Args...) MakeResultIgnoredValue
GTEST_API_ WithoutMatchers GetWithoutMatchers()
GTEST_API_ std::string JoinAsKeyValueTuple(const std::vector< const char * > &names, const Strings &values)
std::array< int64_t, Size > values
friend GTEST_API_ WithoutMatchers GetWithoutMatchers()
::std::vector< ::std::string > Strings
internal::NativeArray< RawElement > type
GTEST_API_ bool LogIsVisible(LogSeverity severity)
static type Copy(const Element(&array)[N])
std::tuple< Matcher< Args >... > ArgumentMatcherTuple
std::pair< std::string, std::string > pair
std::remove_const< typename std::pointer_traits< ElementPointer >::element_type >::type RawElement
void Expect(bool condition, const char *file, int line, const std::string &msg)
static struct async_container * container
std::remove_const< Element >::type RawElement
const typedef type & const_reference
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:31