mt-libcouchbase 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (707) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +1 -0
  5. data/.travis.yml +38 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +24 -0
  8. data/README.md +445 -0
  9. data/Rakefile +76 -0
  10. data/ext/README.md +6 -0
  11. data/ext/Rakefile +19 -0
  12. data/ext/libcouchbase/.gitignore +132 -0
  13. data/ext/libcouchbase/CMakeLists.txt +455 -0
  14. data/ext/libcouchbase/CONTRIBUTING.md +105 -0
  15. data/ext/libcouchbase/LICENSE +202 -0
  16. data/ext/libcouchbase/README.markdown +195 -0
  17. data/ext/libcouchbase/RELEASE_NOTES.markdown +3523 -0
  18. data/ext/libcouchbase/cmake/Modules/ConfigureDtrace.cmake +52 -0
  19. data/ext/libcouchbase/cmake/Modules/CopyPDB.cmake +42 -0
  20. data/ext/libcouchbase/cmake/Modules/DistScript.cmake +17 -0
  21. data/ext/libcouchbase/cmake/Modules/DownloadLcbDep.cmake +18 -0
  22. data/ext/libcouchbase/cmake/Modules/FindCouchbaseHdrHistogram.cmake +15 -0
  23. data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibev.cmake +73 -0
  24. data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibevent.cmake +54 -0
  25. data/ext/libcouchbase/cmake/Modules/FindCouchbaseLibuv.cmake +57 -0
  26. data/ext/libcouchbase/cmake/Modules/FindProfiler.cmake +16 -0
  27. data/ext/libcouchbase/cmake/Modules/GenerateConfigDotH.cmake +49 -0
  28. data/ext/libcouchbase/cmake/Modules/GetLibcouchbaseFlags.cmake +142 -0
  29. data/ext/libcouchbase/cmake/Modules/GetPlatformCCInfo.cmake +45 -0
  30. data/ext/libcouchbase/cmake/Modules/GetVersionInfo.cmake +70 -0
  31. data/ext/libcouchbase/cmake/config-cmake.h.in +80 -0
  32. data/ext/libcouchbase/cmake/configure +355 -0
  33. data/ext/libcouchbase/cmake/defs.mk.in +6 -0
  34. data/ext/libcouchbase/cmake/dtrace-instr-link.pl +51 -0
  35. data/ext/libcouchbase/cmake/libcouchbase.stp.in +829 -0
  36. data/ext/libcouchbase/cmake/source_files.cmake +104 -0
  37. data/ext/libcouchbase/contrib/cJSON/cJSON.c +1022 -0
  38. data/ext/libcouchbase/contrib/cJSON/cJSON.h +158 -0
  39. data/ext/libcouchbase/contrib/cbsasl/CMakeLists.txt +25 -0
  40. data/ext/libcouchbase/contrib/cbsasl/COPYING +202 -0
  41. data/ext/libcouchbase/contrib/cbsasl/include/cbsasl/cbsasl.h +259 -0
  42. data/ext/libcouchbase/contrib/cbsasl/src/client.c +419 -0
  43. data/ext/libcouchbase/contrib/cbsasl/src/common.c +50 -0
  44. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/hmac.c +67 -0
  45. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/hmac.h +33 -0
  46. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/md5.c +296 -0
  47. data/ext/libcouchbase/contrib/cbsasl/src/cram-md5/md5.h +45 -0
  48. data/ext/libcouchbase/contrib/cbsasl/src/hash.c +573 -0
  49. data/ext/libcouchbase/contrib/cbsasl/src/hash.h +15 -0
  50. data/ext/libcouchbase/contrib/cbsasl/src/scram-sha/scram_utils.c +500 -0
  51. data/ext/libcouchbase/contrib/cbsasl/src/scram-sha/scram_utils.h +99 -0
  52. data/ext/libcouchbase/contrib/cbsasl/src/util.h +31 -0
  53. data/ext/libcouchbase/contrib/cliopts/CMakeLists.txt +2 -0
  54. data/ext/libcouchbase/contrib/cliopts/cliopts.c +938 -0
  55. data/ext/libcouchbase/contrib/cliopts/cliopts.h +610 -0
  56. data/ext/libcouchbase/contrib/genhash/genhash.c +371 -0
  57. data/ext/libcouchbase/contrib/genhash/genhash.h +241 -0
  58. data/ext/libcouchbase/contrib/gtest-1.7.0/CHANGES +157 -0
  59. data/ext/libcouchbase/contrib/gtest-1.7.0/CMakeLists.txt +252 -0
  60. data/ext/libcouchbase/contrib/gtest-1.7.0/CONTRIBUTORS +37 -0
  61. data/ext/libcouchbase/contrib/gtest-1.7.0/LICENSE +28 -0
  62. data/ext/libcouchbase/contrib/gtest-1.7.0/MINIFY.sh +15 -0
  63. data/ext/libcouchbase/contrib/gtest-1.7.0/README +435 -0
  64. data/ext/libcouchbase/contrib/gtest-1.7.0/cmake/internal_utils.cmake +227 -0
  65. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-death-test.h +294 -0
  66. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-message.h +250 -0
  67. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-param-test.h +1421 -0
  68. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-param-test.h.pump +487 -0
  69. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-printers.h +855 -0
  70. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-spi.h +232 -0
  71. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-test-part.h +179 -0
  72. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest-typed-test.h +259 -0
  73. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest.h +2291 -0
  74. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest_pred_impl.h +358 -0
  75. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/gtest_prod.h +58 -0
  76. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-death-test-internal.h +319 -0
  77. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-filepath.h +206 -0
  78. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-internal.h +1158 -0
  79. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-linked_ptr.h +233 -0
  80. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-param-util-generated.h +5143 -0
  81. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-param-util-generated.h.pump +301 -0
  82. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-param-util.h +619 -0
  83. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-port.h +1947 -0
  84. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-string.h +167 -0
  85. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-tuple.h +1012 -0
  86. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-tuple.h.pump +339 -0
  87. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-type-util.h +3331 -0
  88. data/ext/libcouchbase/contrib/gtest-1.7.0/include/gtest/internal/gtest-type-util.h.pump +297 -0
  89. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-all.cc +48 -0
  90. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-death-test.cc +1344 -0
  91. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-filepath.cc +382 -0
  92. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-internal-inl.h +1218 -0
  93. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-port.cc +805 -0
  94. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-printers.cc +363 -0
  95. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-test-part.cc +110 -0
  96. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest-typed-test.cc +110 -0
  97. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest.cc +5015 -0
  98. data/ext/libcouchbase/contrib/gtest-1.7.0/src/gtest_main.cc +38 -0
  99. data/ext/libcouchbase/contrib/http_parser/LICENSE-MIT +23 -0
  100. data/ext/libcouchbase/contrib/http_parser/README.md +178 -0
  101. data/ext/libcouchbase/contrib/http_parser/http_parser.c +2060 -0
  102. data/ext/libcouchbase/contrib/http_parser/http_parser.h +321 -0
  103. data/ext/libcouchbase/contrib/jsonsl/LICENSE +20 -0
  104. data/ext/libcouchbase/contrib/jsonsl/jsonsl.c +1452 -0
  105. data/ext/libcouchbase/contrib/jsonsl/jsonsl.h +971 -0
  106. data/ext/libcouchbase/contrib/lcb-jsoncpp/CMakeLists.txt +6 -0
  107. data/ext/libcouchbase/contrib/lcb-jsoncpp/LICENSE +55 -0
  108. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp-forwards.h +255 -0
  109. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp +4893 -0
  110. data/ext/libcouchbase/contrib/lcb-jsoncpp/lcb-jsoncpp.h +1961 -0
  111. data/ext/libcouchbase/contrib/snappy/CMakeLists.txt +7 -0
  112. data/ext/libcouchbase/contrib/snappy/COPYING +28 -0
  113. data/ext/libcouchbase/contrib/snappy/snappy-c.cc +90 -0
  114. data/ext/libcouchbase/contrib/snappy/snappy-c.h +138 -0
  115. data/ext/libcouchbase/contrib/snappy/snappy-internal.h +150 -0
  116. data/ext/libcouchbase/contrib/snappy/snappy-lcb-msvc.h +5 -0
  117. data/ext/libcouchbase/contrib/snappy/snappy-sinksource.cc +75 -0
  118. data/ext/libcouchbase/contrib/snappy/snappy-sinksource.h +137 -0
  119. data/ext/libcouchbase/contrib/snappy/snappy-stubs-internal.cc +42 -0
  120. data/ext/libcouchbase/contrib/snappy/snappy-stubs-internal.h +491 -0
  121. data/ext/libcouchbase/contrib/snappy/snappy-stubs-public.h +100 -0
  122. data/ext/libcouchbase/contrib/snappy/snappy.cc +1312 -0
  123. data/ext/libcouchbase/contrib/snappy/snappy.h +184 -0
  124. data/ext/libcouchbase/contrib/win32-defs/iocpdefs.h +133 -0
  125. data/ext/libcouchbase/contrib/win32-defs/mingwdefs.h +4396 -0
  126. data/ext/libcouchbase/contrib/win32-defs/win_stdint.h +258 -0
  127. data/ext/libcouchbase/doc/Doxyfile +2495 -0
  128. data/ext/libcouchbase/doc/DoxygenLayout.xml +109 -0
  129. data/ext/libcouchbase/doc/Makefile +44 -0
  130. data/ext/libcouchbase/doc/apiattr.h +117 -0
  131. data/ext/libcouchbase/doc/cbc-n1qlback.markdown +88 -0
  132. data/ext/libcouchbase/doc/cbc-pillowfight.markdown +296 -0
  133. data/ext/libcouchbase/doc/cbc-subdoc.markdown +299 -0
  134. data/ext/libcouchbase/doc/cbc.markdown +763 -0
  135. data/ext/libcouchbase/doc/cbcrc.markdown +52 -0
  136. data/ext/libcouchbase/doc/common-additional-options.markdown +82 -0
  137. data/ext/libcouchbase/doc/common-options.markdown +71 -0
  138. data/ext/libcouchbase/doc/environment.h +93 -0
  139. data/ext/libcouchbase/doc/example/threads.c +77 -0
  140. data/ext/libcouchbase/doc/footer.html +22 -0
  141. data/ext/libcouchbase/doc/genman.sh +25 -0
  142. data/ext/libcouchbase/doc/header.html +52 -0
  143. data/ext/libcouchbase/doc/intro.h +130 -0
  144. data/ext/libcouchbase/doc/mainpage.h +136 -0
  145. data/ext/libcouchbase/doc/man/cbc-admin.1 +1 -0
  146. data/ext/libcouchbase/doc/man/cbc-bucket-create.1 +1 -0
  147. data/ext/libcouchbase/doc/man/cbc-bucket-delete.1 +1 -0
  148. data/ext/libcouchbase/doc/man/cbc-cat.1 +1 -0
  149. data/ext/libcouchbase/doc/man/cbc-connstr.1 +1 -0
  150. data/ext/libcouchbase/doc/man/cbc-cp.1 +1 -0
  151. data/ext/libcouchbase/doc/man/cbc-create.1 +1 -0
  152. data/ext/libcouchbase/doc/man/cbc-decr.1 +1 -0
  153. data/ext/libcouchbase/doc/man/cbc-flush.1 +1 -0
  154. data/ext/libcouchbase/doc/man/cbc-hash.1 +1 -0
  155. data/ext/libcouchbase/doc/man/cbc-incr.1 +1 -0
  156. data/ext/libcouchbase/doc/man/cbc-lock.1 +1 -0
  157. data/ext/libcouchbase/doc/man/cbc-mcflush.1 +1 -0
  158. data/ext/libcouchbase/doc/man/cbc-mcversion.1 +1 -0
  159. data/ext/libcouchbase/doc/man/cbc-n1ql.1 +1 -0
  160. data/ext/libcouchbase/doc/man/cbc-n1qlback.1 +198 -0
  161. data/ext/libcouchbase/doc/man/cbc-observe.1 +1 -0
  162. data/ext/libcouchbase/doc/man/cbc-pillowfight.1 +499 -0
  163. data/ext/libcouchbase/doc/man/cbc-ping.1 +1 -0
  164. data/ext/libcouchbase/doc/man/cbc-rm.1 +1 -0
  165. data/ext/libcouchbase/doc/man/cbc-role-list.1 +1 -0
  166. data/ext/libcouchbase/doc/man/cbc-stats.1 +1 -0
  167. data/ext/libcouchbase/doc/man/cbc-subdoc.1 +494 -0
  168. data/ext/libcouchbase/doc/man/cbc-unlock.1 +1 -0
  169. data/ext/libcouchbase/doc/man/cbc-user-delete.1 +1 -0
  170. data/ext/libcouchbase/doc/man/cbc-user-list.1 +1 -0
  171. data/ext/libcouchbase/doc/man/cbc-user-upsert.1 +1 -0
  172. data/ext/libcouchbase/doc/man/cbc-verbosity.1 +1 -0
  173. data/ext/libcouchbase/doc/man/cbc-version.1 +1 -0
  174. data/ext/libcouchbase/doc/man/cbc-view.1 +1 -0
  175. data/ext/libcouchbase/doc/man/cbc-watch.1 +1 -0
  176. data/ext/libcouchbase/doc/man/cbc.1 +1035 -0
  177. data/ext/libcouchbase/doc/man/cbcrc.4 +71 -0
  178. data/ext/libcouchbase/doc/style.css +1162 -0
  179. data/ext/libcouchbase/example/CMakeLists.txt +52 -0
  180. data/ext/libcouchbase/example/README.markdown +47 -0
  181. data/ext/libcouchbase/example/analytics/.gitignore +1 -0
  182. data/ext/libcouchbase/example/analytics/analytics.c +158 -0
  183. data/ext/libcouchbase/example/analytics/build-queries.rb +34 -0
  184. data/ext/libcouchbase/example/analytics/cJSON.c +1 -0
  185. data/ext/libcouchbase/example/analytics/cJSON.h +1 -0
  186. data/ext/libcouchbase/example/analytics/queries/00-show-dataverse.json +5 -0
  187. data/ext/libcouchbase/example/analytics/queries/01-setup-dataset-breweries.json +6 -0
  188. data/ext/libcouchbase/example/analytics/queries/02-setup-dataset-beers.json +6 -0
  189. data/ext/libcouchbase/example/analytics/queries/03-initiate-shadow.json +6 -0
  190. data/ext/libcouchbase/example/analytics/queries/04-list-datasets.json +7 -0
  191. data/ext/libcouchbase/example/analytics/queries/05-count-breweries.json +5 -0
  192. data/ext/libcouchbase/example/analytics/queries/06-first-brewery.json +6 -0
  193. data/ext/libcouchbase/example/analytics/queries/07-key-based-lookup.json +6 -0
  194. data/ext/libcouchbase/example/analytics/queries/08-exact-match-lookup.json +7 -0
  195. data/ext/libcouchbase/example/analytics/queries/09-exact-match-lookup-different-shape.json +6 -0
  196. data/ext/libcouchbase/example/analytics/queries/10-other-query-filters.json +6 -0
  197. data/ext/libcouchbase/example/analytics/queries/11-equijoin.json +9 -0
  198. data/ext/libcouchbase/example/analytics/queries/12-equijoin-select-star.json +10 -0
  199. data/ext/libcouchbase/example/analytics/queries/13-ansi-join.json +8 -0
  200. data/ext/libcouchbase/example/analytics/queries/14-join-select-values.json +8 -0
  201. data/ext/libcouchbase/example/analytics/queries/15-nested-outer-join.json +7 -0
  202. data/ext/libcouchbase/example/analytics/queries/16-theta-join.json +8 -0
  203. data/ext/libcouchbase/example/analytics/queries/17-existential-quantification.json +9 -0
  204. data/ext/libcouchbase/example/analytics/queries/18-universal-quantification.json +7 -0
  205. data/ext/libcouchbase/example/analytics/queries/19-simple-aggregation.json +6 -0
  206. data/ext/libcouchbase/example/analytics/queries/20-simple-aggregation-unwrapped-value.json +6 -0
  207. data/ext/libcouchbase/example/analytics/queries/21-simple-aggregation-explicit.json +6 -0
  208. data/ext/libcouchbase/example/analytics/queries/22-grouping-and-aggregation.json +6 -0
  209. data/ext/libcouchbase/example/analytics/queries/23-grouping-and-aggregation-with-hint.json +7 -0
  210. data/ext/libcouchbase/example/analytics/queries/24-grouping-and-limits.json +7 -0
  211. data/ext/libcouchbase/example/analytics/queries/25-named-parameters.json +7 -0
  212. data/ext/libcouchbase/example/analytics/queries/26-positional-parameters.json +7 -0
  213. data/ext/libcouchbase/example/analytics/queries.h +113 -0
  214. data/ext/libcouchbase/example/crypto/.gitignore +2 -0
  215. data/ext/libcouchbase/example/crypto/Makefile +13 -0
  216. data/ext/libcouchbase/example/crypto/common_provider.c +26 -0
  217. data/ext/libcouchbase/example/crypto/common_provider.h +33 -0
  218. data/ext/libcouchbase/example/crypto/openssl_symmetric_decrypt.c +144 -0
  219. data/ext/libcouchbase/example/crypto/openssl_symmetric_encrypt.c +146 -0
  220. data/ext/libcouchbase/example/crypto/openssl_symmetric_provider.c +271 -0
  221. data/ext/libcouchbase/example/crypto/openssl_symmetric_provider.h +29 -0
  222. data/ext/libcouchbase/example/db/db.c +171 -0
  223. data/ext/libcouchbase/example/db/vb.c +227 -0
  224. data/ext/libcouchbase/example/fts/.gitignore +1 -0
  225. data/ext/libcouchbase/example/fts/build-queries.rb +33 -0
  226. data/ext/libcouchbase/example/fts/fts.c +142 -0
  227. data/ext/libcouchbase/example/fts/queries/00-simple-text-query.json +12 -0
  228. data/ext/libcouchbase/example/fts/queries/01-simple-text-query-on-non-default-index.json +9 -0
  229. data/ext/libcouchbase/example/fts/queries/02-simple-text-query-on-stored-field.json +13 -0
  230. data/ext/libcouchbase/example/fts/queries/03-match-query-with-facet.json +19 -0
  231. data/ext/libcouchbase/example/fts/queries/04-docid-query.json +11 -0
  232. data/ext/libcouchbase/example/fts/queries/05-unanalyzed-term-query-with-fuzziness-level-of-0.json +13 -0
  233. data/ext/libcouchbase/example/fts/queries/06-unanalyzed-term-query-with-fuzziness-level-of-2.json +14 -0
  234. data/ext/libcouchbase/example/fts/queries/07-match-phrase-query.json +13 -0
  235. data/ext/libcouchbase/example/fts/queries/08-phrase-query.json +16 -0
  236. data/ext/libcouchbase/example/fts/queries/09-query-string-query.json +9 -0
  237. data/ext/libcouchbase/example/fts/queries/10-conjunction-query.json +21 -0
  238. data/ext/libcouchbase/example/fts/queries/11-wild-card-query.json +13 -0
  239. data/ext/libcouchbase/example/fts/queries/12-numeric-range-query.json +11 -0
  240. data/ext/libcouchbase/example/fts/queries/13-regexp-query.json +13 -0
  241. data/ext/libcouchbase/example/fts/queries.h +61 -0
  242. data/ext/libcouchbase/example/instancepool/main.cc +112 -0
  243. data/ext/libcouchbase/example/instancepool/pool.cc +102 -0
  244. data/ext/libcouchbase/example/instancepool/pool.h +69 -0
  245. data/ext/libcouchbase/example/libeventdirect/main.c +222 -0
  246. data/ext/libcouchbase/example/mcc/mcc.cc +246 -0
  247. data/ext/libcouchbase/example/minimal/.gitignore +1 -0
  248. data/ext/libcouchbase/example/minimal/minimal.c +132 -0
  249. data/ext/libcouchbase/example/minimal/query.c +185 -0
  250. data/ext/libcouchbase/example/observe/durability.c +102 -0
  251. data/ext/libcouchbase/example/observe/observe.c +159 -0
  252. data/ext/libcouchbase/example/subdoc/subdoc-multi.cc +143 -0
  253. data/ext/libcouchbase/example/subdoc/subdoc-simple.cc +201 -0
  254. data/ext/libcouchbase/example/subdoc/subdoc-xattrs.c +286 -0
  255. data/ext/libcouchbase/example/tick/tick.c +119 -0
  256. data/ext/libcouchbase/example/tracing/.gitignore +2 -0
  257. data/ext/libcouchbase/example/tracing/Makefile +8 -0
  258. data/ext/libcouchbase/example/tracing/cJSON.c +1 -0
  259. data/ext/libcouchbase/example/tracing/cJSON.h +1 -0
  260. data/ext/libcouchbase/example/tracing/tracing.c +439 -0
  261. data/ext/libcouchbase/example/tracing/views.c +444 -0
  262. data/ext/libcouchbase/example/users/README +48 -0
  263. data/ext/libcouchbase/example/users/users.c +147 -0
  264. data/ext/libcouchbase/example/views/views-example.cc +83 -0
  265. data/ext/libcouchbase/include/libcouchbase/_cxxwrap.h +150 -0
  266. data/ext/libcouchbase/include/libcouchbase/api-legacy.h +1689 -0
  267. data/ext/libcouchbase/include/libcouchbase/api3.h +2 -0
  268. data/ext/libcouchbase/include/libcouchbase/assert.h +44 -0
  269. data/ext/libcouchbase/include/libcouchbase/auth.h +297 -0
  270. data/ext/libcouchbase/include/libcouchbase/cbft.h +151 -0
  271. data/ext/libcouchbase/include/libcouchbase/cntl-private.h +319 -0
  272. data/ext/libcouchbase/include/libcouchbase/cntl.h +1418 -0
  273. data/ext/libcouchbase/include/libcouchbase/configuration.h.in +29 -0
  274. data/ext/libcouchbase/include/libcouchbase/couchbase.h +4089 -0
  275. data/ext/libcouchbase/include/libcouchbase/crypto.h +306 -0
  276. data/ext/libcouchbase/include/libcouchbase/deprecated.h +312 -0
  277. data/ext/libcouchbase/include/libcouchbase/error.h +680 -0
  278. data/ext/libcouchbase/include/libcouchbase/http.h +1 -0
  279. data/ext/libcouchbase/include/libcouchbase/iops.h +1053 -0
  280. data/ext/libcouchbase/include/libcouchbase/ixmgmt.h +263 -0
  281. data/ext/libcouchbase/include/libcouchbase/kvbuf.h +137 -0
  282. data/ext/libcouchbase/include/libcouchbase/metrics.h +79 -0
  283. data/ext/libcouchbase/include/libcouchbase/n1ql.h +539 -0
  284. data/ext/libcouchbase/include/libcouchbase/pktfwd.h +270 -0
  285. data/ext/libcouchbase/include/libcouchbase/plugins/io/bsdio-inl.c +370 -0
  286. data/ext/libcouchbase/include/libcouchbase/plugins/io/wsaerr-inl.c +76 -0
  287. data/ext/libcouchbase/include/libcouchbase/plugins/io/wsaerr.h +199 -0
  288. data/ext/libcouchbase/include/libcouchbase/subdoc.h +347 -0
  289. data/ext/libcouchbase/include/libcouchbase/sysdefs.h +98 -0
  290. data/ext/libcouchbase/include/libcouchbase/tracing.h +437 -0
  291. data/ext/libcouchbase/include/libcouchbase/vbucket.h +680 -0
  292. data/ext/libcouchbase/include/libcouchbase/views.h +357 -0
  293. data/ext/libcouchbase/include/libcouchbase/visibility.h +66 -0
  294. data/ext/libcouchbase/include/memcached/COPYING +30 -0
  295. data/ext/libcouchbase/include/memcached/README +10 -0
  296. data/ext/libcouchbase/include/memcached/protocol_binary.h +885 -0
  297. data/ext/libcouchbase/packaging/README +7 -0
  298. data/ext/libcouchbase/packaging/abicheck/.gitignore +4 -0
  299. data/ext/libcouchbase/packaging/abicheck/Makefile +17 -0
  300. data/ext/libcouchbase/packaging/abicheck/README.md +27 -0
  301. data/ext/libcouchbase/packaging/abicheck/template.xml +3 -0
  302. data/ext/libcouchbase/packaging/deb/compat +1 -0
  303. data/ext/libcouchbase/packaging/deb/control +72 -0
  304. data/ext/libcouchbase/packaging/deb/copyright +10 -0
  305. data/ext/libcouchbase/packaging/deb/libcouchbase-dev.docs +3 -0
  306. data/ext/libcouchbase/packaging/deb/package.mk +31 -0
  307. data/ext/libcouchbase/packaging/deb/rules +46 -0
  308. data/ext/libcouchbase/packaging/deb/source/format +1 -0
  309. data/ext/libcouchbase/packaging/distinfo/README +1 -0
  310. data/ext/libcouchbase/packaging/distinfo/distinfo.cmake.in +4 -0
  311. data/ext/libcouchbase/packaging/dllversion.rc.in +39 -0
  312. data/ext/libcouchbase/packaging/libcouchbase.pc.in +10 -0
  313. data/ext/libcouchbase/packaging/nuget/libcouchbase.autopkg +76 -0
  314. data/ext/libcouchbase/packaging/parse-git-describe.pl +166 -0
  315. data/ext/libcouchbase/packaging/rpm/libcouchbase.spec.in +101 -0
  316. data/ext/libcouchbase/packaging/rpm/package.mk +40 -0
  317. data/ext/libcouchbase/plugins/io/iocp/CMakeLists.txt +9 -0
  318. data/ext/libcouchbase/plugins/io/iocp/iocp_iops.c +467 -0
  319. data/ext/libcouchbase/plugins/io/iocp/iocp_iops.h +217 -0
  320. data/ext/libcouchbase/plugins/io/iocp/iocp_loop.c +295 -0
  321. data/ext/libcouchbase/plugins/io/iocp/iocp_timer.c +79 -0
  322. data/ext/libcouchbase/plugins/io/iocp/iocp_util.c +229 -0
  323. data/ext/libcouchbase/plugins/io/libev/CMakeLists.txt +31 -0
  324. data/ext/libcouchbase/plugins/io/libev/libev_io_opts.h +66 -0
  325. data/ext/libcouchbase/plugins/io/libev/plugin-libev.c +289 -0
  326. data/ext/libcouchbase/plugins/io/libevent/CMakeLists.txt +31 -0
  327. data/ext/libcouchbase/plugins/io/libevent/libevent_io_opts.h +67 -0
  328. data/ext/libcouchbase/plugins/io/libevent/plugin-libevent.c +292 -0
  329. data/ext/libcouchbase/plugins/io/libuv/CMakeLists.txt +44 -0
  330. data/ext/libcouchbase/plugins/io/libuv/libuv_compat.h +218 -0
  331. data/ext/libcouchbase/plugins/io/libuv/libuv_io_opts.h +118 -0
  332. data/ext/libcouchbase/plugins/io/libuv/plugin-internal.h +155 -0
  333. data/ext/libcouchbase/plugins/io/libuv/plugin-libuv.c +709 -0
  334. data/ext/libcouchbase/plugins/io/select/CMakeLists.txt +13 -0
  335. data/ext/libcouchbase/plugins/io/select/plugin-select.c +451 -0
  336. data/ext/libcouchbase/plugins/io/select/select_io_opts.h +39 -0
  337. data/ext/libcouchbase/src/README.md +101 -0
  338. data/ext/libcouchbase/src/aspend.h +105 -0
  339. data/ext/libcouchbase/src/auth-priv.h +85 -0
  340. data/ext/libcouchbase/src/auth.cc +146 -0
  341. data/ext/libcouchbase/src/bootstrap.cc +263 -0
  342. data/ext/libcouchbase/src/bootstrap.h +149 -0
  343. data/ext/libcouchbase/src/bucketconfig/bc_cccp.cc +450 -0
  344. data/ext/libcouchbase/src/bucketconfig/bc_file.cc +281 -0
  345. data/ext/libcouchbase/src/bucketconfig/bc_http.cc +527 -0
  346. data/ext/libcouchbase/src/bucketconfig/bc_http.h +107 -0
  347. data/ext/libcouchbase/src/bucketconfig/bc_static.cc +150 -0
  348. data/ext/libcouchbase/src/bucketconfig/clconfig.h +700 -0
  349. data/ext/libcouchbase/src/bucketconfig/confmon.cc +403 -0
  350. data/ext/libcouchbase/src/callbacks.c +380 -0
  351. data/ext/libcouchbase/src/cbft.cc +253 -0
  352. data/ext/libcouchbase/src/cntl.cc +1057 -0
  353. data/ext/libcouchbase/src/config_static.h +176 -0
  354. data/ext/libcouchbase/src/connspec.cc +555 -0
  355. data/ext/libcouchbase/src/connspec.h +155 -0
  356. data/ext/libcouchbase/src/crypto.cc +399 -0
  357. data/ext/libcouchbase/src/ctx-log-inl.h +44 -0
  358. data/ext/libcouchbase/src/dns-srv.cc +146 -0
  359. data/ext/libcouchbase/src/dump.cc +103 -0
  360. data/ext/libcouchbase/src/errmap.cc +173 -0
  361. data/ext/libcouchbase/src/errmap.h +271 -0
  362. data/ext/libcouchbase/src/getconfig.cc +72 -0
  363. data/ext/libcouchbase/src/gethrtime.c +109 -0
  364. data/ext/libcouchbase/src/handler.cc +1101 -0
  365. data/ext/libcouchbase/src/hashtable.c +75 -0
  366. data/ext/libcouchbase/src/hdr_timings.c +92 -0
  367. data/ext/libcouchbase/src/hostlist.cc +293 -0
  368. data/ext/libcouchbase/src/hostlist.h +160 -0
  369. data/ext/libcouchbase/src/http/http-priv.h +326 -0
  370. data/ext/libcouchbase/src/http/http.cc +672 -0
  371. data/ext/libcouchbase/src/http/http.h +1 -0
  372. data/ext/libcouchbase/src/http/http_io.cc +316 -0
  373. data/ext/libcouchbase/src/instance.cc +917 -0
  374. data/ext/libcouchbase/src/internal.h +285 -0
  375. data/ext/libcouchbase/src/iofactory.c +575 -0
  376. data/ext/libcouchbase/src/jsparse/parser.cc +445 -0
  377. data/ext/libcouchbase/src/jsparse/parser.h +159 -0
  378. data/ext/libcouchbase/src/lcbht/lcbht.cc +177 -0
  379. data/ext/libcouchbase/src/lcbht/lcbht.h +210 -0
  380. data/ext/libcouchbase/src/lcbio/connect.cc +603 -0
  381. data/ext/libcouchbase/src/lcbio/connect.h +400 -0
  382. data/ext/libcouchbase/src/lcbio/ctx.c +658 -0
  383. data/ext/libcouchbase/src/lcbio/ctx.h +405 -0
  384. data/ext/libcouchbase/src/lcbio/iotable.c +290 -0
  385. data/ext/libcouchbase/src/lcbio/iotable.h +169 -0
  386. data/ext/libcouchbase/src/lcbio/ioutils.cc +356 -0
  387. data/ext/libcouchbase/src/lcbio/ioutils.h +144 -0
  388. data/ext/libcouchbase/src/lcbio/lcbio.h +51 -0
  389. data/ext/libcouchbase/src/lcbio/manager.cc +579 -0
  390. data/ext/libcouchbase/src/lcbio/manager.h +195 -0
  391. data/ext/libcouchbase/src/lcbio/protoctx.c +84 -0
  392. data/ext/libcouchbase/src/lcbio/rw-inl.h +137 -0
  393. data/ext/libcouchbase/src/lcbio/ssl.h +159 -0
  394. data/ext/libcouchbase/src/lcbio/timer-cxx.h +87 -0
  395. data/ext/libcouchbase/src/lcbio/timer-ng.h +179 -0
  396. data/ext/libcouchbase/src/lcbio/timer.c +132 -0
  397. data/ext/libcouchbase/src/legacy.c +431 -0
  398. data/ext/libcouchbase/src/list.c +144 -0
  399. data/ext/libcouchbase/src/list.h +127 -0
  400. data/ext/libcouchbase/src/logging.c +244 -0
  401. data/ext/libcouchbase/src/logging.h +88 -0
  402. data/ext/libcouchbase/src/mc/compress.cc +171 -0
  403. data/ext/libcouchbase/src/mc/compress.h +56 -0
  404. data/ext/libcouchbase/src/mc/forward.c +186 -0
  405. data/ext/libcouchbase/src/mc/forward.h +90 -0
  406. data/ext/libcouchbase/src/mc/iovcursor-inl.h +279 -0
  407. data/ext/libcouchbase/src/mc/iovcursor.h +66 -0
  408. data/ext/libcouchbase/src/mc/mcreq-flush-inl.h +115 -0
  409. data/ext/libcouchbase/src/mc/mcreq.c +983 -0
  410. data/ext/libcouchbase/src/mc/mcreq.h +1015 -0
  411. data/ext/libcouchbase/src/mcserver/mcserver.cc +1055 -0
  412. data/ext/libcouchbase/src/mcserver/mcserver.h +221 -0
  413. data/ext/libcouchbase/src/mcserver/negotiate.cc +757 -0
  414. data/ext/libcouchbase/src/mcserver/negotiate.h +128 -0
  415. data/ext/libcouchbase/src/mctx-helper.h +62 -0
  416. data/ext/libcouchbase/src/metrics.cc +132 -0
  417. data/ext/libcouchbase/src/n1ql/ixmgmt.cc +857 -0
  418. data/ext/libcouchbase/src/n1ql/n1ql-internal.h +22 -0
  419. data/ext/libcouchbase/src/n1ql/n1ql.cc +830 -0
  420. data/ext/libcouchbase/src/n1ql/params.cc +260 -0
  421. data/ext/libcouchbase/src/netbuf/netbuf-defs.h +89 -0
  422. data/ext/libcouchbase/src/netbuf/netbuf-mblock.h +235 -0
  423. data/ext/libcouchbase/src/netbuf/netbuf.c +929 -0
  424. data/ext/libcouchbase/src/netbuf/netbuf.h +452 -0
  425. data/ext/libcouchbase/src/newconfig.cc +365 -0
  426. data/ext/libcouchbase/src/nodeinfo.cc +184 -0
  427. data/ext/libcouchbase/src/operations/cbflush.cc +63 -0
  428. data/ext/libcouchbase/src/operations/counter.cc +117 -0
  429. data/ext/libcouchbase/src/operations/durability-cas.cc +251 -0
  430. data/ext/libcouchbase/src/operations/durability-seqno.cc +170 -0
  431. data/ext/libcouchbase/src/operations/durability.cc +668 -0
  432. data/ext/libcouchbase/src/operations/durability_internal.h +306 -0
  433. data/ext/libcouchbase/src/operations/get.cc +409 -0
  434. data/ext/libcouchbase/src/operations/observe-seqno.cc +94 -0
  435. data/ext/libcouchbase/src/operations/observe.cc +367 -0
  436. data/ext/libcouchbase/src/operations/ping.cc +496 -0
  437. data/ext/libcouchbase/src/operations/pktfwd.cc +86 -0
  438. data/ext/libcouchbase/src/operations/remove.cc +84 -0
  439. data/ext/libcouchbase/src/operations/stats.cc +459 -0
  440. data/ext/libcouchbase/src/operations/store.cc +358 -0
  441. data/ext/libcouchbase/src/operations/subdoc.cc +614 -0
  442. data/ext/libcouchbase/src/operations/touch.cc +84 -0
  443. data/ext/libcouchbase/src/packetutils.h +388 -0
  444. data/ext/libcouchbase/src/probes.d +182 -0
  445. data/ext/libcouchbase/src/rdb/bigalloc.c +225 -0
  446. data/ext/libcouchbase/src/rdb/bigalloc.h +73 -0
  447. data/ext/libcouchbase/src/rdb/chunkalloc.c +174 -0
  448. data/ext/libcouchbase/src/rdb/libcalloc.c +94 -0
  449. data/ext/libcouchbase/src/rdb/rope.c +419 -0
  450. data/ext/libcouchbase/src/rdb/rope.h +488 -0
  451. data/ext/libcouchbase/src/retrychk.cc +113 -0
  452. data/ext/libcouchbase/src/retryq.cc +458 -0
  453. data/ext/libcouchbase/src/retryq.h +170 -0
  454. data/ext/libcouchbase/src/ringbuffer.c +442 -0
  455. data/ext/libcouchbase/src/ringbuffer.h +100 -0
  456. data/ext/libcouchbase/src/rnd.cc +61 -0
  457. data/ext/libcouchbase/src/rnd.h +39 -0
  458. data/ext/libcouchbase/src/settings.c +125 -0
  459. data/ext/libcouchbase/src/settings.h +273 -0
  460. data/ext/libcouchbase/src/sllist-inl.h +197 -0
  461. data/ext/libcouchbase/src/sllist.h +76 -0
  462. data/ext/libcouchbase/src/ssl/CMakeLists.txt +11 -0
  463. data/ext/libcouchbase/src/ssl/ssl_c.c +442 -0
  464. data/ext/libcouchbase/src/ssl/ssl_common.c +478 -0
  465. data/ext/libcouchbase/src/ssl/ssl_e.c +421 -0
  466. data/ext/libcouchbase/src/ssl/ssl_iot_common.h +182 -0
  467. data/ext/libcouchbase/src/strcodecs/base64.c +307 -0
  468. data/ext/libcouchbase/src/strcodecs/strcodecs.h +302 -0
  469. data/ext/libcouchbase/src/timings.c +207 -0
  470. data/ext/libcouchbase/src/trace.h +117 -0
  471. data/ext/libcouchbase/src/tracing/span.cc +421 -0
  472. data/ext/libcouchbase/src/tracing/threshold_logging_tracer.cc +213 -0
  473. data/ext/libcouchbase/src/tracing/tracer.cc +53 -0
  474. data/ext/libcouchbase/src/tracing/tracing-internal.h +198 -0
  475. data/ext/libcouchbase/src/utilities.c +176 -0
  476. data/ext/libcouchbase/src/vbucket/CMakeLists.txt +2 -0
  477. data/ext/libcouchbase/src/vbucket/aliases.h +35 -0
  478. data/ext/libcouchbase/src/vbucket/crc32.h +83 -0
  479. data/ext/libcouchbase/src/vbucket/hash.h +30 -0
  480. data/ext/libcouchbase/src/vbucket/json-inl.h +112 -0
  481. data/ext/libcouchbase/src/vbucket/ketama.c +66 -0
  482. data/ext/libcouchbase/src/vbucket/rfc1321/global.h +32 -0
  483. data/ext/libcouchbase/src/vbucket/rfc1321/md5.h +35 -0
  484. data/ext/libcouchbase/src/vbucket/rfc1321/md5c-inl.h +335 -0
  485. data/ext/libcouchbase/src/vbucket/vbucket.c +1735 -0
  486. data/ext/libcouchbase/src/views/docreq.cc +213 -0
  487. data/ext/libcouchbase/src/views/docreq.h +94 -0
  488. data/ext/libcouchbase/src/views/viewreq.cc +381 -0
  489. data/ext/libcouchbase/src/views/viewreq.h +87 -0
  490. data/ext/libcouchbase/src/wait.cc +156 -0
  491. data/ext/libcouchbase/tests/CMakeLists.txt +149 -0
  492. data/ext/libcouchbase/tests/basic/t_base64.cc +109 -0
  493. data/ext/libcouchbase/tests/basic/t_ccbc103.cc +95 -0
  494. data/ext/libcouchbase/tests/basic/t_connstr.cc +456 -0
  495. data/ext/libcouchbase/tests/basic/t_creds.cc +96 -0
  496. data/ext/libcouchbase/tests/basic/t_ctlcodes.cc +92 -0
  497. data/ext/libcouchbase/tests/basic/t_host.cc +210 -0
  498. data/ext/libcouchbase/tests/basic/t_jsparse.cc +82 -0
  499. data/ext/libcouchbase/tests/basic/t_jsparse.h +589 -0
  500. data/ext/libcouchbase/tests/basic/t_list.cc +155 -0
  501. data/ext/libcouchbase/tests/basic/t_logger.cc +65 -0
  502. data/ext/libcouchbase/tests/basic/t_misc.cc +24 -0
  503. data/ext/libcouchbase/tests/basic/t_n1qlstrings.cc +17 -0
  504. data/ext/libcouchbase/tests/basic/t_netbuf.cc +446 -0
  505. data/ext/libcouchbase/tests/basic/t_packet.cc +215 -0
  506. data/ext/libcouchbase/tests/basic/t_ringbuffer.cc +278 -0
  507. data/ext/libcouchbase/tests/basic/t_scram.cc +514 -0
  508. data/ext/libcouchbase/tests/basic/t_slist.cc +429 -0
  509. data/ext/libcouchbase/tests/basic/t_strerror.cc +64 -0
  510. data/ext/libcouchbase/tests/basic/t_urlencode.cc +132 -0
  511. data/ext/libcouchbase/tests/check-all.cc +612 -0
  512. data/ext/libcouchbase/tests/htparse/t_basic.cc +173 -0
  513. data/ext/libcouchbase/tests/ioserver/connection.cc +166 -0
  514. data/ext/libcouchbase/tests/ioserver/future.cc +50 -0
  515. data/ext/libcouchbase/tests/ioserver/ioserver.cc +117 -0
  516. data/ext/libcouchbase/tests/ioserver/ioserver.h +478 -0
  517. data/ext/libcouchbase/tests/ioserver/socket.cc +88 -0
  518. data/ext/libcouchbase/tests/ioserver/ssl_connection.cc +145 -0
  519. data/ext/libcouchbase/tests/ioserver/threads-pthreads.cc +119 -0
  520. data/ext/libcouchbase/tests/ioserver/threads-win32.cc +117 -0
  521. data/ext/libcouchbase/tests/ioserver/threads.h +66 -0
  522. data/ext/libcouchbase/tests/iotests/iotests.h +15 -0
  523. data/ext/libcouchbase/tests/iotests/mock-environment.cc +632 -0
  524. data/ext/libcouchbase/tests/iotests/mock-environment.h +480 -0
  525. data/ext/libcouchbase/tests/iotests/mock-unit-test.cc +67 -0
  526. data/ext/libcouchbase/tests/iotests/mock-unit-test.h +61 -0
  527. data/ext/libcouchbase/tests/iotests/serverparams.h +76 -0
  528. data/ext/libcouchbase/tests/iotests/t_arithmetic.cc +143 -0
  529. data/ext/libcouchbase/tests/iotests/t_behavior.cc +220 -0
  530. data/ext/libcouchbase/tests/iotests/t_configcache.cc +117 -0
  531. data/ext/libcouchbase/tests/iotests/t_confmon.cc +223 -0
  532. data/ext/libcouchbase/tests/iotests/t_durability.cc +1108 -0
  533. data/ext/libcouchbase/tests/iotests/t_eerrs.cc +121 -0
  534. data/ext/libcouchbase/tests/iotests/t_errmap.cc +181 -0
  535. data/ext/libcouchbase/tests/iotests/t_forward.cc +118 -0
  536. data/ext/libcouchbase/tests/iotests/t_get.cc +512 -0
  537. data/ext/libcouchbase/tests/iotests/t_http.cc +438 -0
  538. data/ext/libcouchbase/tests/iotests/t_iops.cc +175 -0
  539. data/ext/libcouchbase/tests/iotests/t_lock.cc +274 -0
  540. data/ext/libcouchbase/tests/iotests/t_misc.cc +777 -0
  541. data/ext/libcouchbase/tests/iotests/t_mutate.cc +609 -0
  542. data/ext/libcouchbase/tests/iotests/t_n1ql.cc +270 -0
  543. data/ext/libcouchbase/tests/iotests/t_netfail.cc +778 -0
  544. data/ext/libcouchbase/tests/iotests/t_obseqno.cc +156 -0
  545. data/ext/libcouchbase/tests/iotests/t_regression.cc +321 -0
  546. data/ext/libcouchbase/tests/iotests/t_sched.cc +87 -0
  547. data/ext/libcouchbase/tests/iotests/t_serverops.cc +231 -0
  548. data/ext/libcouchbase/tests/iotests/t_smoke.cc +528 -0
  549. data/ext/libcouchbase/tests/iotests/t_snappy.cc +316 -0
  550. data/ext/libcouchbase/tests/iotests/t_subdoc.cc +857 -0
  551. data/ext/libcouchbase/tests/iotests/t_syncmode.cc +64 -0
  552. data/ext/libcouchbase/tests/iotests/t_views.cc +417 -0
  553. data/ext/libcouchbase/tests/iotests/testutil.cc +251 -0
  554. data/ext/libcouchbase/tests/iotests/testutil.h +163 -0
  555. data/ext/libcouchbase/tests/mc/mctest.h +119 -0
  556. data/ext/libcouchbase/tests/mc/pktmaker.h +101 -0
  557. data/ext/libcouchbase/tests/mc/t_alloc.cc +269 -0
  558. data/ext/libcouchbase/tests/mc/t_context.cc +100 -0
  559. data/ext/libcouchbase/tests/mc/t_flush.cc +185 -0
  560. data/ext/libcouchbase/tests/mc/t_forward.cc +239 -0
  561. data/ext/libcouchbase/tests/mc/t_ioflush.cc +102 -0
  562. data/ext/libcouchbase/tests/mc/t_iovcursor.cc +173 -0
  563. data/ext/libcouchbase/tests/mocksupport/procutil.c +305 -0
  564. data/ext/libcouchbase/tests/mocksupport/procutil.h +89 -0
  565. data/ext/libcouchbase/tests/mocksupport/server.c +391 -0
  566. data/ext/libcouchbase/tests/mocksupport/server.h +72 -0
  567. data/ext/libcouchbase/tests/mocksupport/timeout.c +69 -0
  568. data/ext/libcouchbase/tests/nonio_tests.cc +23 -0
  569. data/ext/libcouchbase/tests/rdb/rdbtest.h +133 -0
  570. data/ext/libcouchbase/tests/rdb/t_basic.cc +128 -0
  571. data/ext/libcouchbase/tests/rdb/t_bigalloc.cc +93 -0
  572. data/ext/libcouchbase/tests/rdb/t_refs.cc +112 -0
  573. data/ext/libcouchbase/tests/socktests/socktest.cc +344 -0
  574. data/ext/libcouchbase/tests/socktests/socktest.h +447 -0
  575. data/ext/libcouchbase/tests/socktests/t_basic.cc +143 -0
  576. data/ext/libcouchbase/tests/socktests/t_ctx.cc +73 -0
  577. data/ext/libcouchbase/tests/socktests/t_manager.cc +159 -0
  578. data/ext/libcouchbase/tests/socktests/t_putex.cc +256 -0
  579. data/ext/libcouchbase/tests/socktests/t_read.cc +187 -0
  580. data/ext/libcouchbase/tests/socktests/t_reentrant.cc +143 -0
  581. data/ext/libcouchbase/tests/socktests/t_ssl.cc +80 -0
  582. data/ext/libcouchbase/tests/socktests/t_write.cc +95 -0
  583. data/ext/libcouchbase/tests/start_mock.bat +15 -0
  584. data/ext/libcouchbase/tests/start_mock.sh +42 -0
  585. data/ext/libcouchbase/tests/unit_tests.cc +43 -0
  586. data/ext/libcouchbase/tests/vbucket/confdata/bad.json +101 -0
  587. data/ext/libcouchbase/tests/vbucket/confdata/full_25.json +363 -0
  588. data/ext/libcouchbase/tests/vbucket/confdata/ketama_expected.json +2562 -0
  589. data/ext/libcouchbase/tests/vbucket/confdata/map_node_present_nodesext_missing_nodes.json +94 -0
  590. data/ext/libcouchbase/tests/vbucket/confdata/memd_25.json +90 -0
  591. data/ext/libcouchbase/tests/vbucket/confdata/memd_30.json +1 -0
  592. data/ext/libcouchbase/tests/vbucket/confdata/memd_45.json +1 -0
  593. data/ext/libcouchbase/tests/vbucket/confdata/memd_ketama_config.json +31 -0
  594. data/ext/libcouchbase/tests/vbucket/confdata/terse_25.json +291 -0
  595. data/ext/libcouchbase/tests/vbucket/confdata/terse_30.json +1 -0
  596. data/ext/libcouchbase/tests/vbucket/t_config.cc +386 -0
  597. data/ext/libcouchbase/tools/CMakeLists.txt +80 -0
  598. data/ext/libcouchbase/tools/cbc-handlers.h +636 -0
  599. data/ext/libcouchbase/tools/cbc-n1qlback.cc +496 -0
  600. data/ext/libcouchbase/tools/cbc-pillowfight.cc +1230 -0
  601. data/ext/libcouchbase/tools/cbc-proxy.cc +534 -0
  602. data/ext/libcouchbase/tools/cbc-subdoc.cc +825 -0
  603. data/ext/libcouchbase/tools/cbc.cc +1928 -0
  604. data/ext/libcouchbase/tools/common/histogram.cc +44 -0
  605. data/ext/libcouchbase/tools/common/histogram.h +23 -0
  606. data/ext/libcouchbase/tools/common/options.cc +451 -0
  607. data/ext/libcouchbase/tools/common/options.h +90 -0
  608. data/ext/libcouchbase/tools/docgen/docgen.h +495 -0
  609. data/ext/libcouchbase/tools/docgen/loc.h +211 -0
  610. data/ext/libcouchbase/tools/docgen/placeholders.h +211 -0
  611. data/ext/libcouchbase/tools/docgen/seqgen.h +122 -0
  612. data/ext/libcouchbase/tools/extract-packets.rb +110 -0
  613. data/ext/libcouchbase/tools/linenoise/linenoise.c +1199 -0
  614. data/ext/libcouchbase/tools/linenoise/linenoise.h +73 -0
  615. data/lib/mt-libcouchbase/bucket.rb +825 -0
  616. data/lib/mt-libcouchbase/callbacks.rb +69 -0
  617. data/lib/mt-libcouchbase/connection.rb +896 -0
  618. data/lib/mt-libcouchbase/design_docs.rb +92 -0
  619. data/lib/mt-libcouchbase/error.rb +68 -0
  620. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdbase.rb +23 -0
  621. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdcounter.rb +36 -0
  622. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdendure.rb +26 -0
  623. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdfts.rb +24 -0
  624. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdget.rb +30 -0
  625. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdgetreplica.rb +49 -0
  626. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdhttp.rb +58 -0
  627. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdn1ql.rb +40 -0
  628. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdobseqno.rb +33 -0
  629. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdobserve.rb +30 -0
  630. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdstore.rb +40 -0
  631. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdstoredur.rb +45 -0
  632. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdsubdoc.rb +61 -0
  633. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdverbosity.rb +29 -0
  634. data/lib/mt-libcouchbase/ext/mt-libcouchbase/cmdviewquery.rb +61 -0
  635. data/lib/mt-libcouchbase/ext/mt-libcouchbase/contigbuf.rb +14 -0
  636. data/lib/mt-libcouchbase/ext/mt-libcouchbase/create_st.rb +15 -0
  637. data/lib/mt-libcouchbase/ext/mt-libcouchbase/create_st0.rb +23 -0
  638. data/lib/mt-libcouchbase/ext/mt-libcouchbase/create_st1.rb +26 -0
  639. data/lib/mt-libcouchbase/ext/mt-libcouchbase/create_st2.rb +32 -0
  640. data/lib/mt-libcouchbase/ext/mt-libcouchbase/create_st3.rb +26 -0
  641. data/lib/mt-libcouchbase/ext/mt-libcouchbase/crst_u.rb +20 -0
  642. data/lib/mt-libcouchbase/ext/mt-libcouchbase/durability_opts_st_v.rb +11 -0
  643. data/lib/mt-libcouchbase/ext/mt-libcouchbase/durability_opts_t.rb +14 -0
  644. data/lib/mt-libcouchbase/ext/mt-libcouchbase/durabilityopt_sv0.rb +63 -0
  645. data/lib/mt-libcouchbase/ext/mt-libcouchbase/enums.rb +1007 -0
  646. data/lib/mt-libcouchbase/ext/mt-libcouchbase/fragbuf.rb +18 -0
  647. data/lib/mt-libcouchbase/ext/mt-libcouchbase/ftshandle.rb +7 -0
  648. data/lib/mt-libcouchbase/ext/mt-libcouchbase/histogram.rb +34 -0
  649. data/lib/mt-libcouchbase/ext/mt-libcouchbase/http_request_t.rb +7 -0
  650. data/lib/mt-libcouchbase/ext/mt-libcouchbase/keybuf.rb +20 -0
  651. data/lib/mt-libcouchbase/ext/mt-libcouchbase/multicmd_ctx.rb +30 -0
  652. data/lib/mt-libcouchbase/ext/mt-libcouchbase/mutation_token.rb +17 -0
  653. data/lib/mt-libcouchbase/ext/mt-libcouchbase/n1qlhandle.rb +7 -0
  654. data/lib/mt-libcouchbase/ext/mt-libcouchbase/n1qlparams.rb +7 -0
  655. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respbase.rb +29 -0
  656. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respcounter.rb +32 -0
  657. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respendure.rb +49 -0
  658. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respfts.rb +40 -0
  659. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respget.rb +44 -0
  660. data/lib/mt-libcouchbase/ext/mt-libcouchbase/resphttp.rb +48 -0
  661. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respmcversion.rb +38 -0
  662. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respn1ql.rb +41 -0
  663. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respobseqno.rb +52 -0
  664. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respobserve.rb +41 -0
  665. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respserverbase.rb +32 -0
  666. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respstats.rb +38 -0
  667. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respstore.rb +32 -0
  668. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respstoredur.rb +38 -0
  669. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respsubdoc.rb +35 -0
  670. data/lib/mt-libcouchbase/ext/mt-libcouchbase/respviewquery.rb +67 -0
  671. data/lib/mt-libcouchbase/ext/mt-libcouchbase/sdentry.rb +22 -0
  672. data/lib/mt-libcouchbase/ext/mt-libcouchbase/sdspec.rb +31 -0
  673. data/lib/mt-libcouchbase/ext/mt-libcouchbase/t.rb +7 -0
  674. data/lib/mt-libcouchbase/ext/mt-libcouchbase/valbuf.rb +22 -0
  675. data/lib/mt-libcouchbase/ext/mt-libcouchbase/valbuf_u_buf.rb +14 -0
  676. data/lib/mt-libcouchbase/ext/mt-libcouchbase/viewhandle.rb +7 -0
  677. data/lib/mt-libcouchbase/ext/mt-libcouchbase.rb +1175 -0
  678. data/lib/mt-libcouchbase/ext/mt-libcouchbase_libuv.rb +22 -0
  679. data/lib/mt-libcouchbase/ext/tasks.rb +39 -0
  680. data/lib/mt-libcouchbase/n1ql.rb +80 -0
  681. data/lib/mt-libcouchbase/query_full_text.rb +147 -0
  682. data/lib/mt-libcouchbase/query_n1ql.rb +123 -0
  683. data/lib/mt-libcouchbase/query_view.rb +135 -0
  684. data/lib/mt-libcouchbase/results_fiber.rb +281 -0
  685. data/lib/mt-libcouchbase/results_native.rb +220 -0
  686. data/lib/mt-libcouchbase/subdoc_request.rb +139 -0
  687. data/lib/mt-libcouchbase/version.rb +5 -0
  688. data/lib/mt-libcouchbase.rb +40 -0
  689. data/mt-libcouchbase.gemspec +68 -0
  690. data/spec/bucket_spec.rb +290 -0
  691. data/spec/connection_spec.rb +257 -0
  692. data/spec/design_docs_spec.rb +31 -0
  693. data/spec/error_spec.rb +26 -0
  694. data/spec/fts_spec.rb +135 -0
  695. data/spec/n1ql_spec.rb +260 -0
  696. data/spec/results_libuv_spec.rb +244 -0
  697. data/spec/results_native_spec.rb +259 -0
  698. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/design.json +1 -0
  699. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/data-0000.cbb +0 -0
  700. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/failover.json +1 -0
  701. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/meta.json +1 -0
  702. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/seqno.json +1 -0
  703. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/snapshot_markers.json +1 -0
  704. data/spec/subdoc_spec.rb +192 -0
  705. data/spec/view_spec.rb +201 -0
  706. data/windows_build.md +36 -0
  707. metadata +873 -0
