gmock-generated-actions.h 111 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567
  1. // This file was GENERATED by command:
  2. // pump.py gmock-generated-actions.h.pump
  3. // DO NOT EDIT BY HAND!!!
  4. // Copyright 2007, Google Inc.
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions are
  9. // met:
  10. //
  11. // * Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. // * Redistributions in binary form must reproduce the above
  14. // copyright notice, this list of conditions and the following disclaimer
  15. // in the documentation and/or other materials provided with the
  16. // distribution.
  17. // * Neither the name of Google Inc. nor the names of its
  18. // contributors may be used to endorse or promote products derived from
  19. // this software without specific prior written permission.
  20. //
  21. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. // Google Mock - a framework for writing C++ mock classes.
  33. //
  34. // This file implements some commonly used variadic actions.
  35. // GOOGLETEST_CM0002 DO NOT DELETE
  36. #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
  37. #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
  38. #include "gmock/gmock-actions.h"
  39. #include "gmock/internal/gmock-port.h"
  40. namespace testing {
  41. namespace internal {
  42. // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
  43. // function, method, or callback with the unpacked values, where F is
  44. // a function type that takes N arguments.
  45. template <typename Result, typename ArgumentTuple>
  46. class InvokeHelper;
  47. template <typename R>
  48. class InvokeHelper<R, ::testing::tuple<> > {
  49. public:
  50. template <typename Function>
  51. static R Invoke(Function function, const ::testing::tuple<>&) {
  52. return function();
  53. }
  54. template <class Class, typename MethodPtr>
  55. static R InvokeMethod(Class* obj_ptr,
  56. MethodPtr method_ptr,
  57. const ::testing::tuple<>&) {
  58. return (obj_ptr->*method_ptr)();
  59. }
  60. template <typename CallbackType>
  61. static R InvokeCallback(CallbackType* callback,
  62. const ::testing::tuple<>&) {
  63. return callback->Run();
  64. }
  65. };
  66. template <typename R, typename A1>
  67. class InvokeHelper<R, ::testing::tuple<A1> > {
  68. public:
  69. template <typename Function>
  70. static R Invoke(Function function, const ::testing::tuple<A1>& args) {
  71. return function(get<0>(args));
  72. }
  73. template <class Class, typename MethodPtr>
  74. static R InvokeMethod(Class* obj_ptr,
  75. MethodPtr method_ptr,
  76. const ::testing::tuple<A1>& args) {
  77. return (obj_ptr->*method_ptr)(get<0>(args));
  78. }
  79. template <typename CallbackType>
  80. static R InvokeCallback(CallbackType* callback,
  81. const ::testing::tuple<A1>& args) {
  82. return callback->Run(get<0>(args));
  83. }
  84. };
  85. template <typename R, typename A1, typename A2>
  86. class InvokeHelper<R, ::testing::tuple<A1, A2> > {
  87. public:
  88. template <typename Function>
  89. static R Invoke(Function function, const ::testing::tuple<A1, A2>& args) {
  90. return function(get<0>(args), get<1>(args));
  91. }
  92. template <class Class, typename MethodPtr>
  93. static R InvokeMethod(Class* obj_ptr,
  94. MethodPtr method_ptr,
  95. const ::testing::tuple<A1, A2>& args) {
  96. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
  97. }
  98. template <typename CallbackType>
  99. static R InvokeCallback(CallbackType* callback,
  100. const ::testing::tuple<A1, A2>& args) {
  101. return callback->Run(get<0>(args), get<1>(args));
  102. }
  103. };
  104. template <typename R, typename A1, typename A2, typename A3>
  105. class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
  106. public:
  107. template <typename Function>
  108. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3>& args) {
  109. return function(get<0>(args), get<1>(args), get<2>(args));
  110. }
  111. template <class Class, typename MethodPtr>
  112. static R InvokeMethod(Class* obj_ptr,
  113. MethodPtr method_ptr,
  114. const ::testing::tuple<A1, A2, A3>& args) {
  115. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  116. get<2>(args));
  117. }
  118. template <typename CallbackType>
  119. static R InvokeCallback(CallbackType* callback,
  120. const ::testing::tuple<A1, A2, A3>& args) {
  121. return callback->Run(get<0>(args), get<1>(args), get<2>(args));
  122. }
  123. };
  124. template <typename R, typename A1, typename A2, typename A3, typename A4>
  125. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
  126. public:
  127. template <typename Function>
  128. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3,
  129. A4>& args) {
  130. return function(get<0>(args), get<1>(args), get<2>(args),
  131. get<3>(args));
  132. }
  133. template <class Class, typename MethodPtr>
  134. static R InvokeMethod(Class* obj_ptr,
  135. MethodPtr method_ptr,
  136. const ::testing::tuple<A1, A2, A3, A4>& args) {
  137. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  138. get<2>(args), get<3>(args));
  139. }
  140. template <typename CallbackType>
  141. static R InvokeCallback(CallbackType* callback,
  142. const ::testing::tuple<A1, A2, A3, A4>& args) {
  143. return callback->Run(get<0>(args), get<1>(args), get<2>(args),
  144. get<3>(args));
  145. }
  146. };
  147. template <typename R, typename A1, typename A2, typename A3, typename A4,
  148. typename A5>
  149. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
  150. public:
  151. template <typename Function>
  152. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4,
  153. A5>& args) {
  154. return function(get<0>(args), get<1>(args), get<2>(args),
  155. get<3>(args), get<4>(args));
  156. }
  157. template <class Class, typename MethodPtr>
  158. static R InvokeMethod(Class* obj_ptr,
  159. MethodPtr method_ptr,
  160. const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
  161. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  162. get<2>(args), get<3>(args), get<4>(args));
  163. }
  164. template <typename CallbackType>
  165. static R InvokeCallback(CallbackType* callback,
  166. const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
  167. return callback->Run(get<0>(args), get<1>(args), get<2>(args),
  168. get<3>(args), get<4>(args));
  169. }
  170. };
  171. template <typename R, typename A1, typename A2, typename A3, typename A4,
  172. typename A5, typename A6>
  173. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
  174. public:
  175. template <typename Function>
  176. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
  177. A6>& args) {
  178. return function(get<0>(args), get<1>(args), get<2>(args),
  179. get<3>(args), get<4>(args), get<5>(args));
  180. }
  181. template <class Class, typename MethodPtr>
  182. static R InvokeMethod(Class* obj_ptr,
  183. MethodPtr method_ptr,
  184. const ::testing::tuple<A1, A2, A3, A4, A5, A6>& args) {
  185. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  186. get<2>(args), get<3>(args), get<4>(args), get<5>(args));
  187. }
  188. // There is no InvokeCallback() for 6-tuples
  189. };
  190. template <typename R, typename A1, typename A2, typename A3, typename A4,
  191. typename A5, typename A6, typename A7>
  192. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
  193. public:
  194. template <typename Function>
  195. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
  196. A6, A7>& args) {
  197. return function(get<0>(args), get<1>(args), get<2>(args),
  198. get<3>(args), get<4>(args), get<5>(args), get<6>(args));
  199. }
  200. template <class Class, typename MethodPtr>
  201. static R InvokeMethod(Class* obj_ptr,
  202. MethodPtr method_ptr,
  203. const ::testing::tuple<A1, A2, A3, A4, A5, A6,
  204. A7>& args) {
  205. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  206. get<2>(args), get<3>(args), get<4>(args), get<5>(args),
  207. get<6>(args));
  208. }
  209. // There is no InvokeCallback() for 7-tuples
  210. };
  211. template <typename R, typename A1, typename A2, typename A3, typename A4,
  212. typename A5, typename A6, typename A7, typename A8>
  213. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
  214. public:
  215. template <typename Function>
  216. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
  217. A6, A7, A8>& args) {
  218. return function(get<0>(args), get<1>(args), get<2>(args),
  219. get<3>(args), get<4>(args), get<5>(args), get<6>(args),
  220. get<7>(args));
  221. }
  222. template <class Class, typename MethodPtr>
  223. static R InvokeMethod(Class* obj_ptr,
  224. MethodPtr method_ptr,
  225. const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7,
  226. A8>& args) {
  227. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  228. get<2>(args), get<3>(args), get<4>(args), get<5>(args),
  229. get<6>(args), get<7>(args));
  230. }
  231. // There is no InvokeCallback() for 8-tuples
  232. };
  233. template <typename R, typename A1, typename A2, typename A3, typename A4,
  234. typename A5, typename A6, typename A7, typename A8, typename A9>
  235. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
  236. public:
  237. template <typename Function>
  238. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
  239. A6, A7, A8, A9>& args) {
  240. return function(get<0>(args), get<1>(args), get<2>(args),
  241. get<3>(args), get<4>(args), get<5>(args), get<6>(args),
  242. get<7>(args), get<8>(args));
  243. }
  244. template <class Class, typename MethodPtr>
  245. static R InvokeMethod(Class* obj_ptr,
  246. MethodPtr method_ptr,
  247. const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
  248. A9>& args) {
  249. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  250. get<2>(args), get<3>(args), get<4>(args), get<5>(args),
  251. get<6>(args), get<7>(args), get<8>(args));
  252. }
  253. // There is no InvokeCallback() for 9-tuples
  254. };
  255. template <typename R, typename A1, typename A2, typename A3, typename A4,
  256. typename A5, typename A6, typename A7, typename A8, typename A9,
  257. typename A10>
  258. class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
  259. A10> > {
  260. public:
  261. template <typename Function>
  262. static R Invoke(Function function, const ::testing::tuple<A1, A2, A3, A4, A5,
  263. A6, A7, A8, A9, A10>& args) {
  264. return function(get<0>(args), get<1>(args), get<2>(args),
  265. get<3>(args), get<4>(args), get<5>(args), get<6>(args),
  266. get<7>(args), get<8>(args), get<9>(args));
  267. }
  268. template <class Class, typename MethodPtr>
  269. static R InvokeMethod(Class* obj_ptr,
  270. MethodPtr method_ptr,
  271. const ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8,
  272. A9, A10>& args) {
  273. return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
  274. get<2>(args), get<3>(args), get<4>(args), get<5>(args),
  275. get<6>(args), get<7>(args), get<8>(args), get<9>(args));
  276. }
  277. // There is no InvokeCallback() for 10-tuples
  278. };
  279. // Implements the Invoke(callback) action.
  280. template <typename CallbackType>
  281. class InvokeCallbackAction {
  282. public:
  283. // The c'tor takes ownership of the callback.
  284. explicit InvokeCallbackAction(CallbackType* callback)
  285. : callback_(callback) {
  286. callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
  287. }
  288. // This type conversion operator template allows Invoke(callback) to
  289. // be used wherever the callback's type is compatible with that of
  290. // the mock function, i.e. if the mock function's arguments can be
  291. // implicitly converted to the callback's arguments and the
  292. // callback's result can be implicitly converted to the mock
  293. // function's result.
  294. template <typename Result, typename ArgumentTuple>
  295. Result Perform(const ArgumentTuple& args) const {
  296. return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
  297. callback_.get(), args);
  298. }
  299. private:
  300. const linked_ptr<CallbackType> callback_;
  301. };
  302. // An INTERNAL macro for extracting the type of a tuple field. It's
  303. // subject to change without notice - DO NOT USE IN USER CODE!
  304. #define GMOCK_FIELD_(Tuple, N) \
  305. typename ::testing::tuple_element<N, Tuple>::type
  306. // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
  307. // type of an n-ary function whose i-th (1-based) argument type is the
  308. // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple
  309. // type, and whose return type is Result. For example,
  310. // SelectArgs<int, ::testing::tuple<bool, char, double, long>, 0, 3>::type
  311. // is int(bool, long).
  312. //
  313. // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::Select(args)
  314. // returns the selected fields (k1, k2, ..., k_n) of args as a tuple.
  315. // For example,
  316. // SelectArgs<int, tuple<bool, char, double>, 2, 0>::Select(
  317. // ::testing::make_tuple(true, 'a', 2.5))
  318. // returns tuple (2.5, true).
  319. //
  320. // The numbers in list k1, k2, ..., k_n must be >= 0, where n can be
  321. // in the range [0, 10]. Duplicates are allowed and they don't have
  322. // to be in an ascending or descending order.
  323. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  324. int k4, int k5, int k6, int k7, int k8, int k9, int k10>
  325. class SelectArgs {
  326. public:
  327. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  328. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  329. GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
  330. GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
  331. GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
  332. GMOCK_FIELD_(ArgumentTuple, k10));
  333. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  334. static SelectedArgs Select(const ArgumentTuple& args) {
  335. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  336. get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
  337. get<k8>(args), get<k9>(args), get<k10>(args));
  338. }
  339. };
  340. template <typename Result, typename ArgumentTuple>
  341. class SelectArgs<Result, ArgumentTuple,
  342. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
  343. public:
  344. typedef Result type();
  345. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  346. static SelectedArgs Select(const ArgumentTuple& /* args */) {
  347. return SelectedArgs();
  348. }
  349. };
  350. template <typename Result, typename ArgumentTuple, int k1>
  351. class SelectArgs<Result, ArgumentTuple,
  352. k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
  353. public:
  354. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
  355. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  356. static SelectedArgs Select(const ArgumentTuple& args) {
  357. return SelectedArgs(get<k1>(args));
  358. }
  359. };
  360. template <typename Result, typename ArgumentTuple, int k1, int k2>
  361. class SelectArgs<Result, ArgumentTuple,
  362. k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
  363. public:
  364. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  365. GMOCK_FIELD_(ArgumentTuple, k2));
  366. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  367. static SelectedArgs Select(const ArgumentTuple& args) {
  368. return SelectedArgs(get<k1>(args), get<k2>(args));
  369. }
  370. };
  371. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
  372. class SelectArgs<Result, ArgumentTuple,
  373. k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
  374. public:
  375. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  376. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
  377. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  378. static SelectedArgs Select(const ArgumentTuple& args) {
  379. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args));
  380. }
  381. };
  382. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  383. int k4>
  384. class SelectArgs<Result, ArgumentTuple,
  385. k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
  386. public:
  387. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  388. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  389. GMOCK_FIELD_(ArgumentTuple, k4));
  390. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  391. static SelectedArgs Select(const ArgumentTuple& args) {
  392. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  393. get<k4>(args));
  394. }
  395. };
  396. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  397. int k4, int k5>
  398. class SelectArgs<Result, ArgumentTuple,
  399. k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
  400. public:
  401. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  402. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  403. GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
  404. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  405. static SelectedArgs Select(const ArgumentTuple& args) {
  406. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  407. get<k4>(args), get<k5>(args));
  408. }
  409. };
  410. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  411. int k4, int k5, int k6>
  412. class SelectArgs<Result, ArgumentTuple,
  413. k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
  414. public:
  415. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  416. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  417. GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
  418. GMOCK_FIELD_(ArgumentTuple, k6));
  419. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  420. static SelectedArgs Select(const ArgumentTuple& args) {
  421. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  422. get<k4>(args), get<k5>(args), get<k6>(args));
  423. }
  424. };
  425. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  426. int k4, int k5, int k6, int k7>
  427. class SelectArgs<Result, ArgumentTuple,
  428. k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
  429. public:
  430. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  431. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  432. GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
  433. GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
  434. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  435. static SelectedArgs Select(const ArgumentTuple& args) {
  436. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  437. get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args));
  438. }
  439. };
  440. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  441. int k4, int k5, int k6, int k7, int k8>
  442. class SelectArgs<Result, ArgumentTuple,
  443. k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
  444. public:
  445. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  446. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  447. GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
  448. GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
  449. GMOCK_FIELD_(ArgumentTuple, k8));
  450. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  451. static SelectedArgs Select(const ArgumentTuple& args) {
  452. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  453. get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
  454. get<k8>(args));
  455. }
  456. };
  457. template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
  458. int k4, int k5, int k6, int k7, int k8, int k9>
  459. class SelectArgs<Result, ArgumentTuple,
  460. k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
  461. public:
  462. typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
  463. GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
  464. GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
  465. GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
  466. GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
  467. typedef typename Function<type>::ArgumentTuple SelectedArgs;
  468. static SelectedArgs Select(const ArgumentTuple& args) {
  469. return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args),
  470. get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args),
  471. get<k8>(args), get<k9>(args));
  472. }
  473. };
  474. #undef GMOCK_FIELD_
  475. // Implements the WithArgs action.
  476. template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,
  477. int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1,
  478. int k9 = -1, int k10 = -1>
  479. class WithArgsAction {
  480. public:
  481. explicit WithArgsAction(const InnerAction& action) : action_(action) {}
  482. template <typename F>
  483. operator Action<F>() const { return MakeAction(new Impl<F>(action_)); }
  484. private:
  485. template <typename F>
  486. class Impl : public ActionInterface<F> {
  487. public:
  488. typedef typename Function<F>::Result Result;
  489. typedef typename Function<F>::ArgumentTuple ArgumentTuple;
  490. explicit Impl(const InnerAction& action) : action_(action) {}
  491. virtual Result Perform(const ArgumentTuple& args) {
  492. return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4,
  493. k5, k6, k7, k8, k9, k10>::Select(args));
  494. }
  495. private:
  496. typedef typename SelectArgs<Result, ArgumentTuple,
  497. k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType;
  498. Action<InnerFunctionType> action_;
  499. };
  500. const InnerAction action_;
  501. GTEST_DISALLOW_ASSIGN_(WithArgsAction);
  502. };
  503. // A macro from the ACTION* family (defined later in this file)
  504. // defines an action that can be used in a mock function. Typically,
  505. // these actions only care about a subset of the arguments of the mock
  506. // function. For example, if such an action only uses the second
  507. // argument, it can be used in any mock function that takes >= 2
  508. // arguments where the type of the second argument is compatible.
  509. //
  510. // Therefore, the action implementation must be prepared to take more
  511. // arguments than it needs. The ExcessiveArg type is used to
  512. // represent those excessive arguments. In order to keep the compiler
  513. // error messages tractable, we define it in the testing namespace
  514. // instead of testing::internal. However, this is an INTERNAL TYPE
  515. // and subject to change without notice, so a user MUST NOT USE THIS
  516. // TYPE DIRECTLY.
  517. struct ExcessiveArg {};
  518. // A helper class needed for implementing the ACTION* macros.
  519. template <typename Result, class Impl>
  520. class ActionHelper {
  521. public:
  522. static Result Perform(Impl* impl, const ::testing::tuple<>& args) {
  523. return impl->template gmock_PerformImpl<>(args, ExcessiveArg(),
  524. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  525. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  526. ExcessiveArg());
  527. }
  528. template <typename A0>
  529. static Result Perform(Impl* impl, const ::testing::tuple<A0>& args) {
  530. return impl->template gmock_PerformImpl<A0>(args, get<0>(args),
  531. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  532. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  533. ExcessiveArg());
  534. }
  535. template <typename A0, typename A1>
  536. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1>& args) {
  537. return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args),
  538. get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  539. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  540. ExcessiveArg());
  541. }
  542. template <typename A0, typename A1, typename A2>
  543. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2>& args) {
  544. return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args),
  545. get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(),
  546. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  547. ExcessiveArg());
  548. }
  549. template <typename A0, typename A1, typename A2, typename A3>
  550. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2,
  551. A3>& args) {
  552. return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args),
  553. get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(),
  554. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  555. ExcessiveArg());
  556. }
  557. template <typename A0, typename A1, typename A2, typename A3, typename A4>
  558. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3,
  559. A4>& args) {
  560. return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args,
  561. get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
  562. ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  563. ExcessiveArg());
  564. }
  565. template <typename A0, typename A1, typename A2, typename A3, typename A4,
  566. typename A5>
  567. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
  568. A5>& args) {
  569. return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args,
  570. get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
  571. get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(),
  572. ExcessiveArg());
  573. }
  574. template <typename A0, typename A1, typename A2, typename A3, typename A4,
  575. typename A5, typename A6>
  576. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
  577. A5, A6>& args) {
  578. return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args,
  579. get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args),
  580. get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(),
  581. ExcessiveArg());
  582. }
  583. template <typename A0, typename A1, typename A2, typename A3, typename A4,
  584. typename A5, typename A6, typename A7>
  585. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
  586. A5, A6, A7>& args) {
  587. return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6,
  588. A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
  589. get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(),
  590. ExcessiveArg());
  591. }
  592. template <typename A0, typename A1, typename A2, typename A3, typename A4,
  593. typename A5, typename A6, typename A7, typename A8>
  594. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
  595. A5, A6, A7, A8>& args) {
  596. return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7,
  597. A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
  598. get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
  599. ExcessiveArg());
  600. }
  601. template <typename A0, typename A1, typename A2, typename A3, typename A4,
  602. typename A5, typename A6, typename A7, typename A8, typename A9>
  603. static Result Perform(Impl* impl, const ::testing::tuple<A0, A1, A2, A3, A4,
  604. A5, A6, A7, A8, A9>& args) {
  605. return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8,
  606. A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args),
  607. get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args),
  608. get<9>(args));
  609. }
  610. };
  611. } // namespace internal
  612. // Various overloads for Invoke().
  613. // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes
  614. // the selected arguments of the mock function to an_action and
  615. // performs it. It serves as an adaptor between actions with
  616. // different argument lists. C++ doesn't support default arguments for
  617. // function templates, so we have to overload it.
  618. template <int k1, typename InnerAction>
  619. inline internal::WithArgsAction<InnerAction, k1>
  620. WithArgs(const InnerAction& action) {
  621. return internal::WithArgsAction<InnerAction, k1>(action);
  622. }
  623. template <int k1, int k2, typename InnerAction>
  624. inline internal::WithArgsAction<InnerAction, k1, k2>
  625. WithArgs(const InnerAction& action) {
  626. return internal::WithArgsAction<InnerAction, k1, k2>(action);
  627. }
  628. template <int k1, int k2, int k3, typename InnerAction>
  629. inline internal::WithArgsAction<InnerAction, k1, k2, k3>
  630. WithArgs(const InnerAction& action) {
  631. return internal::WithArgsAction<InnerAction, k1, k2, k3>(action);
  632. }
  633. template <int k1, int k2, int k3, int k4, typename InnerAction>
  634. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4>
  635. WithArgs(const InnerAction& action) {
  636. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action);
  637. }
  638. template <int k1, int k2, int k3, int k4, int k5, typename InnerAction>
  639. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>
  640. WithArgs(const InnerAction& action) {
  641. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action);
  642. }
  643. template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction>
  644. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>
  645. WithArgs(const InnerAction& action) {
  646. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action);
  647. }
  648. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7,
  649. typename InnerAction>
  650. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7>
  651. WithArgs(const InnerAction& action) {
  652. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6,
  653. k7>(action);
  654. }
  655. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
  656. typename InnerAction>
  657. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8>
  658. WithArgs(const InnerAction& action) {
  659. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7,
  660. k8>(action);
  661. }
  662. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
  663. int k9, typename InnerAction>
  664. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9>
  665. WithArgs(const InnerAction& action) {
  666. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
  667. k9>(action);
  668. }
  669. template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8,
  670. int k9, int k10, typename InnerAction>
  671. inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
  672. k9, k10>
  673. WithArgs(const InnerAction& action) {
  674. return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8,
  675. k9, k10>(action);
  676. }
  677. // Creates an action that does actions a1, a2, ..., sequentially in
  678. // each invocation.
  679. template <typename Action1, typename Action2>
  680. inline internal::DoBothAction<Action1, Action2>
  681. DoAll(Action1 a1, Action2 a2) {
  682. return internal::DoBothAction<Action1, Action2>(a1, a2);
  683. }
  684. template <typename Action1, typename Action2, typename Action3>
  685. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  686. Action3> >
  687. DoAll(Action1 a1, Action2 a2, Action3 a3) {
  688. return DoAll(a1, DoAll(a2, a3));
  689. }
  690. template <typename Action1, typename Action2, typename Action3,
  691. typename Action4>
  692. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  693. internal::DoBothAction<Action3, Action4> > >
  694. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) {
  695. return DoAll(a1, DoAll(a2, a3, a4));
  696. }
  697. template <typename Action1, typename Action2, typename Action3,
  698. typename Action4, typename Action5>
  699. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  700. internal::DoBothAction<Action3, internal::DoBothAction<Action4,
  701. Action5> > > >
  702. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) {
  703. return DoAll(a1, DoAll(a2, a3, a4, a5));
  704. }
  705. template <typename Action1, typename Action2, typename Action3,
  706. typename Action4, typename Action5, typename Action6>
  707. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  708. internal::DoBothAction<Action3, internal::DoBothAction<Action4,
  709. internal::DoBothAction<Action5, Action6> > > > >
  710. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) {
  711. return DoAll(a1, DoAll(a2, a3, a4, a5, a6));
  712. }
  713. template <typename Action1, typename Action2, typename Action3,
  714. typename Action4, typename Action5, typename Action6, typename Action7>
  715. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  716. internal::DoBothAction<Action3, internal::DoBothAction<Action4,
  717. internal::DoBothAction<Action5, internal::DoBothAction<Action6,
  718. Action7> > > > > >
  719. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
  720. Action7 a7) {
  721. return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7));
  722. }
  723. template <typename Action1, typename Action2, typename Action3,
  724. typename Action4, typename Action5, typename Action6, typename Action7,
  725. typename Action8>
  726. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  727. internal::DoBothAction<Action3, internal::DoBothAction<Action4,
  728. internal::DoBothAction<Action5, internal::DoBothAction<Action6,
  729. internal::DoBothAction<Action7, Action8> > > > > > >
  730. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
  731. Action7 a7, Action8 a8) {
  732. return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8));
  733. }
  734. template <typename Action1, typename Action2, typename Action3,
  735. typename Action4, typename Action5, typename Action6, typename Action7,
  736. typename Action8, typename Action9>
  737. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  738. internal::DoBothAction<Action3, internal::DoBothAction<Action4,
  739. internal::DoBothAction<Action5, internal::DoBothAction<Action6,
  740. internal::DoBothAction<Action7, internal::DoBothAction<Action8,
  741. Action9> > > > > > > >
  742. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
  743. Action7 a7, Action8 a8, Action9 a9) {
  744. return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9));
  745. }
  746. template <typename Action1, typename Action2, typename Action3,
  747. typename Action4, typename Action5, typename Action6, typename Action7,
  748. typename Action8, typename Action9, typename Action10>
  749. inline internal::DoBothAction<Action1, internal::DoBothAction<Action2,
  750. internal::DoBothAction<Action3, internal::DoBothAction<Action4,
  751. internal::DoBothAction<Action5, internal::DoBothAction<Action6,
  752. internal::DoBothAction<Action7, internal::DoBothAction<Action8,
  753. internal::DoBothAction<Action9, Action10> > > > > > > > >
  754. DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
  755. Action7 a7, Action8 a8, Action9 a9, Action10 a10) {
  756. return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10));
  757. }
  758. } // namespace testing
  759. // The ACTION* family of macros can be used in a namespace scope to
  760. // define custom actions easily. The syntax:
  761. //
  762. // ACTION(name) { statements; }
  763. //
  764. // will define an action with the given name that executes the
  765. // statements. The value returned by the statements will be used as
  766. // the return value of the action. Inside the statements, you can
  767. // refer to the K-th (0-based) argument of the mock function by
  768. // 'argK', and refer to its type by 'argK_type'. For example:
  769. //
  770. // ACTION(IncrementArg1) {
  771. // arg1_type temp = arg1;
  772. // return ++(*temp);
  773. // }
  774. //
  775. // allows you to write
  776. //
  777. // ...WillOnce(IncrementArg1());
  778. //
  779. // You can also refer to the entire argument tuple and its type by
  780. // 'args' and 'args_type', and refer to the mock function type and its
  781. // return type by 'function_type' and 'return_type'.
  782. //
  783. // Note that you don't need to specify the types of the mock function
  784. // arguments. However rest assured that your code is still type-safe:
  785. // you'll get a compiler error if *arg1 doesn't support the ++
  786. // operator, or if the type of ++(*arg1) isn't compatible with the
  787. // mock function's return type, for example.
  788. //
  789. // Sometimes you'll want to parameterize the action. For that you can use
  790. // another macro:
  791. //
  792. // ACTION_P(name, param_name) { statements; }
  793. //
  794. // For example:
  795. //
  796. // ACTION_P(Add, n) { return arg0 + n; }
  797. //
  798. // will allow you to write:
  799. //
  800. // ...WillOnce(Add(5));
  801. //
  802. // Note that you don't need to provide the type of the parameter
  803. // either. If you need to reference the type of a parameter named
  804. // 'foo', you can write 'foo_type'. For example, in the body of
  805. // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
  806. // of 'n'.
  807. //
  808. // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
  809. // multi-parameter actions.
  810. //
  811. // For the purpose of typing, you can view
  812. //
  813. // ACTION_Pk(Foo, p1, ..., pk) { ... }
  814. //
  815. // as shorthand for
  816. //
  817. // template <typename p1_type, ..., typename pk_type>
  818. // FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... }
  819. //
  820. // In particular, you can provide the template type arguments
  821. // explicitly when invoking Foo(), as in Foo<long, bool>(5, false);
  822. // although usually you can rely on the compiler to infer the types
  823. // for you automatically. You can assign the result of expression
  824. // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ...,
  825. // pk_type>. This can be useful when composing actions.
  826. //
  827. // You can also overload actions with different numbers of parameters:
  828. //
  829. // ACTION_P(Plus, a) { ... }
  830. // ACTION_P2(Plus, a, b) { ... }
  831. //
  832. // While it's tempting to always use the ACTION* macros when defining
  833. // a new action, you should also consider implementing ActionInterface
  834. // or using MakePolymorphicAction() instead, especially if you need to
  835. // use the action a lot. While these approaches require more work,
  836. // they give you more control on the types of the mock function
  837. // arguments and the action parameters, which in general leads to
  838. // better compiler error messages that pay off in the long run. They
  839. // also allow overloading actions based on parameter types (as opposed
  840. // to just based on the number of parameters).
  841. //
  842. // CAVEAT:
  843. //
  844. // ACTION*() can only be used in a namespace scope. The reason is
  845. // that C++ doesn't yet allow function-local types to be used to
  846. // instantiate templates. The up-coming C++0x standard will fix this.
  847. // Once that's done, we'll consider supporting using ACTION*() inside
  848. // a function.
  849. //
  850. // MORE INFORMATION:
  851. //
  852. // To learn more about using these macros, please search for 'ACTION'
  853. // on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
  854. // An internal macro needed for implementing ACTION*().
  855. #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
  856. const args_type& args GTEST_ATTRIBUTE_UNUSED_, \
  857. arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \
  858. arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \
  859. arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \
  860. arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \
  861. arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \
  862. arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \
  863. arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \
  864. arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \
  865. arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \
  866. arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_
  867. // Sometimes you want to give an action explicit template parameters
  868. // that cannot be inferred from its value parameters. ACTION() and
  869. // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that
  870. // and can be viewed as an extension to ACTION() and ACTION_P*().
  871. //
  872. // The syntax:
  873. //
  874. // ACTION_TEMPLATE(ActionName,
  875. // HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m),
  876. // AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; }
  877. //
  878. // defines an action template that takes m explicit template
  879. // parameters and n value parameters. name_i is the name of the i-th
  880. // template parameter, and kind_i specifies whether it's a typename,
  881. // an integral constant, or a template. p_i is the name of the i-th
  882. // value parameter.
  883. //
  884. // Example:
  885. //
  886. // // DuplicateArg<k, T>(output) converts the k-th argument of the mock
  887. // // function to type T and copies it to *output.
  888. // ACTION_TEMPLATE(DuplicateArg,
  889. // HAS_2_TEMPLATE_PARAMS(int, k, typename, T),
  890. // AND_1_VALUE_PARAMS(output)) {
  891. // *output = T(::testing::get<k>(args));
  892. // }
  893. // ...
  894. // int n;
  895. // EXPECT_CALL(mock, Foo(_, _))
  896. // .WillOnce(DuplicateArg<1, unsigned char>(&n));
  897. //
  898. // To create an instance of an action template, write:
  899. //
  900. // ActionName<t1, ..., t_m>(v1, ..., v_n)
  901. //
  902. // where the ts are the template arguments and the vs are the value
  903. // arguments. The value argument types are inferred by the compiler.
  904. // If you want to explicitly specify the value argument types, you can
  905. // provide additional template arguments:
  906. //
  907. // ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n)
  908. //
  909. // where u_i is the desired type of v_i.
  910. //
  911. // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the
  912. // number of value parameters, but not on the number of template
  913. // parameters. Without the restriction, the meaning of the following
  914. // is unclear:
  915. //
  916. // OverloadedAction<int, bool>(x);
  917. //
  918. // Are we using a single-template-parameter action where 'bool' refers
  919. // to the type of x, or are we using a two-template-parameter action
  920. // where the compiler is asked to infer the type of x?
  921. //
  922. // Implementation notes:
  923. //
  924. // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and
  925. // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for
  926. // implementing ACTION_TEMPLATE. The main trick we use is to create
  927. // new macro invocations when expanding a macro. For example, we have
  928. //
  929. // #define ACTION_TEMPLATE(name, template_params, value_params)
  930. // ... GMOCK_INTERNAL_DECL_##template_params ...
  931. //
  932. // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...)
  933. // to expand to
  934. //
  935. // ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ...
  936. //
  937. // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the
  938. // preprocessor will continue to expand it to
  939. //
  940. // ... typename T ...
  941. //
  942. // This technique conforms to the C++ standard and is portable. It
  943. // allows us to implement action templates using O(N) code, where N is
  944. // the maximum number of template/value parameters supported. Without
  945. // using it, we'd have to devote O(N^2) amount of code to implement all
  946. // combinations of m and n.
  947. // Declares the template parameters.
  948. #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0
  949. #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
  950. name1) kind0 name0, kind1 name1
  951. #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  952. kind2, name2) kind0 name0, kind1 name1, kind2 name2
  953. #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  954. kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \
  955. kind3 name3
  956. #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  957. kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \
  958. kind2 name2, kind3 name3, kind4 name4
  959. #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  960. kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \
  961. kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5
  962. #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  963. kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
  964. name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \
  965. kind5 name5, kind6 name6
  966. #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  967. kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
  968. kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \
  969. kind4 name4, kind5 name5, kind6 name6, kind7 name7
  970. #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  971. kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
  972. kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \
  973. kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \
  974. kind8 name8
  975. #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
  976. name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
  977. name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \
  978. kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \
  979. kind6 name6, kind7 name7, kind8 name8, kind9 name9
  980. // Lists the template parameters.
  981. #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0
  982. #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \
  983. name1) name0, name1
  984. #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  985. kind2, name2) name0, name1, name2
  986. #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  987. kind2, name2, kind3, name3) name0, name1, name2, name3
  988. #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  989. kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \
  990. name4
  991. #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  992. kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \
  993. name2, name3, name4, name5
  994. #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  995. kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
  996. name6) name0, name1, name2, name3, name4, name5, name6
  997. #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  998. kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
  999. kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7
  1000. #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \
  1001. kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \
  1002. kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \
  1003. name6, name7, name8
  1004. #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \
  1005. name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \
  1006. name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \
  1007. name3, name4, name5, name6, name7, name8, name9
  1008. // Declares the types of value parameters.
  1009. #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS()
  1010. #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type
  1011. #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \
  1012. typename p0##_type, typename p1##_type
  1013. #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \
  1014. typename p0##_type, typename p1##_type, typename p2##_type
  1015. #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
  1016. typename p0##_type, typename p1##_type, typename p2##_type, \
  1017. typename p3##_type
  1018. #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
  1019. typename p0##_type, typename p1##_type, typename p2##_type, \
  1020. typename p3##_type, typename p4##_type
  1021. #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
  1022. typename p0##_type, typename p1##_type, typename p2##_type, \
  1023. typename p3##_type, typename p4##_type, typename p5##_type
  1024. #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1025. p6) , typename p0##_type, typename p1##_type, typename p2##_type, \
  1026. typename p3##_type, typename p4##_type, typename p5##_type, \
  1027. typename p6##_type
  1028. #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1029. p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \
  1030. typename p3##_type, typename p4##_type, typename p5##_type, \
  1031. typename p6##_type, typename p7##_type
  1032. #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1033. p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \
  1034. typename p3##_type, typename p4##_type, typename p5##_type, \
  1035. typename p6##_type, typename p7##_type, typename p8##_type
  1036. #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1037. p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \
  1038. typename p2##_type, typename p3##_type, typename p4##_type, \
  1039. typename p5##_type, typename p6##_type, typename p7##_type, \
  1040. typename p8##_type, typename p9##_type
  1041. // Initializes the value parameters.
  1042. #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
  1043. ()
  1044. #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
  1045. (p0##_type gmock_p0) : p0(::testing::internal::move(gmock_p0))
  1046. #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
  1047. (p0##_type gmock_p0, \
  1048. p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
  1049. p1(::testing::internal::move(gmock_p1))
  1050. #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
  1051. (p0##_type gmock_p0, p1##_type gmock_p1, \
  1052. p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
  1053. p1(::testing::internal::move(gmock_p1)), \
  1054. p2(::testing::internal::move(gmock_p2))
  1055. #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
  1056. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1057. p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
  1058. p1(::testing::internal::move(gmock_p1)), \
  1059. p2(::testing::internal::move(gmock_p2)), \
  1060. p3(::testing::internal::move(gmock_p3))
  1061. #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
  1062. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1063. p3##_type gmock_p3, \
  1064. p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
  1065. p1(::testing::internal::move(gmock_p1)), \
  1066. p2(::testing::internal::move(gmock_p2)), \
  1067. p3(::testing::internal::move(gmock_p3)), \
  1068. p4(::testing::internal::move(gmock_p4))
  1069. #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
  1070. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1071. p3##_type gmock_p3, p4##_type gmock_p4, \
  1072. p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
  1073. p1(::testing::internal::move(gmock_p1)), \
  1074. p2(::testing::internal::move(gmock_p2)), \
  1075. p3(::testing::internal::move(gmock_p3)), \
  1076. p4(::testing::internal::move(gmock_p4)), \
  1077. p5(::testing::internal::move(gmock_p5))
  1078. #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
  1079. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1080. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1081. p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
  1082. p1(::testing::internal::move(gmock_p1)), \
  1083. p2(::testing::internal::move(gmock_p2)), \
  1084. p3(::testing::internal::move(gmock_p3)), \
  1085. p4(::testing::internal::move(gmock_p4)), \
  1086. p5(::testing::internal::move(gmock_p5)), \
  1087. p6(::testing::internal::move(gmock_p6))
  1088. #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
  1089. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1090. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1091. p6##_type gmock_p6, \
  1092. p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
  1093. p1(::testing::internal::move(gmock_p1)), \
  1094. p2(::testing::internal::move(gmock_p2)), \
  1095. p3(::testing::internal::move(gmock_p3)), \
  1096. p4(::testing::internal::move(gmock_p4)), \
  1097. p5(::testing::internal::move(gmock_p5)), \
  1098. p6(::testing::internal::move(gmock_p6)), \
  1099. p7(::testing::internal::move(gmock_p7))
  1100. #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1101. p7, p8)\
  1102. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1103. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1104. p6##_type gmock_p6, p7##_type gmock_p7, \
  1105. p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
  1106. p1(::testing::internal::move(gmock_p1)), \
  1107. p2(::testing::internal::move(gmock_p2)), \
  1108. p3(::testing::internal::move(gmock_p3)), \
  1109. p4(::testing::internal::move(gmock_p4)), \
  1110. p5(::testing::internal::move(gmock_p5)), \
  1111. p6(::testing::internal::move(gmock_p6)), \
  1112. p7(::testing::internal::move(gmock_p7)), \
  1113. p8(::testing::internal::move(gmock_p8))
  1114. #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1115. p7, p8, p9)\
  1116. (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1117. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1118. p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
  1119. p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
  1120. p1(::testing::internal::move(gmock_p1)), \
  1121. p2(::testing::internal::move(gmock_p2)), \
  1122. p3(::testing::internal::move(gmock_p3)), \
  1123. p4(::testing::internal::move(gmock_p4)), \
  1124. p5(::testing::internal::move(gmock_p5)), \
  1125. p6(::testing::internal::move(gmock_p6)), \
  1126. p7(::testing::internal::move(gmock_p7)), \
  1127. p8(::testing::internal::move(gmock_p8)), \
  1128. p9(::testing::internal::move(gmock_p9))
  1129. // Declares the fields for storing the value parameters.
  1130. #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
  1131. #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0;
  1132. #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \
  1133. p1##_type p1;
  1134. #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \
  1135. p1##_type p1; p2##_type p2;
  1136. #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \
  1137. p1##_type p1; p2##_type p2; p3##_type p3;
  1138. #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
  1139. p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4;
  1140. #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
  1141. p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
  1142. p5##_type p5;
  1143. #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1144. p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
  1145. p5##_type p5; p6##_type p6;
  1146. #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1147. p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \
  1148. p5##_type p5; p6##_type p6; p7##_type p7;
  1149. #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1150. p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
  1151. p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8;
  1152. #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1153. p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \
  1154. p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \
  1155. p9##_type p9;
  1156. // Lists the value parameters.
  1157. #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS()
  1158. #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0
  1159. #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1
  1160. #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2
  1161. #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3
  1162. #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \
  1163. p2, p3, p4
  1164. #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \
  1165. p1, p2, p3, p4, p5
  1166. #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1167. p6) p0, p1, p2, p3, p4, p5, p6
  1168. #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1169. p7) p0, p1, p2, p3, p4, p5, p6, p7
  1170. #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1171. p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8
  1172. #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1173. p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9
  1174. // Lists the value parameter types.
  1175. #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS()
  1176. #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type
  1177. #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \
  1178. p1##_type
  1179. #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \
  1180. p1##_type, p2##_type
  1181. #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \
  1182. p0##_type, p1##_type, p2##_type, p3##_type
  1183. #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \
  1184. p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
  1185. #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \
  1186. p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type
  1187. #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1188. p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \
  1189. p6##_type
  1190. #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1191. p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1192. p5##_type, p6##_type, p7##_type
  1193. #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1194. p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1195. p5##_type, p6##_type, p7##_type, p8##_type
  1196. #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1197. p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1198. p5##_type, p6##_type, p7##_type, p8##_type, p9##_type
  1199. // Declares the value parameters.
  1200. #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS()
  1201. #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0
  1202. #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \
  1203. p1##_type p1
  1204. #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \
  1205. p1##_type p1, p2##_type p2
  1206. #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \
  1207. p1##_type p1, p2##_type p2, p3##_type p3
  1208. #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \
  1209. p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4
  1210. #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \
  1211. p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
  1212. p5##_type p5
  1213. #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \
  1214. p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
  1215. p5##_type p5, p6##_type p6
  1216. #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1217. p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \
  1218. p5##_type p5, p6##_type p6, p7##_type p7
  1219. #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1220. p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  1221. p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8
  1222. #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1223. p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  1224. p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
  1225. p9##_type p9
  1226. // The suffix of the class template implementing the action template.
  1227. #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS()
  1228. #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P
  1229. #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2
  1230. #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3
  1231. #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4
  1232. #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5
  1233. #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6
  1234. #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7
  1235. #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1236. p7) P8
  1237. #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1238. p7, p8) P9
  1239. #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
  1240. p7, p8, p9) P10
  1241. // The name of the class template implementing the action template.
  1242. #define GMOCK_ACTION_CLASS_(name, value_params)\
  1243. GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params)
  1244. #define ACTION_TEMPLATE(name, template_params, value_params)\
  1245. template <GMOCK_INTERNAL_DECL_##template_params\
  1246. GMOCK_INTERNAL_DECL_TYPE_##value_params>\
  1247. class GMOCK_ACTION_CLASS_(name, value_params) {\
  1248. public:\
  1249. explicit GMOCK_ACTION_CLASS_(name, value_params)\
  1250. GMOCK_INTERNAL_INIT_##value_params {}\
  1251. template <typename F>\
  1252. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1253. public:\
  1254. typedef F function_type;\
  1255. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1256. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1257. args_type;\
  1258. explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\
  1259. virtual return_type Perform(const args_type& args) {\
  1260. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1261. Perform(this, args);\
  1262. }\
  1263. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1264. typename arg3_type, typename arg4_type, typename arg5_type, \
  1265. typename arg6_type, typename arg7_type, typename arg8_type, \
  1266. typename arg9_type>\
  1267. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1268. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1269. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1270. arg9_type arg9) const;\
  1271. GMOCK_INTERNAL_DEFN_##value_params\
  1272. private:\
  1273. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1274. };\
  1275. template <typename F> operator ::testing::Action<F>() const {\
  1276. return ::testing::Action<F>(\
  1277. new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
  1278. }\
  1279. GMOCK_INTERNAL_DEFN_##value_params\
  1280. private:\
  1281. GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
  1282. };\
  1283. template <GMOCK_INTERNAL_DECL_##template_params\
  1284. GMOCK_INTERNAL_DECL_TYPE_##value_params>\
  1285. inline GMOCK_ACTION_CLASS_(name, value_params)<\
  1286. GMOCK_INTERNAL_LIST_##template_params\
  1287. GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\
  1288. GMOCK_INTERNAL_DECL_##value_params) {\
  1289. return GMOCK_ACTION_CLASS_(name, value_params)<\
  1290. GMOCK_INTERNAL_LIST_##template_params\
  1291. GMOCK_INTERNAL_LIST_TYPE_##value_params>(\
  1292. GMOCK_INTERNAL_LIST_##value_params);\
  1293. }\
  1294. template <GMOCK_INTERNAL_DECL_##template_params\
  1295. GMOCK_INTERNAL_DECL_TYPE_##value_params>\
  1296. template <typename F>\
  1297. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1298. typename arg3_type, typename arg4_type, typename arg5_type, \
  1299. typename arg6_type, typename arg7_type, typename arg8_type, \
  1300. typename arg9_type>\
  1301. typename ::testing::internal::Function<F>::Result\
  1302. GMOCK_ACTION_CLASS_(name, value_params)<\
  1303. GMOCK_INTERNAL_LIST_##template_params\
  1304. GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\
  1305. gmock_PerformImpl(\
  1306. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1307. #define ACTION(name)\
  1308. class name##Action {\
  1309. public:\
  1310. name##Action() {}\
  1311. template <typename F>\
  1312. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1313. public:\
  1314. typedef F function_type;\
  1315. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1316. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1317. args_type;\
  1318. gmock_Impl() {}\
  1319. virtual return_type Perform(const args_type& args) {\
  1320. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1321. Perform(this, args);\
  1322. }\
  1323. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1324. typename arg3_type, typename arg4_type, typename arg5_type, \
  1325. typename arg6_type, typename arg7_type, typename arg8_type, \
  1326. typename arg9_type>\
  1327. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1328. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1329. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1330. arg9_type arg9) const;\
  1331. private:\
  1332. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1333. };\
  1334. template <typename F> operator ::testing::Action<F>() const {\
  1335. return ::testing::Action<F>(new gmock_Impl<F>());\
  1336. }\
  1337. private:\
  1338. GTEST_DISALLOW_ASSIGN_(name##Action);\
  1339. };\
  1340. inline name##Action name() {\
  1341. return name##Action();\
  1342. }\
  1343. template <typename F>\
  1344. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1345. typename arg3_type, typename arg4_type, typename arg5_type, \
  1346. typename arg6_type, typename arg7_type, typename arg8_type, \
  1347. typename arg9_type>\
  1348. typename ::testing::internal::Function<F>::Result\
  1349. name##Action::gmock_Impl<F>::gmock_PerformImpl(\
  1350. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1351. #define ACTION_P(name, p0)\
  1352. template <typename p0##_type>\
  1353. class name##ActionP {\
  1354. public:\
  1355. explicit name##ActionP(p0##_type gmock_p0) : \
  1356. p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
  1357. template <typename F>\
  1358. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1359. public:\
  1360. typedef F function_type;\
  1361. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1362. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1363. args_type;\
  1364. explicit gmock_Impl(p0##_type gmock_p0) : \
  1365. p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
  1366. virtual return_type Perform(const args_type& args) {\
  1367. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1368. Perform(this, args);\
  1369. }\
  1370. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1371. typename arg3_type, typename arg4_type, typename arg5_type, \
  1372. typename arg6_type, typename arg7_type, typename arg8_type, \
  1373. typename arg9_type>\
  1374. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1375. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1376. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1377. arg9_type arg9) const;\
  1378. p0##_type p0;\
  1379. private:\
  1380. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1381. };\
  1382. template <typename F> operator ::testing::Action<F>() const {\
  1383. return ::testing::Action<F>(new gmock_Impl<F>(p0));\
  1384. }\
  1385. p0##_type p0;\
  1386. private:\
  1387. GTEST_DISALLOW_ASSIGN_(name##ActionP);\
  1388. };\
  1389. template <typename p0##_type>\
  1390. inline name##ActionP<p0##_type> name(p0##_type p0) {\
  1391. return name##ActionP<p0##_type>(p0);\
  1392. }\
  1393. template <typename p0##_type>\
  1394. template <typename F>\
  1395. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1396. typename arg3_type, typename arg4_type, typename arg5_type, \
  1397. typename arg6_type, typename arg7_type, typename arg8_type, \
  1398. typename arg9_type>\
  1399. typename ::testing::internal::Function<F>::Result\
  1400. name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1401. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1402. #define ACTION_P2(name, p0, p1)\
  1403. template <typename p0##_type, typename p1##_type>\
  1404. class name##ActionP2 {\
  1405. public:\
  1406. name##ActionP2(p0##_type gmock_p0, \
  1407. p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1408. p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
  1409. template <typename F>\
  1410. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1411. public:\
  1412. typedef F function_type;\
  1413. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1414. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1415. args_type;\
  1416. gmock_Impl(p0##_type gmock_p0, \
  1417. p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1418. p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
  1419. virtual return_type Perform(const args_type& args) {\
  1420. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1421. Perform(this, args);\
  1422. }\
  1423. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1424. typename arg3_type, typename arg4_type, typename arg5_type, \
  1425. typename arg6_type, typename arg7_type, typename arg8_type, \
  1426. typename arg9_type>\
  1427. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1428. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1429. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1430. arg9_type arg9) const;\
  1431. p0##_type p0;\
  1432. p1##_type p1;\
  1433. private:\
  1434. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1435. };\
  1436. template <typename F> operator ::testing::Action<F>() const {\
  1437. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\
  1438. }\
  1439. p0##_type p0;\
  1440. p1##_type p1;\
  1441. private:\
  1442. GTEST_DISALLOW_ASSIGN_(name##ActionP2);\
  1443. };\
  1444. template <typename p0##_type, typename p1##_type>\
  1445. inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \
  1446. p1##_type p1) {\
  1447. return name##ActionP2<p0##_type, p1##_type>(p0, p1);\
  1448. }\
  1449. template <typename p0##_type, typename p1##_type>\
  1450. template <typename F>\
  1451. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1452. typename arg3_type, typename arg4_type, typename arg5_type, \
  1453. typename arg6_type, typename arg7_type, typename arg8_type, \
  1454. typename arg9_type>\
  1455. typename ::testing::internal::Function<F>::Result\
  1456. name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1457. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1458. #define ACTION_P3(name, p0, p1, p2)\
  1459. template <typename p0##_type, typename p1##_type, typename p2##_type>\
  1460. class name##ActionP3 {\
  1461. public:\
  1462. name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
  1463. p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1464. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1465. p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
  1466. template <typename F>\
  1467. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1468. public:\
  1469. typedef F function_type;\
  1470. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1471. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1472. args_type;\
  1473. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
  1474. p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1475. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1476. p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
  1477. virtual return_type Perform(const args_type& args) {\
  1478. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1479. Perform(this, args);\
  1480. }\
  1481. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1482. typename arg3_type, typename arg4_type, typename arg5_type, \
  1483. typename arg6_type, typename arg7_type, typename arg8_type, \
  1484. typename arg9_type>\
  1485. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1486. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1487. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1488. arg9_type arg9) const;\
  1489. p0##_type p0;\
  1490. p1##_type p1;\
  1491. p2##_type p2;\
  1492. private:\
  1493. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1494. };\
  1495. template <typename F> operator ::testing::Action<F>() const {\
  1496. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\
  1497. }\
  1498. p0##_type p0;\
  1499. p1##_type p1;\
  1500. p2##_type p2;\
  1501. private:\
  1502. GTEST_DISALLOW_ASSIGN_(name##ActionP3);\
  1503. };\
  1504. template <typename p0##_type, typename p1##_type, typename p2##_type>\
  1505. inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
  1506. p1##_type p1, p2##_type p2) {\
  1507. return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
  1508. }\
  1509. template <typename p0##_type, typename p1##_type, typename p2##_type>\
  1510. template <typename F>\
  1511. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1512. typename arg3_type, typename arg4_type, typename arg5_type, \
  1513. typename arg6_type, typename arg7_type, typename arg8_type, \
  1514. typename arg9_type>\
  1515. typename ::testing::internal::Function<F>::Result\
  1516. name##ActionP3<p0##_type, p1##_type, \
  1517. p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1518. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1519. #define ACTION_P4(name, p0, p1, p2, p3)\
  1520. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1521. typename p3##_type>\
  1522. class name##ActionP4 {\
  1523. public:\
  1524. name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
  1525. p2##_type gmock_p2, \
  1526. p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1527. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1528. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1529. p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
  1530. template <typename F>\
  1531. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1532. public:\
  1533. typedef F function_type;\
  1534. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1535. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1536. args_type;\
  1537. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1538. p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1539. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1540. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1541. p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
  1542. virtual return_type Perform(const args_type& args) {\
  1543. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1544. Perform(this, args);\
  1545. }\
  1546. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1547. typename arg3_type, typename arg4_type, typename arg5_type, \
  1548. typename arg6_type, typename arg7_type, typename arg8_type, \
  1549. typename arg9_type>\
  1550. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1551. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1552. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1553. arg9_type arg9) const;\
  1554. p0##_type p0;\
  1555. p1##_type p1;\
  1556. p2##_type p2;\
  1557. p3##_type p3;\
  1558. private:\
  1559. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1560. };\
  1561. template <typename F> operator ::testing::Action<F>() const {\
  1562. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\
  1563. }\
  1564. p0##_type p0;\
  1565. p1##_type p1;\
  1566. p2##_type p2;\
  1567. p3##_type p3;\
  1568. private:\
  1569. GTEST_DISALLOW_ASSIGN_(name##ActionP4);\
  1570. };\
  1571. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1572. typename p3##_type>\
  1573. inline name##ActionP4<p0##_type, p1##_type, p2##_type, \
  1574. p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
  1575. p3##_type p3) {\
  1576. return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \
  1577. p2, p3);\
  1578. }\
  1579. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1580. typename p3##_type>\
  1581. template <typename F>\
  1582. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1583. typename arg3_type, typename arg4_type, typename arg5_type, \
  1584. typename arg6_type, typename arg7_type, typename arg8_type, \
  1585. typename arg9_type>\
  1586. typename ::testing::internal::Function<F>::Result\
  1587. name##ActionP4<p0##_type, p1##_type, p2##_type, \
  1588. p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1589. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1590. #define ACTION_P5(name, p0, p1, p2, p3, p4)\
  1591. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1592. typename p3##_type, typename p4##_type>\
  1593. class name##ActionP5 {\
  1594. public:\
  1595. name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
  1596. p2##_type gmock_p2, p3##_type gmock_p3, \
  1597. p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1598. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1599. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1600. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1601. p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
  1602. template <typename F>\
  1603. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1604. public:\
  1605. typedef F function_type;\
  1606. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1607. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1608. args_type;\
  1609. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1610. p3##_type gmock_p3, \
  1611. p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1612. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1613. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1614. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1615. p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
  1616. virtual return_type Perform(const args_type& args) {\
  1617. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1618. Perform(this, args);\
  1619. }\
  1620. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1621. typename arg3_type, typename arg4_type, typename arg5_type, \
  1622. typename arg6_type, typename arg7_type, typename arg8_type, \
  1623. typename arg9_type>\
  1624. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1625. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1626. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1627. arg9_type arg9) const;\
  1628. p0##_type p0;\
  1629. p1##_type p1;\
  1630. p2##_type p2;\
  1631. p3##_type p3;\
  1632. p4##_type p4;\
  1633. private:\
  1634. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1635. };\
  1636. template <typename F> operator ::testing::Action<F>() const {\
  1637. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\
  1638. }\
  1639. p0##_type p0;\
  1640. p1##_type p1;\
  1641. p2##_type p2;\
  1642. p3##_type p3;\
  1643. p4##_type p4;\
  1644. private:\
  1645. GTEST_DISALLOW_ASSIGN_(name##ActionP5);\
  1646. };\
  1647. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1648. typename p3##_type, typename p4##_type>\
  1649. inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
  1650. p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  1651. p4##_type p4) {\
  1652. return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
  1653. p4##_type>(p0, p1, p2, p3, p4);\
  1654. }\
  1655. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1656. typename p3##_type, typename p4##_type>\
  1657. template <typename F>\
  1658. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1659. typename arg3_type, typename arg4_type, typename arg5_type, \
  1660. typename arg6_type, typename arg7_type, typename arg8_type, \
  1661. typename arg9_type>\
  1662. typename ::testing::internal::Function<F>::Result\
  1663. name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \
  1664. p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1665. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1666. #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\
  1667. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1668. typename p3##_type, typename p4##_type, typename p5##_type>\
  1669. class name##ActionP6 {\
  1670. public:\
  1671. name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
  1672. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1673. p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1674. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1675. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1676. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1677. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1678. p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
  1679. template <typename F>\
  1680. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1681. public:\
  1682. typedef F function_type;\
  1683. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1684. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1685. args_type;\
  1686. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1687. p3##_type gmock_p3, p4##_type gmock_p4, \
  1688. p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1689. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1690. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1691. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1692. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1693. p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
  1694. virtual return_type Perform(const args_type& args) {\
  1695. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1696. Perform(this, args);\
  1697. }\
  1698. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1699. typename arg3_type, typename arg4_type, typename arg5_type, \
  1700. typename arg6_type, typename arg7_type, typename arg8_type, \
  1701. typename arg9_type>\
  1702. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1703. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1704. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1705. arg9_type arg9) const;\
  1706. p0##_type p0;\
  1707. p1##_type p1;\
  1708. p2##_type p2;\
  1709. p3##_type p3;\
  1710. p4##_type p4;\
  1711. p5##_type p5;\
  1712. private:\
  1713. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1714. };\
  1715. template <typename F> operator ::testing::Action<F>() const {\
  1716. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\
  1717. }\
  1718. p0##_type p0;\
  1719. p1##_type p1;\
  1720. p2##_type p2;\
  1721. p3##_type p3;\
  1722. p4##_type p4;\
  1723. p5##_type p5;\
  1724. private:\
  1725. GTEST_DISALLOW_ASSIGN_(name##ActionP6);\
  1726. };\
  1727. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1728. typename p3##_type, typename p4##_type, typename p5##_type>\
  1729. inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
  1730. p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
  1731. p3##_type p3, p4##_type p4, p5##_type p5) {\
  1732. return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \
  1733. p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
  1734. }\
  1735. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1736. typename p3##_type, typename p4##_type, typename p5##_type>\
  1737. template <typename F>\
  1738. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1739. typename arg3_type, typename arg4_type, typename arg5_type, \
  1740. typename arg6_type, typename arg7_type, typename arg8_type, \
  1741. typename arg9_type>\
  1742. typename ::testing::internal::Function<F>::Result\
  1743. name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1744. p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1745. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1746. #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\
  1747. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1748. typename p3##_type, typename p4##_type, typename p5##_type, \
  1749. typename p6##_type>\
  1750. class name##ActionP7 {\
  1751. public:\
  1752. name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
  1753. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1754. p5##_type gmock_p5, \
  1755. p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1756. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1757. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1758. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1759. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1760. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  1761. p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
  1762. template <typename F>\
  1763. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1764. public:\
  1765. typedef F function_type;\
  1766. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1767. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1768. args_type;\
  1769. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1770. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1771. p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1772. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1773. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1774. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1775. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1776. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  1777. p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
  1778. virtual return_type Perform(const args_type& args) {\
  1779. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1780. Perform(this, args);\
  1781. }\
  1782. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1783. typename arg3_type, typename arg4_type, typename arg5_type, \
  1784. typename arg6_type, typename arg7_type, typename arg8_type, \
  1785. typename arg9_type>\
  1786. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1787. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1788. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1789. arg9_type arg9) const;\
  1790. p0##_type p0;\
  1791. p1##_type p1;\
  1792. p2##_type p2;\
  1793. p3##_type p3;\
  1794. p4##_type p4;\
  1795. p5##_type p5;\
  1796. p6##_type p6;\
  1797. private:\
  1798. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1799. };\
  1800. template <typename F> operator ::testing::Action<F>() const {\
  1801. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
  1802. p6));\
  1803. }\
  1804. p0##_type p0;\
  1805. p1##_type p1;\
  1806. p2##_type p2;\
  1807. p3##_type p3;\
  1808. p4##_type p4;\
  1809. p5##_type p5;\
  1810. p6##_type p6;\
  1811. private:\
  1812. GTEST_DISALLOW_ASSIGN_(name##ActionP7);\
  1813. };\
  1814. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1815. typename p3##_type, typename p4##_type, typename p5##_type, \
  1816. typename p6##_type>\
  1817. inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
  1818. p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
  1819. p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
  1820. p6##_type p6) {\
  1821. return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \
  1822. p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
  1823. }\
  1824. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1825. typename p3##_type, typename p4##_type, typename p5##_type, \
  1826. typename p6##_type>\
  1827. template <typename F>\
  1828. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1829. typename arg3_type, typename arg4_type, typename arg5_type, \
  1830. typename arg6_type, typename arg7_type, typename arg8_type, \
  1831. typename arg9_type>\
  1832. typename ::testing::internal::Function<F>::Result\
  1833. name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1834. p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1835. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1836. #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\
  1837. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1838. typename p3##_type, typename p4##_type, typename p5##_type, \
  1839. typename p6##_type, typename p7##_type>\
  1840. class name##ActionP8 {\
  1841. public:\
  1842. name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
  1843. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1844. p5##_type gmock_p5, p6##_type gmock_p6, \
  1845. p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1846. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1847. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1848. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1849. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1850. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  1851. p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
  1852. p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
  1853. template <typename F>\
  1854. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1855. public:\
  1856. typedef F function_type;\
  1857. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1858. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1859. args_type;\
  1860. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1861. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1862. p6##_type gmock_p6, \
  1863. p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1864. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1865. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1866. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1867. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1868. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  1869. p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
  1870. p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
  1871. virtual return_type Perform(const args_type& args) {\
  1872. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1873. Perform(this, args);\
  1874. }\
  1875. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1876. typename arg3_type, typename arg4_type, typename arg5_type, \
  1877. typename arg6_type, typename arg7_type, typename arg8_type, \
  1878. typename arg9_type>\
  1879. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1880. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1881. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1882. arg9_type arg9) const;\
  1883. p0##_type p0;\
  1884. p1##_type p1;\
  1885. p2##_type p2;\
  1886. p3##_type p3;\
  1887. p4##_type p4;\
  1888. p5##_type p5;\
  1889. p6##_type p6;\
  1890. p7##_type p7;\
  1891. private:\
  1892. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1893. };\
  1894. template <typename F> operator ::testing::Action<F>() const {\
  1895. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
  1896. p6, p7));\
  1897. }\
  1898. p0##_type p0;\
  1899. p1##_type p1;\
  1900. p2##_type p2;\
  1901. p3##_type p3;\
  1902. p4##_type p4;\
  1903. p5##_type p5;\
  1904. p6##_type p6;\
  1905. p7##_type p7;\
  1906. private:\
  1907. GTEST_DISALLOW_ASSIGN_(name##ActionP8);\
  1908. };\
  1909. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1910. typename p3##_type, typename p4##_type, typename p5##_type, \
  1911. typename p6##_type, typename p7##_type>\
  1912. inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
  1913. p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
  1914. p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
  1915. p6##_type p6, p7##_type p7) {\
  1916. return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \
  1917. p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
  1918. p6, p7);\
  1919. }\
  1920. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1921. typename p3##_type, typename p4##_type, typename p5##_type, \
  1922. typename p6##_type, typename p7##_type>\
  1923. template <typename F>\
  1924. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1925. typename arg3_type, typename arg4_type, typename arg5_type, \
  1926. typename arg6_type, typename arg7_type, typename arg8_type, \
  1927. typename arg9_type>\
  1928. typename ::testing::internal::Function<F>::Result\
  1929. name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  1930. p5##_type, p6##_type, \
  1931. p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  1932. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  1933. #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\
  1934. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  1935. typename p3##_type, typename p4##_type, typename p5##_type, \
  1936. typename p6##_type, typename p7##_type, typename p8##_type>\
  1937. class name##ActionP9 {\
  1938. public:\
  1939. name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
  1940. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  1941. p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
  1942. p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1943. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1944. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1945. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1946. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1947. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  1948. p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
  1949. p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
  1950. p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
  1951. template <typename F>\
  1952. class gmock_Impl : public ::testing::ActionInterface<F> {\
  1953. public:\
  1954. typedef F function_type;\
  1955. typedef typename ::testing::internal::Function<F>::Result return_type;\
  1956. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  1957. args_type;\
  1958. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  1959. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  1960. p6##_type gmock_p6, p7##_type gmock_p7, \
  1961. p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  1962. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  1963. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  1964. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  1965. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  1966. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  1967. p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
  1968. p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
  1969. p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
  1970. virtual return_type Perform(const args_type& args) {\
  1971. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  1972. Perform(this, args);\
  1973. }\
  1974. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  1975. typename arg3_type, typename arg4_type, typename arg5_type, \
  1976. typename arg6_type, typename arg7_type, typename arg8_type, \
  1977. typename arg9_type>\
  1978. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  1979. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  1980. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  1981. arg9_type arg9) const;\
  1982. p0##_type p0;\
  1983. p1##_type p1;\
  1984. p2##_type p2;\
  1985. p3##_type p3;\
  1986. p4##_type p4;\
  1987. p5##_type p5;\
  1988. p6##_type p6;\
  1989. p7##_type p7;\
  1990. p8##_type p8;\
  1991. private:\
  1992. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  1993. };\
  1994. template <typename F> operator ::testing::Action<F>() const {\
  1995. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
  1996. p6, p7, p8));\
  1997. }\
  1998. p0##_type p0;\
  1999. p1##_type p1;\
  2000. p2##_type p2;\
  2001. p3##_type p3;\
  2002. p4##_type p4;\
  2003. p5##_type p5;\
  2004. p6##_type p6;\
  2005. p7##_type p7;\
  2006. p8##_type p8;\
  2007. private:\
  2008. GTEST_DISALLOW_ASSIGN_(name##ActionP9);\
  2009. };\
  2010. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  2011. typename p3##_type, typename p4##_type, typename p5##_type, \
  2012. typename p6##_type, typename p7##_type, typename p8##_type>\
  2013. inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
  2014. p4##_type, p5##_type, p6##_type, p7##_type, \
  2015. p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  2016. p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
  2017. p8##_type p8) {\
  2018. return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \
  2019. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
  2020. p3, p4, p5, p6, p7, p8);\
  2021. }\
  2022. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  2023. typename p3##_type, typename p4##_type, typename p5##_type, \
  2024. typename p6##_type, typename p7##_type, typename p8##_type>\
  2025. template <typename F>\
  2026. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  2027. typename arg3_type, typename arg4_type, typename arg5_type, \
  2028. typename arg6_type, typename arg7_type, typename arg8_type, \
  2029. typename arg9_type>\
  2030. typename ::testing::internal::Function<F>::Result\
  2031. name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  2032. p5##_type, p6##_type, p7##_type, \
  2033. p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  2034. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  2035. #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\
  2036. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  2037. typename p3##_type, typename p4##_type, typename p5##_type, \
  2038. typename p6##_type, typename p7##_type, typename p8##_type, \
  2039. typename p9##_type>\
  2040. class name##ActionP10 {\
  2041. public:\
  2042. name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
  2043. p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
  2044. p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
  2045. p8##_type gmock_p8, \
  2046. p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  2047. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  2048. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  2049. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  2050. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  2051. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  2052. p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
  2053. p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
  2054. p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
  2055. p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
  2056. template <typename F>\
  2057. class gmock_Impl : public ::testing::ActionInterface<F> {\
  2058. public:\
  2059. typedef F function_type;\
  2060. typedef typename ::testing::internal::Function<F>::Result return_type;\
  2061. typedef typename ::testing::internal::Function<F>::ArgumentTuple\
  2062. args_type;\
  2063. gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
  2064. p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
  2065. p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
  2066. p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
  2067. p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
  2068. p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
  2069. p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
  2070. p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
  2071. p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
  2072. p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
  2073. p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
  2074. p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
  2075. p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
  2076. virtual return_type Perform(const args_type& args) {\
  2077. return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
  2078. Perform(this, args);\
  2079. }\
  2080. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  2081. typename arg3_type, typename arg4_type, typename arg5_type, \
  2082. typename arg6_type, typename arg7_type, typename arg8_type, \
  2083. typename arg9_type>\
  2084. return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \
  2085. arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \
  2086. arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \
  2087. arg9_type arg9) const;\
  2088. p0##_type p0;\
  2089. p1##_type p1;\
  2090. p2##_type p2;\
  2091. p3##_type p3;\
  2092. p4##_type p4;\
  2093. p5##_type p5;\
  2094. p6##_type p6;\
  2095. p7##_type p7;\
  2096. p8##_type p8;\
  2097. p9##_type p9;\
  2098. private:\
  2099. GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
  2100. };\
  2101. template <typename F> operator ::testing::Action<F>() const {\
  2102. return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \
  2103. p6, p7, p8, p9));\
  2104. }\
  2105. p0##_type p0;\
  2106. p1##_type p1;\
  2107. p2##_type p2;\
  2108. p3##_type p3;\
  2109. p4##_type p4;\
  2110. p5##_type p5;\
  2111. p6##_type p6;\
  2112. p7##_type p7;\
  2113. p8##_type p8;\
  2114. p9##_type p9;\
  2115. private:\
  2116. GTEST_DISALLOW_ASSIGN_(name##ActionP10);\
  2117. };\
  2118. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  2119. typename p3##_type, typename p4##_type, typename p5##_type, \
  2120. typename p6##_type, typename p7##_type, typename p8##_type, \
  2121. typename p9##_type>\
  2122. inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
  2123. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
  2124. p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
  2125. p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
  2126. p9##_type p9) {\
  2127. return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \
  2128. p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
  2129. p1, p2, p3, p4, p5, p6, p7, p8, p9);\
  2130. }\
  2131. template <typename p0##_type, typename p1##_type, typename p2##_type, \
  2132. typename p3##_type, typename p4##_type, typename p5##_type, \
  2133. typename p6##_type, typename p7##_type, typename p8##_type, \
  2134. typename p9##_type>\
  2135. template <typename F>\
  2136. template <typename arg0_type, typename arg1_type, typename arg2_type, \
  2137. typename arg3_type, typename arg4_type, typename arg5_type, \
  2138. typename arg6_type, typename arg7_type, typename arg8_type, \
  2139. typename arg9_type>\
  2140. typename ::testing::internal::Function<F>::Result\
  2141. name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
  2142. p5##_type, p6##_type, p7##_type, p8##_type, \
  2143. p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\
  2144. GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const
  2145. namespace testing {
  2146. // The ACTION*() macros trigger warning C4100 (unreferenced formal
  2147. // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
  2148. // the macro definition, as the warnings are generated when the macro
  2149. // is expanded and macro expansion cannot contain #pragma. Therefore
  2150. // we suppress them here.
  2151. #ifdef _MSC_VER
  2152. # pragma warning(push)
  2153. # pragma warning(disable:4100)
  2154. #endif
  2155. // Various overloads for InvokeArgument<N>().
  2156. //
  2157. // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th
  2158. // (0-based) argument, which must be a k-ary callable, of the mock
  2159. // function, with arguments a1, a2, ..., a_k.
  2160. //
  2161. // Notes:
  2162. //
  2163. // 1. The arguments are passed by value by default. If you need to
  2164. // pass an argument by reference, wrap it inside ByRef(). For
  2165. // example,
  2166. //
  2167. // InvokeArgument<1>(5, string("Hello"), ByRef(foo))
  2168. //
  2169. // passes 5 and string("Hello") by value, and passes foo by
  2170. // reference.
  2171. //
  2172. // 2. If the callable takes an argument by reference but ByRef() is
  2173. // not used, it will receive the reference to a copy of the value,
  2174. // instead of the original value. For example, when the 0-th
  2175. // argument of the mock function takes a const string&, the action
  2176. //
  2177. // InvokeArgument<0>(string("Hello"))
  2178. //
  2179. // makes a copy of the temporary string("Hello") object and passes a
  2180. // reference of the copy, instead of the original temporary object,
  2181. // to the callable. This makes it easy for a user to define an
  2182. // InvokeArgument action from temporary values and have it performed
  2183. // later.
  2184. namespace internal {
  2185. namespace invoke_argument {
  2186. // Appears in InvokeArgumentAdl's argument list to help avoid
  2187. // accidental calls to user functions of the same name.
  2188. struct AdlTag {};
  2189. // InvokeArgumentAdl - a helper for InvokeArgument.
  2190. // The basic overloads are provided here for generic functors.
  2191. // Overloads for other custom-callables are provided in the
  2192. // internal/custom/callback-actions.h header.
  2193. template <typename R, typename F>
  2194. R InvokeArgumentAdl(AdlTag, F f) {
  2195. return f();
  2196. }
  2197. template <typename R, typename F, typename A1>
  2198. R InvokeArgumentAdl(AdlTag, F f, A1 a1) {
  2199. return f(a1);
  2200. }
  2201. template <typename R, typename F, typename A1, typename A2>
  2202. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) {
  2203. return f(a1, a2);
  2204. }
  2205. template <typename R, typename F, typename A1, typename A2, typename A3>
  2206. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) {
  2207. return f(a1, a2, a3);
  2208. }
  2209. template <typename R, typename F, typename A1, typename A2, typename A3,
  2210. typename A4>
  2211. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) {
  2212. return f(a1, a2, a3, a4);
  2213. }
  2214. template <typename R, typename F, typename A1, typename A2, typename A3,
  2215. typename A4, typename A5>
  2216. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
  2217. return f(a1, a2, a3, a4, a5);
  2218. }
  2219. template <typename R, typename F, typename A1, typename A2, typename A3,
  2220. typename A4, typename A5, typename A6>
  2221. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
  2222. return f(a1, a2, a3, a4, a5, a6);
  2223. }
  2224. template <typename R, typename F, typename A1, typename A2, typename A3,
  2225. typename A4, typename A5, typename A6, typename A7>
  2226. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
  2227. A7 a7) {
  2228. return f(a1, a2, a3, a4, a5, a6, a7);
  2229. }
  2230. template <typename R, typename F, typename A1, typename A2, typename A3,
  2231. typename A4, typename A5, typename A6, typename A7, typename A8>
  2232. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
  2233. A7 a7, A8 a8) {
  2234. return f(a1, a2, a3, a4, a5, a6, a7, a8);
  2235. }
  2236. template <typename R, typename F, typename A1, typename A2, typename A3,
  2237. typename A4, typename A5, typename A6, typename A7, typename A8,
  2238. typename A9>
  2239. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
  2240. A7 a7, A8 a8, A9 a9) {
  2241. return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
  2242. }
  2243. template <typename R, typename F, typename A1, typename A2, typename A3,
  2244. typename A4, typename A5, typename A6, typename A7, typename A8,
  2245. typename A9, typename A10>
  2246. R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6,
  2247. A7 a7, A8 a8, A9 a9, A10 a10) {
  2248. return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
  2249. }
  2250. } // namespace invoke_argument
  2251. } // namespace internal
  2252. ACTION_TEMPLATE(InvokeArgument,
  2253. HAS_1_TEMPLATE_PARAMS(int, k),
  2254. AND_0_VALUE_PARAMS()) {
  2255. using internal::invoke_argument::InvokeArgumentAdl;
  2256. return InvokeArgumentAdl<return_type>(
  2257. internal::invoke_argument::AdlTag(),
  2258. ::testing::get<k>(args));
  2259. }
  2260. ACTION_TEMPLATE(InvokeArgument,
  2261. HAS_1_TEMPLATE_PARAMS(int, k),
  2262. AND_1_VALUE_PARAMS(p0)) {
  2263. using internal::invoke_argument::InvokeArgumentAdl;
  2264. return InvokeArgumentAdl<return_type>(
  2265. internal::invoke_argument::AdlTag(),
  2266. ::testing::get<k>(args), p0);
  2267. }
  2268. ACTION_TEMPLATE(InvokeArgument,
  2269. HAS_1_TEMPLATE_PARAMS(int, k),
  2270. AND_2_VALUE_PARAMS(p0, p1)) {
  2271. using internal::invoke_argument::InvokeArgumentAdl;
  2272. return InvokeArgumentAdl<return_type>(
  2273. internal::invoke_argument::AdlTag(),
  2274. ::testing::get<k>(args), p0, p1);
  2275. }
  2276. ACTION_TEMPLATE(InvokeArgument,
  2277. HAS_1_TEMPLATE_PARAMS(int, k),
  2278. AND_3_VALUE_PARAMS(p0, p1, p2)) {
  2279. using internal::invoke_argument::InvokeArgumentAdl;
  2280. return InvokeArgumentAdl<return_type>(
  2281. internal::invoke_argument::AdlTag(),
  2282. ::testing::get<k>(args), p0, p1, p2);
  2283. }
  2284. ACTION_TEMPLATE(InvokeArgument,
  2285. HAS_1_TEMPLATE_PARAMS(int, k),
  2286. AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
  2287. using internal::invoke_argument::InvokeArgumentAdl;
  2288. return InvokeArgumentAdl<return_type>(
  2289. internal::invoke_argument::AdlTag(),
  2290. ::testing::get<k>(args), p0, p1, p2, p3);
  2291. }
  2292. ACTION_TEMPLATE(InvokeArgument,
  2293. HAS_1_TEMPLATE_PARAMS(int, k),
  2294. AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
  2295. using internal::invoke_argument::InvokeArgumentAdl;
  2296. return InvokeArgumentAdl<return_type>(
  2297. internal::invoke_argument::AdlTag(),
  2298. ::testing::get<k>(args), p0, p1, p2, p3, p4);
  2299. }
  2300. ACTION_TEMPLATE(InvokeArgument,
  2301. HAS_1_TEMPLATE_PARAMS(int, k),
  2302. AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
  2303. using internal::invoke_argument::InvokeArgumentAdl;
  2304. return InvokeArgumentAdl<return_type>(
  2305. internal::invoke_argument::AdlTag(),
  2306. ::testing::get<k>(args), p0, p1, p2, p3, p4, p5);
  2307. }
  2308. ACTION_TEMPLATE(InvokeArgument,
  2309. HAS_1_TEMPLATE_PARAMS(int, k),
  2310. AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
  2311. using internal::invoke_argument::InvokeArgumentAdl;
  2312. return InvokeArgumentAdl<return_type>(
  2313. internal::invoke_argument::AdlTag(),
  2314. ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
  2315. }
  2316. ACTION_TEMPLATE(InvokeArgument,
  2317. HAS_1_TEMPLATE_PARAMS(int, k),
  2318. AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
  2319. using internal::invoke_argument::InvokeArgumentAdl;
  2320. return InvokeArgumentAdl<return_type>(
  2321. internal::invoke_argument::AdlTag(),
  2322. ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
  2323. }
  2324. ACTION_TEMPLATE(InvokeArgument,
  2325. HAS_1_TEMPLATE_PARAMS(int, k),
  2326. AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
  2327. using internal::invoke_argument::InvokeArgumentAdl;
  2328. return InvokeArgumentAdl<return_type>(
  2329. internal::invoke_argument::AdlTag(),
  2330. ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8);
  2331. }
  2332. ACTION_TEMPLATE(InvokeArgument,
  2333. HAS_1_TEMPLATE_PARAMS(int, k),
  2334. AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
  2335. using internal::invoke_argument::InvokeArgumentAdl;
  2336. return InvokeArgumentAdl<return_type>(
  2337. internal::invoke_argument::AdlTag(),
  2338. ::testing::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
  2339. }
  2340. // Various overloads for ReturnNew<T>().
  2341. //
  2342. // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new
  2343. // instance of type T, constructed on the heap with constructor arguments
  2344. // a1, a2, ..., and a_k. The caller assumes ownership of the returned value.
  2345. ACTION_TEMPLATE(ReturnNew,
  2346. HAS_1_TEMPLATE_PARAMS(typename, T),
  2347. AND_0_VALUE_PARAMS()) {
  2348. return new T();
  2349. }
  2350. ACTION_TEMPLATE(ReturnNew,
  2351. HAS_1_TEMPLATE_PARAMS(typename, T),
  2352. AND_1_VALUE_PARAMS(p0)) {
  2353. return new T(p0);
  2354. }
  2355. ACTION_TEMPLATE(ReturnNew,
  2356. HAS_1_TEMPLATE_PARAMS(typename, T),
  2357. AND_2_VALUE_PARAMS(p0, p1)) {
  2358. return new T(p0, p1);
  2359. }
  2360. ACTION_TEMPLATE(ReturnNew,
  2361. HAS_1_TEMPLATE_PARAMS(typename, T),
  2362. AND_3_VALUE_PARAMS(p0, p1, p2)) {
  2363. return new T(p0, p1, p2);
  2364. }
  2365. ACTION_TEMPLATE(ReturnNew,
  2366. HAS_1_TEMPLATE_PARAMS(typename, T),
  2367. AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
  2368. return new T(p0, p1, p2, p3);
  2369. }
  2370. ACTION_TEMPLATE(ReturnNew,
  2371. HAS_1_TEMPLATE_PARAMS(typename, T),
  2372. AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
  2373. return new T(p0, p1, p2, p3, p4);
  2374. }
  2375. ACTION_TEMPLATE(ReturnNew,
  2376. HAS_1_TEMPLATE_PARAMS(typename, T),
  2377. AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
  2378. return new T(p0, p1, p2, p3, p4, p5);
  2379. }
  2380. ACTION_TEMPLATE(ReturnNew,
  2381. HAS_1_TEMPLATE_PARAMS(typename, T),
  2382. AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
  2383. return new T(p0, p1, p2, p3, p4, p5, p6);
  2384. }
  2385. ACTION_TEMPLATE(ReturnNew,
  2386. HAS_1_TEMPLATE_PARAMS(typename, T),
  2387. AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
  2388. return new T(p0, p1, p2, p3, p4, p5, p6, p7);
  2389. }
  2390. ACTION_TEMPLATE(ReturnNew,
  2391. HAS_1_TEMPLATE_PARAMS(typename, T),
  2392. AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
  2393. return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8);
  2394. }
  2395. ACTION_TEMPLATE(ReturnNew,
  2396. HAS_1_TEMPLATE_PARAMS(typename, T),
  2397. AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
  2398. return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
  2399. }
  2400. #ifdef _MSC_VER
  2401. # pragma warning(pop)
  2402. #endif
  2403. } // namespace testing
  2404. // Include any custom callback actions added by the local installation.
  2405. // We must include this header at the end to make sure it can use the
  2406. // declarations from this file.
  2407. #include "gmock/internal/custom/gmock-generated-actions.h"
  2408. #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_