Warning, /JETSCAPE/external_packages/googletest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump is written in an unsupported language. File is not indexed.
0001 $$ -*- mode: c++; -*-
0002 $$ This is a Pump source file. Please use Pump to convert it to
0003 $$ gmock-generated-function-mockers.h.
0004 $$
0005 $var n = 10 $$ The maximum arity we support.
0006 // Copyright 2007, Google Inc.
0007 // All rights reserved.
0008 //
0009 // Redistribution and use in source and binary forms, with or without
0010 // modification, are permitted provided that the following conditions are
0011 // met:
0012 //
0013 // * Redistributions of source code must retain the above copyright
0014 // notice, this list of conditions and the following disclaimer.
0015 // * Redistributions in binary form must reproduce the above
0016 // copyright notice, this list of conditions and the following disclaimer
0017 // in the documentation and/or other materials provided with the
0018 // distribution.
0019 // * Neither the name of Google Inc. nor the names of its
0020 // contributors may be used to endorse or promote products derived from
0021 // this software without specific prior written permission.
0022 //
0023 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0024 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0025 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0026 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0027 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0028 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0029 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0030 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0031 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0032 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0033 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0034 //
0035 // Author: wan@google.com (Zhanyong Wan)
0036
0037 // Google Mock - a framework for writing C++ mock classes.
0038 //
0039 // This file contains template meta-programming utility classes needed
0040 // for implementing Google Mock.
0041
0042 #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
0043 #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
0044
0045 #include "gmock/internal/gmock-port.h"
0046
0047 namespace testing {
0048
0049 template <typename T>
0050 class Matcher;
0051
0052 namespace internal {
0053
0054 // An IgnoredValue object can be implicitly constructed from ANY value.
0055 // This is used in implementing the IgnoreResult(a) action.
0056 class IgnoredValue {
0057 public:
0058 // This constructor template allows any value to be implicitly
0059 // converted to IgnoredValue. The object has no data member and
0060 // doesn't try to remember anything about the argument. We
0061 // deliberately omit the 'explicit' keyword in order to allow the
0062 // conversion to be implicit.
0063 template <typename T>
0064 IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
0065 };
0066
0067 // MatcherTuple<T>::type is a tuple type where each field is a Matcher
0068 // for the corresponding field in tuple type T.
0069 template <typename Tuple>
0070 struct MatcherTuple;
0071
0072
0073 $range i 0..n
0074 $for i [[
0075 $range j 1..i
0076 $var typename_As = [[$for j, [[typename A$j]]]]
0077 $var As = [[$for j, [[A$j]]]]
0078 $var matcher_As = [[$for j, [[Matcher<A$j>]]]]
0079 template <$typename_As>
0080 struct MatcherTuple< ::testing::tuple<$As> > {
0081 typedef ::testing::tuple<$matcher_As > type;
0082 };
0083
0084
0085 ]]
0086 // Template struct Function<F>, where F must be a function type, contains
0087 // the following typedefs:
0088 //
0089 // Result: the function's return type.
0090 // ArgumentN: the type of the N-th argument, where N starts with 1.
0091 // ArgumentTuple: the tuple type consisting of all parameters of F.
0092 // ArgumentMatcherTuple: the tuple type consisting of Matchers for all
0093 // parameters of F.
0094 // MakeResultVoid: the function type obtained by substituting void
0095 // for the return type of F.
0096 // MakeResultIgnoredValue:
0097 // the function type obtained by substituting Something
0098 // for the return type of F.
0099 template <typename F>
0100 struct Function;
0101
0102 template <typename R>
0103 struct Function<R()> {
0104 typedef R Result;
0105 typedef ::testing::tuple<> ArgumentTuple;
0106 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
0107 typedef void MakeResultVoid();
0108 typedef IgnoredValue MakeResultIgnoredValue();
0109 };
0110
0111
0112 $range i 1..n
0113 $for i [[
0114 $range j 1..i
0115 $var typename_As = [[$for j [[, typename A$j]]]]
0116 $var As = [[$for j, [[A$j]]]]
0117 $var matcher_As = [[$for j, [[Matcher<A$j>]]]]
0118 $range k 1..i-1
0119 $var prev_As = [[$for k, [[A$k]]]]
0120 template <typename R$typename_As>
0121 struct Function<R($As)>
0122 : Function<R($prev_As)> {
0123 typedef A$i Argument$i;
0124 typedef ::testing::tuple<$As> ArgumentTuple;
0125 typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple;
0126 typedef void MakeResultVoid($As);
0127 typedef IgnoredValue MakeResultIgnoredValue($As);
0128 };
0129
0130
0131 ]]
0132 } // namespace internal
0133
0134 } // namespace testing
0135
0136 #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_