@@ -0,0 +1,855 @@
1
+ // Copyright 2007, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Author: wan@google.com (Zhanyong Wan)
31
+
32
+ // Google Test - The Google C++ Testing Framework
33
+ //
34
+ // This file implements a universal value printer that can print a
35
+ // value of any type T:
36
+ //
37
+ // void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
38
+ //
39
+ // A user can teach this function how to print a class type T by
40
+ // defining either operator<<() or PrintTo() in the namespace that
41
+ // defines T. More specifically, the FIRST defined function in the
42
+ // following list will be used (assuming T is defined in namespace
43
+ // foo):
44
+ //
45
+ // 1. foo::PrintTo(const T&, ostream*)
46
+ // 2. operator<<(ostream&, const T&) defined in either foo or the
47
+ // global namespace.
48
+ //
49
+ // If none of the above is defined, it will print the debug string of
50
+ // the value if it is a protocol buffer, or print the raw bytes in the
51
+ // value otherwise.
52
+ //
53
+ // To aid debugging: when T is a reference type, the address of the
54
+ // value is also printed; when T is a (const) char pointer, both the
55
+ // pointer value and the NUL-terminated string it points to are
56
+ // printed.
57
+ //
58
+ // We also provide some convenient wrappers:
59
+ //
60
+ // // Prints a value to a string. For a (const or not) char
61
+ // // pointer, the NUL-terminated string (but not the pointer) is
62
+ // // printed.
63
+ // std::string ::testing::PrintToString(const T& value);
64
+ //
65
+ // // Prints a value tersely: for a reference type, the referenced
66
+ // // value (but not the address) is printed; for a (const or not) char
67
+ // // pointer, the NUL-terminated string (but not the pointer) is
68
+ // // printed.
69
+ // void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
70
+ //
71
+ // // Prints value using the type inferred by the compiler. The difference
72
+ // // from UniversalTersePrint() is that this function prints both the
73
+ // // pointer and the NUL-terminated string for a (const or not) char pointer.
74
+ // void ::testing::internal::UniversalPrint(const T& value, ostream*);
75
+ //
76
+ // // Prints the fields of a tuple tersely to a string vector, one
77
+ // // element for each field. Tuple support must be enabled in
78
+ // // gtest-port.h.
79
+ // std::vector<string> UniversalTersePrintTupleFieldsToStrings(
80
+ // const Tuple& value);
81
+ //
82
+ // Known limitation:
83
+ //
84
+ // The print primitives print the elements of an STL-style container
85
+ // using the compiler-inferred type of *iter where iter is a
86
+ // const_iterator of the container. When const_iterator is an input
87
+ // iterator but not a forward iterator, this inferred type may not
88
+ // match value_type, and the print output may be incorrect. In
89
+ // practice, this is rarely a problem as for most containers
90
+ // const_iterator is a forward iterator. We'll fix this if there's an
91
+ // actual need for it. Note that this fix cannot rely on value_type
92
+ // being defined as many user-defined container types don't have
93
+ // value_type.
94
+
95
+ #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
96
+ #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_
97
+
98
+ #include <ostream> // NOLINT
99
+ #include <sstream>
100
+ #include <string>
101
+ #include <utility>
102
+ #include <vector>
103
+ #include "gtest/internal/gtest-port.h"
104
+ #include "gtest/internal/gtest-internal.h"
105
+
106
+ namespace testing {
107
+
108
+ // Definitions in the 'internal' and 'internal2' name spaces are
109
+ // subject to change without notice. DO NOT USE THEM IN USER CODE!
110
+ namespace internal2 {
111
+
112
+ // Prints the given number of bytes in the given object to the given
113
+ // ostream.
114
+ GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
115
+ size_t count,
116
+ ::std::ostream* os);
117
+
118
+ // For selecting which printer to use when a given type has neither <<
119
+ // nor PrintTo().
120
+ enum TypeKind {
121
+ kProtobuf, // a protobuf type
122
+ kConvertibleToInteger, // a type implicitly convertible to BiggestInt
123
+ // (e.g. a named or unnamed enum type)
124
+ kOtherType // anything else
125
+ };
126
+
127
+ // TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called
128
+ // by the universal printer to print a value of type T when neither
129
+ // operator<< nor PrintTo() is defined for T, where kTypeKind is the
130
+ // "kind" of T as defined by enum TypeKind.
131
+ template <typename T, TypeKind kTypeKind>
132
+ class TypeWithoutFormatter {
133
+ public:
134
+ // This default version is called when kTypeKind is kOtherType.
135
+ static void PrintValue(const T& value, ::std::ostream* os) {
136
+ PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value),
137
+ sizeof(value), os);
138
+ }
139
+ };
140
+
141
+ // We print a protobuf using its ShortDebugString() when the string
142
+ // doesn't exceed this many characters; otherwise we print it using
143
+ // DebugString() for better readability.
144
+ const size_t kProtobufOneLinerMaxLength = 50;
145
+
146
+ template <typename T>
147
+ class TypeWithoutFormatter<T, kProtobuf> {
148
+ public:
149
+ static void PrintValue(const T& value, ::std::ostream* os) {
150
+ const ::testing::internal::string short_str = value.ShortDebugString();
151
+ const ::testing::internal::string pretty_str =
152
+ short_str.length() <= kProtobufOneLinerMaxLength ?
153
+ short_str : ("\n" + value.DebugString());
154
+ *os << ("<" + pretty_str + ">");
155
+ }
156
+ };
157
+
158
+ template <typename T>
159
+ class TypeWithoutFormatter<T, kConvertibleToInteger> {
160
+ public:
161
+ // Since T has no << operator or PrintTo() but can be implicitly
162
+ // converted to BiggestInt, we print it as a BiggestInt.
163
+ //
164
+ // Most likely T is an enum type (either named or unnamed), in which
165
+ // case printing it as an integer is the desired behavior. In case
166
+ // T is not an enum, printing it as an integer is the best we can do
167
+ // given that it has no user-defined printer.
168
+ static void PrintValue(const T& value, ::std::ostream* os) {
169
+ const internal::BiggestInt kBigInt = value;
170
+ *os << kBigInt;
171
+ }
172
+ };
173
+
174
+ // Prints the given value to the given ostream. If the value is a
175
+ // protocol message, its debug string is printed; if it's an enum or
176
+ // of a type implicitly convertible to BiggestInt, it's printed as an
177
+ // integer; otherwise the bytes in the value are printed. This is
178
+ // what UniversalPrinter<T>::Print() does when it knows nothing about
179
+ // type T and T has neither << operator nor PrintTo().
180
+ //
181
+ // A user can override this behavior for a class type Foo by defining
182
+ // a << operator in the namespace where Foo is defined.
183
+ //
184
+ // We put this operator in namespace 'internal2' instead of 'internal'
185
+ // to simplify the implementation, as much code in 'internal' needs to
186
+ // use << in STL, which would conflict with our own << were it defined
187
+ // in 'internal'.
188
+ //
189
+ // Note that this operator<< takes a generic std::basic_ostream<Char,
190
+ // CharTraits> type instead of the more restricted std::ostream. If
191
+ // we define it to take an std::ostream instead, we'll get an
192
+ // "ambiguous overloads" compiler error when trying to print a type
193
+ // Foo that supports streaming to std::basic_ostream<Char,
194
+ // CharTraits>, as the compiler cannot tell whether
195
+ // operator<<(std::ostream&, const T&) or
196
+ // operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more
197
+ // specific.
198
+ template <typename Char, typename CharTraits, typename T>
199
+ ::std::basic_ostream<Char, CharTraits>& operator<<(
200
+ ::std::basic_ostream<Char, CharTraits>& os, const T& x) {
201
+ TypeWithoutFormatter<T,
202
+ (internal::IsAProtocolMessage<T>::value ? kProtobuf :
203
+ internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ?
204
+ kConvertibleToInteger : kOtherType)>::PrintValue(x, &os);
205
+ return os;
206
+ }
207
+
208
+ } // namespace internal2
209
+ } // namespace testing
210
+
211
+ // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up
212
+ // magic needed for implementing UniversalPrinter won't work.
213
+ namespace testing_internal {
214
+
215
+ // Used to print a value that is not an STL-style container when the
216
+ // user doesn't define PrintTo() for it.
217
+ template <typename T>
218
+ void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
219
+ // With the following statement, during unqualified name lookup,
220
+ // testing::internal2::operator<< appears as if it was declared in
221
+ // the nearest enclosing namespace that contains both
222
+ // ::testing_internal and ::testing::internal2, i.e. the global
223
+ // namespace. For more details, refer to the C++ Standard section
224
+ // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
225
+ // testing::internal2::operator<< in case T doesn't come with a <<
226
+ // operator.
227
+ //
228
+ // We cannot write 'using ::testing::internal2::operator<<;', which
229
+ // gcc 3.3 fails to compile due to a compiler bug.
230
+ using namespace ::testing::internal2; // NOLINT
231
+
232
+ // Assuming T is defined in namespace foo, in the next statement,
233
+ // the compiler will consider all of:
234
+ //
235
+ // 1. foo::operator<< (thanks to Koenig look-up),
236
+ // 2. ::operator<< (as the current namespace is enclosed in ::),
237
+ // 3. testing::internal2::operator<< (thanks to the using statement above).
238
+ //
239
+ // The operator<< whose type matches T best will be picked.
240
+ //
241
+ // We deliberately allow #2 to be a candidate, as sometimes it's
242
+ // impossible to define #1 (e.g. when foo is ::std, defining
243
+ // anything in it is undefined behavior unless you are a compiler
244
+ // vendor.).
245
+ *os << value;
246
+ }
247
+
248
+ } // namespace testing_internal
249
+
250
+ namespace testing {
251
+ namespace internal {
252
+
253
+ // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
254
+ // value to the given ostream. The caller must ensure that
255
+ // 'ostream_ptr' is not NULL, or the behavior is undefined.
256
+ //
257
+ // We define UniversalPrinter as a class template (as opposed to a
258
+ // function template), as we need to partially specialize it for
259
+ // reference types, which cannot be done with function templates.
260
+ template <typename T>
261
+ class UniversalPrinter;
262
+
263
+ template <typename T>
264
+ void UniversalPrint(const T& value, ::std::ostream* os);
265
+
266
+ // Used to print an STL-style container when the user doesn't define
267
+ // a PrintTo() for it.
268
+ template <typename C>
269
+ void DefaultPrintTo(IsContainer /* dummy */,
270
+ false_type /* is not a pointer */,
271
+ const C& container, ::std::ostream* os) {
272
+ const size_t kMaxCount = 32; // The maximum number of elements to print.
273
+ *os << '{';
274
+ size_t count = 0;
275
+ for (typename C::const_iterator it = container.begin();
276
+ it != container.end(); ++it, ++count) {
277
+ if (count > 0) {
278
+ *os << ',';
279
+ if (count == kMaxCount) { // Enough has been printed.
280
+ *os << " ...";
281
+ break;
282
+ }
283
+ }
284
+ *os << ' ';
285
+ // We cannot call PrintTo(*it, os) here as PrintTo() doesn't
286
+ // handle *it being a native array.
287
+ internal::UniversalPrint(*it, os);
288
+ }
289
+
290
+ if (count > 0) {
291
+ *os << ' ';
292
+ }
293
+ *os << '}';
294
+ }
295
+
296
+ // Used to print a pointer that is neither a char pointer nor a member
297
+ // pointer, when the user doesn't define PrintTo() for it. (A member
298
+ // variable pointer or member function pointer doesn't really point to
299
+ // a location in the address space. Their representation is
300
+ // implementation-defined. Therefore they will be printed as raw
301
+ // bytes.)
302
+ template <typename T>
303
+ void DefaultPrintTo(IsNotContainer /* dummy */,
304
+ true_type /* is a pointer */,
305
+ T* p, ::std::ostream* os) {
306
+ if (p == NULL) {
307
+ *os << "NULL";
308
+ } else {
309
+ // C++ doesn't allow casting from a function pointer to any object
310
+ // pointer.
311
+ //
312
+ // IsTrue() silences warnings: "Condition is always true",
313
+ // "unreachable code".
314
+ if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
315
+ // T is not a function type. We just call << to print p,
316
+ // relying on ADL to pick up user-defined << for their pointer
317
+ // types, if any.
318
+ *os << p;
319
+ } else {
320
+ // T is a function type, so '*os << p' doesn't do what we want
321
+ // (it just prints p as bool). We want to print p as a const
322
+ // void*. However, we cannot cast it to const void* directly,
323
+ // even using reinterpret_cast, as earlier versions of gcc
324
+ // (e.g. 3.4.5) cannot compile the cast when p is a function
325
+ // pointer. Casting to UInt64 first solves the problem.
326
+ *os << reinterpret_cast<const void*>(
327
+ reinterpret_cast<internal::UInt64>(p));
328
+ }
329
+ }
330
+ }
331
+
332
+ // Used to print a non-container, non-pointer value when the user
333
+ // doesn't define PrintTo() for it.
334
+ template <typename T>
335
+ void DefaultPrintTo(IsNotContainer /* dummy */,
336
+ false_type /* is not a pointer */,
337
+ const T& value, ::std::ostream* os) {
338
+ ::testing_internal::DefaultPrintNonContainerTo(value, os);
339
+ }
340
+
341
+ // Prints the given value using the << operator if it has one;
342
+ // otherwise prints the bytes in it. This is what
343
+ // UniversalPrinter<T>::Print() does when PrintTo() is not specialized
344
+ // or overloaded for type T.
345
+ //
346
+ // A user can override this behavior for a class type Foo by defining
347
+ // an overload of PrintTo() in the namespace where Foo is defined. We
348
+ // give the user this option as sometimes defining a << operator for
349
+ // Foo is not desirable (e.g. the coding style may prevent doing it,
350
+ // or there is already a << operator but it doesn't do what the user
351
+ // wants).
352
+ template <typename T>
353
+ void PrintTo(const T& value, ::std::ostream* os) {
354
+ // DefaultPrintTo() is overloaded. The type of its first two
355
+ // arguments determine which version will be picked. If T is an
356
+ // STL-style container, the version for container will be called; if
357
+ // T is a pointer, the pointer version will be called; otherwise the
358
+ // generic version will be called.
359
+ //
360
+ // Note that we check for container types here, prior to we check
361
+ // for protocol message types in our operator<<. The rationale is:
362
+ //
363
+ // For protocol messages, we want to give people a chance to
364
+ // override Google Mock's format by defining a PrintTo() or
365
+ // operator<<. For STL containers, other formats can be
366
+ // incompatible with Google Mock's format for the container
367
+ // elements; therefore we check for container types here to ensure
368
+ // that our format is used.
369
+ //
370
+ // The second argument of DefaultPrintTo() is needed to bypass a bug
371
+ // in Symbian's C++ compiler that prevents it from picking the right
372
+ // overload between:
373
+ //
374
+ // PrintTo(const T& x, ...);
375
+ // PrintTo(T* x, ...);
376
+ DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
377
+ }
378
+
379
+ // The following list of PrintTo() overloads tells
380
+ // UniversalPrinter<T>::Print() how to print standard types (built-in
381
+ // types, strings, plain arrays, and pointers).
382
+
383
+ // Overloads for various char types.
384
+ GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os);
385
+ GTEST_API_ void PrintTo(signed char c, ::std::ostream* os);
386
+ inline void PrintTo(char c, ::std::ostream* os) {
387
+ // When printing a plain char, we always treat it as unsigned. This
388
+ // way, the output won't be affected by whether the compiler thinks
389
+ // char is signed or not.
390
+ PrintTo(static_cast<unsigned char>(c), os);
391
+ }
392
+
393
+ // Overloads for other simple built-in types.
394
+ inline void PrintTo(bool x, ::std::ostream* os) {
395
+ *os << (x ? "true" : "false");
396
+ }
397
+
398
+ // Overload for wchar_t type.
399
+ // Prints a wchar_t as a symbol if it is printable or as its internal
400
+ // code otherwise and also as its decimal code (except for L'\0').
401
+ // The L'\0' char is printed as "L'\\0'". The decimal code is printed
402
+ // as signed integer when wchar_t is implemented by the compiler
403
+ // as a signed type and is printed as an unsigned integer when wchar_t
404
+ // is implemented as an unsigned type.
405
+ GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
406
+
407
+ // Overloads for C strings.
408
+ GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
409
+ inline void PrintTo(char* s, ::std::ostream* os) {
410
+ PrintTo(ImplicitCast_<const char*>(s), os);
411
+ }
412
+
413
+ // signed/unsigned char is often used for representing binary data, so
414
+ // we print pointers to it as void* to be safe.
415
+ inline void PrintTo(const signed char* s, ::std::ostream* os) {
416
+ PrintTo(ImplicitCast_<const void*>(s), os);
417
+ }
418
+ inline void PrintTo(signed char* s, ::std::ostream* os) {
419
+ PrintTo(ImplicitCast_<const void*>(s), os);
420
+ }
421
+ inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
422
+ PrintTo(ImplicitCast_<const void*>(s), os);
423
+ }
424
+ inline void PrintTo(unsigned char* s, ::std::ostream* os) {
425
+ PrintTo(ImplicitCast_<const void*>(s), os);
426
+ }
427
+
428
+ // MSVC can be configured to define wchar_t as a typedef of unsigned
429
+ // short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
430
+ // type. When wchar_t is a typedef, defining an overload for const
431
+ // wchar_t* would cause unsigned short* be printed as a wide string,
432
+ // possibly causing invalid memory accesses.
433
+ #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
434
+ // Overloads for wide C strings
435
+ GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os);
436
+ inline void PrintTo(wchar_t* s, ::std::ostream* os) {
437
+ PrintTo(ImplicitCast_<const wchar_t*>(s), os);
438
+ }
439
+ #endif
440
+
441
+ // Overload for C arrays. Multi-dimensional arrays are printed
442
+ // properly.
443
+
444
+ // Prints the given number of elements in an array, without printing
445
+ // the curly braces.
446
+ template <typename T>
447
+ void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
448
+ UniversalPrint(a[0], os);
449
+ for (size_t i = 1; i != count; i++) {
450
+ *os << ", ";
451
+ UniversalPrint(a[i], os);
452
+ }
453
+ }
454
+
455
+ // Overloads for ::string and ::std::string.
456
+ #if GTEST_HAS_GLOBAL_STRING
457
+ GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
458
+ inline void PrintTo(const ::string& s, ::std::ostream* os) {
459
+ PrintStringTo(s, os);
460
+ }
461
+ #endif // GTEST_HAS_GLOBAL_STRING
462
+
463
+ GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
464
+ inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
465
+ PrintStringTo(s, os);
466
+ }
467
+
468
+ // Overloads for ::wstring and ::std::wstring.
469
+ #if GTEST_HAS_GLOBAL_WSTRING
470
+ GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os);
471
+ inline void PrintTo(const ::wstring& s, ::std::ostream* os) {
472
+ PrintWideStringTo(s, os);
473
+ }
474
+ #endif // GTEST_HAS_GLOBAL_WSTRING
475
+
476
+ #if GTEST_HAS_STD_WSTRING
477
+ GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os);
478
+ inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
479
+ PrintWideStringTo(s, os);
480
+ }
481
+ #endif // GTEST_HAS_STD_WSTRING
482
+
483
+ #if GTEST_HAS_TR1_TUPLE
484
+ // Overload for ::std::tr1::tuple. Needed for printing function arguments,
485
+ // which are packed as tuples.
486
+
487
+ // Helper function for printing a tuple. T must be instantiated with
488
+ // a tuple type.
489
+ template <typename T>
490
+ void PrintTupleTo(const T& t, ::std::ostream* os);
491
+
492
+ // Overloaded PrintTo() for tuples of various arities. We support
493
+ // tuples of up-to 10 fields. The following implementation works
494
+ // regardless of whether tr1::tuple is implemented using the
495
+ // non-standard variadic template feature or not.
496
+
497
+ inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) {
498
+ PrintTupleTo(t, os);
499
+ }
500
+
501
+ template <typename T1>
502
+ void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) {
503
+ PrintTupleTo(t, os);
504
+ }
505
+
506
+ template <typename T1, typename T2>
507
+ void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) {
508
+ PrintTupleTo(t, os);
509
+ }
510
+
511
+ template <typename T1, typename T2, typename T3>
512
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) {
513
+ PrintTupleTo(t, os);
514
+ }
515
+
516
+ template <typename T1, typename T2, typename T3, typename T4>
517
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) {
518
+ PrintTupleTo(t, os);
519
+ }
520
+
521
+ template <typename T1, typename T2, typename T3, typename T4, typename T5>
522
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t,
523
+ ::std::ostream* os) {
524
+ PrintTupleTo(t, os);
525
+ }
526
+
527
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
528
+ typename T6>
529
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t,
530
+ ::std::ostream* os) {
531
+ PrintTupleTo(t, os);
532
+ }
533
+
534
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
535
+ typename T6, typename T7>
536
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t,
537
+ ::std::ostream* os) {
538
+ PrintTupleTo(t, os);
539
+ }
540
+
541
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
542
+ typename T6, typename T7, typename T8>
543
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t,
544
+ ::std::ostream* os) {
545
+ PrintTupleTo(t, os);
546
+ }
547
+
548
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
549
+ typename T6, typename T7, typename T8, typename T9>
550
+ void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t,
551
+ ::std::ostream* os) {
552
+ PrintTupleTo(t, os);
553
+ }
554
+
555
+ template <typename T1, typename T2, typename T3, typename T4, typename T5,
556
+ typename T6, typename T7, typename T8, typename T9, typename T10>
557
+ void PrintTo(
558
+ const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t,
559
+ ::std::ostream* os) {
560
+ PrintTupleTo(t, os);
561
+ }
562
+ #endif // GTEST_HAS_TR1_TUPLE
563
+
564
+ // Overload for std::pair.
565
+ template <typename T1, typename T2>
566
+ void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
567
+ *os << '(';
568
+ // We cannot use UniversalPrint(value.first, os) here, as T1 may be
569
+ // a reference type. The same for printing value.second.
570
+ UniversalPrinter<T1>::Print(value.first, os);
571
+ *os << ", ";
572
+ UniversalPrinter<T2>::Print(value.second, os);
573
+ *os << ')';
574
+ }
575
+
576
+ // Implements printing a non-reference type T by letting the compiler
577
+ // pick the right overload of PrintTo() for T.
578
+ template <typename T>
579
+ class UniversalPrinter {
580
+ public:
581
+ // MSVC warns about adding const to a function type, so we want to
582
+ // disable the warning.
583
+ #ifdef _MSC_VER
584
+ # pragma warning(push) // Saves the current warning state.
585
+ # pragma warning(disable:4180) // Temporarily disables warning 4180.
586
+ #endif // _MSC_VER
587
+
588
+ // Note: we deliberately don't call this PrintTo(), as that name
589
+ // conflicts with ::testing::internal::PrintTo in the body of the
590
+ // function.
591
+ static void Print(const T& value, ::std::ostream* os) {
592
+ // By default, ::testing::internal::PrintTo() is used for printing
593
+ // the value.
594
+ //
595
+ // Thanks to Koenig look-up, if T is a class and has its own
596
+ // PrintTo() function defined in its namespace, that function will
597
+ // be visible here. Since it is more specific than the generic ones
598
+ // in ::testing::internal, it will be picked by the compiler in the
599
+ // following statement - exactly what we want.
600
+ PrintTo(value, os);
601
+ }
602
+
603
+ #ifdef _MSC_VER
604
+ # pragma warning(pop) // Restores the warning state.
605
+ #endif // _MSC_VER
606
+ };
607
+
608
+ // UniversalPrintArray(begin, len, os) prints an array of 'len'
609
+ // elements, starting at address 'begin'.
610
+ template <typename T>
611
+ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
612
+ if (len == 0) {
613
+ *os << "{}";
614
+ } else {
615
+ *os << "{ ";
616
+ const size_t kThreshold = 18;
617
+ const size_t kChunkSize = 8;
618
+ // If the array has more than kThreshold elements, we'll have to
619
+ // omit some details by printing only the first and the last
620
+ // kChunkSize elements.
621
+ // TODO(wan@google.com): let the user control the threshold using a flag.
622
+ if (len <= kThreshold) {
623
+ PrintRawArrayTo(begin, len, os);
624
+ } else {
625
+ PrintRawArrayTo(begin, kChunkSize, os);
626
+ *os << ", ..., ";
627
+ PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
628
+ }
629
+ *os << " }";
630
+ }
631
+ }
632
+ // This overload prints a (const) char array compactly.
633
+ GTEST_API_ void UniversalPrintArray(
634
+ const char* begin, size_t len, ::std::ostream* os);
635
+
636
+ // This overload prints a (const) wchar_t array compactly.
637
+ GTEST_API_ void UniversalPrintArray(
638
+ const wchar_t* begin, size_t len, ::std::ostream* os);
639
+
640
+ // Implements printing an array type T[N].
641
+ template <typename T, size_t N>
642
+ class UniversalPrinter<T[N]> {
643
+ public:
644
+ // Prints the given array, omitting some elements when there are too
645
+ // many.
646
+ static void Print(const T (&a)[N], ::std::ostream* os) {
647
+ UniversalPrintArray(a, N, os);
648
+ }
649
+ };
650
+
651
+ // Implements printing a reference type T&.
652
+ template <typename T>
653
+ class UniversalPrinter<T&> {
654
+ public:
655
+ // MSVC warns about adding const to a function type, so we want to
656
+ // disable the warning.
657
+ #ifdef _MSC_VER
658
+ # pragma warning(push) // Saves the current warning state.
659
+ # pragma warning(disable:4180) // Temporarily disables warning 4180.
660
+ #endif // _MSC_VER
661
+
662
+ static void Print(const T& value, ::std::ostream* os) {
663
+ // Prints the address of the value. We use reinterpret_cast here
664
+ // as static_cast doesn't compile when T is a function type.
665
+ *os << "@" << reinterpret_cast<const void*>(&value) << " ";
666
+
667
+ // Then prints the value itself.
668
+ UniversalPrint(value, os);
669
+ }
670
+
671
+ #ifdef _MSC_VER
672
+ # pragma warning(pop) // Restores the warning state.
673
+ #endif // _MSC_VER
674
+ };
675
+
676
+ // Prints a value tersely: for a reference type, the referenced value
677
+ // (but not the address) is printed; for a (const) char pointer, the
678
+ // NUL-terminated string (but not the pointer) is printed.
679
+
680
+ template <typename T>
681
+ class UniversalTersePrinter {
682
+ public:
683
+ static void Print(const T& value, ::std::ostream* os) {
684
+ UniversalPrint(value, os);
685
+ }
686
+ };
687
+ template <typename T>
688
+ class UniversalTersePrinter<T&> {
689
+ public:
690
+ static void Print(const T& value, ::std::ostream* os) {
691
+ UniversalPrint(value, os);
692
+ }
693
+ };
694
+ template <typename T, size_t N>
695
+ class UniversalTersePrinter<T[N]> {
696
+ public:
697
+ static void Print(const T (&value)[N], ::std::ostream* os) {
698
+ UniversalPrinter<T[N]>::Print(value, os);
699
+ }
700
+ };
701
+ template <>
702
+ class UniversalTersePrinter<const char*> {
703
+ public:
704
+ static void Print(const char* str, ::std::ostream* os) {
705
+ if (str == NULL) {
706
+ *os << "NULL";
707
+ } else {
708
+ UniversalPrint(string(str), os);
709
+ }
710
+ }
711
+ };
712
+ template <>
713
+ class UniversalTersePrinter<char*> {
714
+ public:
715
+ static void Print(char* str, ::std::ostream* os) {
716
+ UniversalTersePrinter<const char*>::Print(str, os);
717
+ }
718
+ };
719
+
720
+ #if GTEST_HAS_STD_WSTRING
721
+ template <>
722
+ class UniversalTersePrinter<const wchar_t*> {
723
+ public:
724
+ static void Print(const wchar_t* str, ::std::ostream* os) {
725
+ if (str == NULL) {
726
+ *os << "NULL";
727
+ } else {
728
+ UniversalPrint(::std::wstring(str), os);
729
+ }
730
+ }
731
+ };
732
+ #endif
733
+
734
+ template <>
735
+ class UniversalTersePrinter<wchar_t*> {
736
+ public:
737
+ static void Print(wchar_t* str, ::std::ostream* os) {
738
+ UniversalTersePrinter<const wchar_t*>::Print(str, os);
739
+ }
740
+ };
741
+
742
+ template <typename T>
743
+ void UniversalTersePrint(const T& value, ::std::ostream* os) {
744
+ UniversalTersePrinter<T>::Print(value, os);
745
+ }
746
+
747
+ // Prints a value using the type inferred by the compiler. The
748
+ // difference between this and UniversalTersePrint() is that for a
749
+ // (const) char pointer, this prints both the pointer and the
750
+ // NUL-terminated string.
751
+ template <typename T>
752
+ void UniversalPrint(const T& value, ::std::ostream* os) {
753
+ // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
754
+ // UniversalPrinter with T directly.
755
+ typedef T T1;
756
+ UniversalPrinter<T1>::Print(value, os);
757
+ }
758
+
759
+ #if GTEST_HAS_TR1_TUPLE
760
+ typedef ::std::vector<string> Strings;
761
+
762
+ // This helper template allows PrintTo() for tuples and
763
+ // UniversalTersePrintTupleFieldsToStrings() to be defined by
764
+ // induction on the number of tuple fields. The idea is that
765
+ // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N
766
+ // fields in tuple t, and can be defined in terms of
767
+ // TuplePrefixPrinter<N - 1>.
768
+
769
+ // The inductive case.
770
+ template <size_t N>
771
+ struct TuplePrefixPrinter {
772
+ // Prints the first N fields of a tuple.
773
+ template <typename Tuple>
774
+ static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
775
+ TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os);
776
+ *os << ", ";
777
+ UniversalPrinter<typename ::std::tr1::tuple_element<N - 1, Tuple>::type>
778
+ ::Print(::std::tr1::get<N - 1>(t), os);
779
+ }
780
+
781
+ // Tersely prints the first N fields of a tuple to a string vector,
782
+ // one element for each field.
783
+ template <typename Tuple>
784
+ static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
785
+ TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings);
786
+ ::std::stringstream ss;
787
+ UniversalTersePrint(::std::tr1::get<N - 1>(t), &ss);
788
+ strings->push_back(ss.str());
789
+ }
790
+ };
791
+
792
+ // Base cases.
793
+ template <>
794
+ struct TuplePrefixPrinter<0> {
795
+ template <typename Tuple>
796
+ static void PrintPrefixTo(const Tuple&, ::std::ostream*) {}
797
+
798
+ template <typename Tuple>
799
+ static void TersePrintPrefixToStrings(const Tuple&, Strings*) {}
800
+ };
801
+ // We have to specialize the entire TuplePrefixPrinter<> class
802
+ // template here, even though the definition of
803
+ // TersePrintPrefixToStrings() is the same as the generic version, as
804
+ // Embarcadero (formerly CodeGear, formerly Borland) C++ doesn't
805
+ // support specializing a method template of a class template.
806
+ template <>
807
+ struct TuplePrefixPrinter<1> {
808
+ template <typename Tuple>
809
+ static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) {
810
+ UniversalPrinter<typename ::std::tr1::tuple_element<0, Tuple>::type>::
811
+ Print(::std::tr1::get<0>(t), os);
812
+ }
813
+
814
+ template <typename Tuple>
815
+ static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) {
816
+ ::std::stringstream ss;
817
+ UniversalTersePrint(::std::tr1::get<0>(t), &ss);
818
+ strings->push_back(ss.str());
819
+ }
820
+ };
821
+
822
+ // Helper function for printing a tuple. T must be instantiated with
823
+ // a tuple type.
824
+ template <typename T>
825
+ void PrintTupleTo(const T& t, ::std::ostream* os) {
826
+ *os << "(";
827
+ TuplePrefixPrinter< ::std::tr1::tuple_size<T>::value>::
828
+ PrintPrefixTo(t, os);
829
+ *os << ")";
830
+ }
831
+
832
+ // Prints the fields of a tuple tersely to a string vector, one
833
+ // element for each field. See the comment before
834
+ // UniversalTersePrint() for how we define "tersely".
835
+ template <typename Tuple>
836
+ Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
837
+ Strings result;
838
+ TuplePrefixPrinter< ::std::tr1::tuple_size<Tuple>::value>::
839
+ TersePrintPrefixToStrings(value, &result);
840
+ return result;
841
+ }
842
+ #endif // GTEST_HAS_TR1_TUPLE
843
+
844
+ } // namespace internal
845
+
846
+ template <typename T>
847
+ ::std::string PrintToString(const T& value) {
848
+ ::std::stringstream ss;
849
+ internal::UniversalTersePrinter<T>::Print(value, &ss);
850
+ return ss.str();
851
+ }
852
+
853
+ } // namespace testing
854
+
855
+ #endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_