cppjieba_rb 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +3 -0
  3. data/README.md +1 -1
  4. data/Rakefile +2 -2
  5. data/cppjieba_rb.gemspec +4 -4
  6. data/lib/cppjieba_rb/version.rb +1 -1
  7. metadata +17 -135
  8. data/ext/cppjieba/.gitignore +0 -17
  9. data/ext/cppjieba/.travis.yml +0 -21
  10. data/ext/cppjieba/CMakeLists.txt +0 -28
  11. data/ext/cppjieba/ChangeLog.md +0 -236
  12. data/ext/cppjieba/README.md +0 -292
  13. data/ext/cppjieba/README_EN.md +0 -113
  14. data/ext/cppjieba/appveyor.yml +0 -32
  15. data/ext/cppjieba/deps/CMakeLists.txt +0 -1
  16. data/ext/cppjieba/deps/gtest/CMakeLists.txt +0 -5
  17. data/ext/cppjieba/deps/gtest/include/gtest/gtest-death-test.h +0 -283
  18. data/ext/cppjieba/deps/gtest/include/gtest/gtest-message.h +0 -230
  19. data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h +0 -1421
  20. data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h.pump +0 -487
  21. data/ext/cppjieba/deps/gtest/include/gtest/gtest-printers.h +0 -796
  22. data/ext/cppjieba/deps/gtest/include/gtest/gtest-spi.h +0 -232
  23. data/ext/cppjieba/deps/gtest/include/gtest/gtest-test-part.h +0 -176
  24. data/ext/cppjieba/deps/gtest/include/gtest/gtest-typed-test.h +0 -259
  25. data/ext/cppjieba/deps/gtest/include/gtest/gtest.h +0 -2155
  26. data/ext/cppjieba/deps/gtest/include/gtest/gtest_pred_impl.h +0 -358
  27. data/ext/cppjieba/deps/gtest/include/gtest/gtest_prod.h +0 -58
  28. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-death-test-internal.h +0 -308
  29. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-filepath.h +0 -210
  30. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-internal.h +0 -1226
  31. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-linked_ptr.h +0 -233
  32. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h +0 -4822
  33. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -301
  34. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util.h +0 -619
  35. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-port.h +0 -1788
  36. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-string.h +0 -350
  37. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h +0 -968
  38. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h.pump +0 -336
  39. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h +0 -3330
  40. data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h.pump +0 -296
  41. data/ext/cppjieba/deps/gtest/src/.deps/.dirstamp +0 -0
  42. data/ext/cppjieba/deps/gtest/src/.deps/gtest-all.Plo +0 -681
  43. data/ext/cppjieba/deps/gtest/src/.deps/gtest_main.Plo +0 -509
  44. data/ext/cppjieba/deps/gtest/src/.dirstamp +0 -0
  45. data/ext/cppjieba/deps/gtest/src/gtest-all.cc +0 -48
  46. data/ext/cppjieba/deps/gtest/src/gtest-death-test.cc +0 -1234
  47. data/ext/cppjieba/deps/gtest/src/gtest-filepath.cc +0 -380
  48. data/ext/cppjieba/deps/gtest/src/gtest-internal-inl.h +0 -1038
  49. data/ext/cppjieba/deps/gtest/src/gtest-port.cc +0 -746
  50. data/ext/cppjieba/deps/gtest/src/gtest-printers.cc +0 -356
  51. data/ext/cppjieba/deps/gtest/src/gtest-test-part.cc +0 -110
  52. data/ext/cppjieba/deps/gtest/src/gtest-typed-test.cc +0 -110
  53. data/ext/cppjieba/deps/gtest/src/gtest.cc +0 -4898
  54. data/ext/cppjieba/deps/gtest/src/gtest_main.cc +0 -39
  55. data/ext/cppjieba/deps/limonp/ArgvContext.hpp +0 -70
  56. data/ext/cppjieba/deps/limonp/BlockingQueue.hpp +0 -49
  57. data/ext/cppjieba/deps/limonp/BoundedBlockingQueue.hpp +0 -67
  58. data/ext/cppjieba/deps/limonp/BoundedQueue.hpp +0 -65
  59. data/ext/cppjieba/deps/limonp/Closure.hpp +0 -206
  60. data/ext/cppjieba/deps/limonp/Colors.hpp +0 -31
  61. data/ext/cppjieba/deps/limonp/Condition.hpp +0 -38
  62. data/ext/cppjieba/deps/limonp/Config.hpp +0 -103
  63. data/ext/cppjieba/deps/limonp/FileLock.hpp +0 -74
  64. data/ext/cppjieba/deps/limonp/ForcePublic.hpp +0 -7
  65. data/ext/cppjieba/deps/limonp/LocalVector.hpp +0 -139
  66. data/ext/cppjieba/deps/limonp/Logging.hpp +0 -76
  67. data/ext/cppjieba/deps/limonp/Md5.hpp +0 -411
  68. data/ext/cppjieba/deps/limonp/MutexLock.hpp +0 -51
  69. data/ext/cppjieba/deps/limonp/NonCopyable.hpp +0 -21
  70. data/ext/cppjieba/deps/limonp/StdExtension.hpp +0 -159
  71. data/ext/cppjieba/deps/limonp/StringUtil.hpp +0 -365
  72. data/ext/cppjieba/deps/limonp/Thread.hpp +0 -44
  73. data/ext/cppjieba/deps/limonp/ThreadPool.hpp +0 -86
  74. data/ext/cppjieba/dict/README.md +0 -31
  75. data/ext/cppjieba/dict/hmm_model.utf8 +0 -34
  76. data/ext/cppjieba/dict/idf.utf8 +0 -258826
  77. data/ext/cppjieba/dict/jieba.dict.utf8 +0 -348982
  78. data/ext/cppjieba/dict/pos_dict/char_state_tab.utf8 +0 -6653
  79. data/ext/cppjieba/dict/pos_dict/prob_emit.utf8 +0 -166
  80. data/ext/cppjieba/dict/pos_dict/prob_start.utf8 +0 -259
  81. data/ext/cppjieba/dict/pos_dict/prob_trans.utf8 +0 -5222
  82. data/ext/cppjieba/dict/stop_words.utf8 +0 -1534
  83. data/ext/cppjieba/dict/user.dict.utf8 +0 -4
  84. data/ext/cppjieba/include/cppjieba/DictTrie.hpp +0 -277
  85. data/ext/cppjieba/include/cppjieba/FullSegment.hpp +0 -93
  86. data/ext/cppjieba/include/cppjieba/HMMModel.hpp +0 -129
  87. data/ext/cppjieba/include/cppjieba/HMMSegment.hpp +0 -190
  88. data/ext/cppjieba/include/cppjieba/Jieba.hpp +0 -130
  89. data/ext/cppjieba/include/cppjieba/KeywordExtractor.hpp +0 -153
  90. data/ext/cppjieba/include/cppjieba/MPSegment.hpp +0 -137
  91. data/ext/cppjieba/include/cppjieba/MixSegment.hpp +0 -109
  92. data/ext/cppjieba/include/cppjieba/PosTagger.hpp +0 -77
  93. data/ext/cppjieba/include/cppjieba/PreFilter.hpp +0 -54
  94. data/ext/cppjieba/include/cppjieba/QuerySegment.hpp +0 -90
  95. data/ext/cppjieba/include/cppjieba/SegmentBase.hpp +0 -46
  96. data/ext/cppjieba/include/cppjieba/SegmentTagged.hpp +0 -23
  97. data/ext/cppjieba/include/cppjieba/TextRankExtractor.hpp +0 -190
  98. data/ext/cppjieba/include/cppjieba/Trie.hpp +0 -174
  99. data/ext/cppjieba/include/cppjieba/Unicode.hpp +0 -227
  100. data/ext/cppjieba/test/CMakeLists.txt +0 -5
  101. data/ext/cppjieba/test/demo.cpp +0 -80
  102. data/ext/cppjieba/test/load_test.cpp +0 -54
  103. data/ext/cppjieba/test/testdata/curl.res +0 -1
  104. data/ext/cppjieba/test/testdata/extra_dict/jieba.dict.small.utf8 +0 -109750
  105. data/ext/cppjieba/test/testdata/gbk_dict/hmm_model.gbk +0 -34
  106. data/ext/cppjieba/test/testdata/gbk_dict/jieba.dict.gbk +0 -348982
  107. data/ext/cppjieba/test/testdata/jieba.dict.0.1.utf8 +0 -93
  108. data/ext/cppjieba/test/testdata/jieba.dict.0.utf8 +0 -93
  109. data/ext/cppjieba/test/testdata/jieba.dict.1.utf8 +0 -67
  110. data/ext/cppjieba/test/testdata/jieba.dict.2.utf8 +0 -64
  111. data/ext/cppjieba/test/testdata/load_test.urls +0 -2
  112. data/ext/cppjieba/test/testdata/review.100 +0 -100
  113. data/ext/cppjieba/test/testdata/review.100.res +0 -200
  114. data/ext/cppjieba/test/testdata/server.conf +0 -19
  115. data/ext/cppjieba/test/testdata/testlines.gbk +0 -9
  116. data/ext/cppjieba/test/testdata/testlines.utf8 +0 -8
  117. data/ext/cppjieba/test/testdata/userdict.2.utf8 +0 -1
  118. data/ext/cppjieba/test/testdata/userdict.english +0 -2
  119. data/ext/cppjieba/test/testdata/userdict.utf8 +0 -8
  120. data/ext/cppjieba/test/testdata/weicheng.utf8 +0 -247
  121. data/ext/cppjieba/test/unittest/CMakeLists.txt +0 -24
  122. data/ext/cppjieba/test/unittest/gtest_main.cpp +0 -39
  123. data/ext/cppjieba/test/unittest/jieba_test.cpp +0 -133
  124. data/ext/cppjieba/test/unittest/keyword_extractor_test.cpp +0 -79
  125. data/ext/cppjieba/test/unittest/pos_tagger_test.cpp +0 -41
  126. data/ext/cppjieba/test/unittest/pre_filter_test.cpp +0 -43
  127. data/ext/cppjieba/test/unittest/segments_test.cpp +0 -256
  128. data/ext/cppjieba/test/unittest/textrank_test.cpp +0 -86
  129. data/ext/cppjieba/test/unittest/trie_test.cpp +0 -177
  130. data/ext/cppjieba/test/unittest/unicode_test.cpp +0 -43
@@ -1,350 +0,0 @@
1
- // Copyright 2005, 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
- // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
31
- //
32
- // The Google C++ Testing Framework (Google Test)
33
- //
34
- // This header file declares the String class and functions used internally by
35
- // Google Test. They are subject to change without notice. They should not used
36
- // by code external to Google Test.
37
- //
38
- // This header file is #included by <gtest/internal/gtest-internal.h>.
39
- // It should not be #included by other files.
40
-
41
- #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
42
- #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
43
-
44
- #ifdef __BORLANDC__
45
- // string.h is not guaranteed to provide strcpy on C++ Builder.
46
- # include <mem.h>
47
- #endif
48
-
49
- #include <string.h>
50
- #include "gtest/internal/gtest-port.h"
51
-
52
- #include <string>
53
-
54
- namespace testing {
55
- namespace internal {
56
-
57
- // String - a UTF-8 string class.
58
- //
59
- // For historic reasons, we don't use std::string.
60
- //
61
- // TODO(wan@google.com): replace this class with std::string or
62
- // implement it in terms of the latter.
63
- //
64
- // Note that String can represent both NULL and the empty string,
65
- // while std::string cannot represent NULL.
66
- //
67
- // NULL and the empty string are considered different. NULL is less
68
- // than anything (including the empty string) except itself.
69
- //
70
- // This class only provides minimum functionality necessary for
71
- // implementing Google Test. We do not intend to implement a full-fledged
72
- // string class here.
73
- //
74
- // Since the purpose of this class is to provide a substitute for
75
- // std::string on platforms where it cannot be used, we define a copy
76
- // constructor and assignment operators such that we don't need
77
- // conditional compilation in a lot of places.
78
- //
79
- // In order to make the representation efficient, the d'tor of String
80
- // is not virtual. Therefore DO NOT INHERIT FROM String.
81
- class GTEST_API_ String {
82
- public:
83
- // Static utility methods
84
-
85
- // Returns the input enclosed in double quotes if it's not NULL;
86
- // otherwise returns "(null)". For example, "\"Hello\"" is returned
87
- // for input "Hello".
88
- //
89
- // This is useful for printing a C string in the syntax of a literal.
90
- //
91
- // Known issue: escape sequences are not handled yet.
92
- static String ShowCStringQuoted(const char* c_str);
93
-
94
- // Clones a 0-terminated C string, allocating memory using new. The
95
- // caller is responsible for deleting the return value using
96
- // delete[]. Returns the cloned string, or NULL if the input is
97
- // NULL.
98
- //
99
- // This is different from strdup() in string.h, which allocates
100
- // memory using malloc().
101
- static const char* CloneCString(const char* c_str);
102
-
103
- #if GTEST_OS_WINDOWS_MOBILE
104
- // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
105
- // able to pass strings to Win32 APIs on CE we need to convert them
106
- // to 'Unicode', UTF-16.
107
-
108
- // Creates a UTF-16 wide string from the given ANSI string, allocating
109
- // memory using new. The caller is responsible for deleting the return
110
- // value using delete[]. Returns the wide string, or NULL if the
111
- // input is NULL.
112
- //
113
- // The wide string is created using the ANSI codepage (CP_ACP) to
114
- // match the behaviour of the ANSI versions of Win32 calls and the
115
- // C runtime.
116
- static LPCWSTR AnsiToUtf16(const char* c_str);
117
-
118
- // Creates an ANSI string from the given wide string, allocating
119
- // memory using new. The caller is responsible for deleting the return
120
- // value using delete[]. Returns the ANSI string, or NULL if the
121
- // input is NULL.
122
- //
123
- // The returned string is created using the ANSI codepage (CP_ACP) to
124
- // match the behaviour of the ANSI versions of Win32 calls and the
125
- // C runtime.
126
- static const char* Utf16ToAnsi(LPCWSTR utf16_str);
127
- #endif
128
-
129
- // Compares two C strings. Returns true iff they have the same content.
130
- //
131
- // Unlike strcmp(), this function can handle NULL argument(s). A
132
- // NULL C string is considered different to any non-NULL C string,
133
- // including the empty string.
134
- static bool CStringEquals(const char* lhs, const char* rhs);
135
-
136
- // Converts a wide C string to a String using the UTF-8 encoding.
137
- // NULL will be converted to "(null)". If an error occurred during
138
- // the conversion, "(failed to convert from wide string)" is
139
- // returned.
140
- static String ShowWideCString(const wchar_t* wide_c_str);
141
-
142
- // Similar to ShowWideCString(), except that this function encloses
143
- // the converted string in double quotes.
144
- static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
145
-
146
- // Compares two wide C strings. Returns true iff they have the same
147
- // content.
148
- //
149
- // Unlike wcscmp(), this function can handle NULL argument(s). A
150
- // NULL C string is considered different to any non-NULL C string,
151
- // including the empty string.
152
- static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
153
-
154
- // Compares two C strings, ignoring case. Returns true iff they
155
- // have the same content.
156
- //
157
- // Unlike strcasecmp(), this function can handle NULL argument(s).
158
- // A NULL C string is considered different to any non-NULL C string,
159
- // including the empty string.
160
- static bool CaseInsensitiveCStringEquals(const char* lhs,
161
- const char* rhs);
162
-
163
- // Compares two wide C strings, ignoring case. Returns true iff they
164
- // have the same content.
165
- //
166
- // Unlike wcscasecmp(), this function can handle NULL argument(s).
167
- // A NULL C string is considered different to any non-NULL wide C string,
168
- // including the empty string.
169
- // NB: The implementations on different platforms slightly differ.
170
- // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
171
- // environment variable. On GNU platform this method uses wcscasecmp
172
- // which compares according to LC_CTYPE category of the current locale.
173
- // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
174
- // current locale.
175
- static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
176
- const wchar_t* rhs);
177
-
178
- // Formats a list of arguments to a String, using the same format
179
- // spec string as for printf.
180
- //
181
- // We do not use the StringPrintf class as it is not universally
182
- // available.
183
- //
184
- // The result is limited to 4096 characters (including the tailing
185
- // 0). If 4096 characters are not enough to format the input,
186
- // "<buffer exceeded>" is returned.
187
- static String Format(const char* format, ...);
188
-
189
- // C'tors
190
-
191
- // The default c'tor constructs a NULL string.
192
- String() : c_str_(NULL), length_(0) {}
193
-
194
- // Constructs a String by cloning a 0-terminated C string.
195
- String(const char* a_c_str) { // NOLINT
196
- if (a_c_str == NULL) {
197
- c_str_ = NULL;
198
- length_ = 0;
199
- } else {
200
- ConstructNonNull(a_c_str, strlen(a_c_str));
201
- }
202
- }
203
-
204
- // Constructs a String by copying a given number of chars from a
205
- // buffer. E.g. String("hello", 3) creates the string "hel",
206
- // String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
207
- // and String(NULL, 1) results in access violation.
208
- String(const char* buffer, size_t a_length) {
209
- ConstructNonNull(buffer, a_length);
210
- }
211
-
212
- // The copy c'tor creates a new copy of the string. The two
213
- // String objects do not share content.
214
- String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
215
-
216
- // D'tor. String is intended to be a final class, so the d'tor
217
- // doesn't need to be virtual.
218
- ~String() { delete[] c_str_; }
219
-
220
- // Allows a String to be implicitly converted to an ::std::string or
221
- // ::string, and vice versa. Converting a String containing a NULL
222
- // pointer to ::std::string or ::string is undefined behavior.
223
- // Converting a ::std::string or ::string containing an embedded NUL
224
- // character to a String will result in the prefix up to the first
225
- // NUL character.
226
- String(const ::std::string& str) {
227
- ConstructNonNull(str.c_str(), str.length());
228
- }
229
-
230
- operator ::std::string() const { return ::std::string(c_str(), length()); }
231
-
232
- #if GTEST_HAS_GLOBAL_STRING
233
- String(const ::string& str) {
234
- ConstructNonNull(str.c_str(), str.length());
235
- }
236
-
237
- operator ::string() const { return ::string(c_str(), length()); }
238
- #endif // GTEST_HAS_GLOBAL_STRING
239
-
240
- // Returns true iff this is an empty string (i.e. "").
241
- bool empty() const { return (c_str() != NULL) && (length() == 0); }
242
-
243
- // Compares this with another String.
244
- // Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
245
- // if this is greater than rhs.
246
- int Compare(const String& rhs) const;
247
-
248
- // Returns true iff this String equals the given C string. A NULL
249
- // string and a non-NULL string are considered not equal.
250
- bool operator==(const char* a_c_str) const { return Compare(a_c_str) == 0; }
251
-
252
- // Returns true iff this String is less than the given String. A
253
- // NULL string is considered less than "".
254
- bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
255
-
256
- // Returns true iff this String doesn't equal the given C string. A NULL
257
- // string and a non-NULL string are considered not equal.
258
- bool operator!=(const char* a_c_str) const { return !(*this == a_c_str); }
259
-
260
- // Returns true iff this String ends with the given suffix. *Any*
261
- // String is considered to end with a NULL or empty suffix.
262
- bool EndsWith(const char* suffix) const;
263
-
264
- // Returns true iff this String ends with the given suffix, not considering
265
- // case. Any String is considered to end with a NULL or empty suffix.
266
- bool EndsWithCaseInsensitive(const char* suffix) const;
267
-
268
- // Returns the length of the encapsulated string, or 0 if the
269
- // string is NULL.
270
- size_t length() const { return length_; }
271
-
272
- // Gets the 0-terminated C string this String object represents.
273
- // The String object still owns the string. Therefore the caller
274
- // should NOT delete the return value.
275
- const char* c_str() const { return c_str_; }
276
-
277
- // Assigns a C string to this object. Self-assignment works.
278
- const String& operator=(const char* a_c_str) {
279
- return *this = String(a_c_str);
280
- }
281
-
282
- // Assigns a String object to this object. Self-assignment works.
283
- const String& operator=(const String& rhs) {
284
- if (this != &rhs) {
285
- delete[] c_str_;
286
- if (rhs.c_str() == NULL) {
287
- c_str_ = NULL;
288
- length_ = 0;
289
- } else {
290
- ConstructNonNull(rhs.c_str(), rhs.length());
291
- }
292
- }
293
-
294
- return *this;
295
- }
296
-
297
- private:
298
- // Constructs a non-NULL String from the given content. This
299
- // function can only be called when c_str_ has not been allocated.
300
- // ConstructNonNull(NULL, 0) results in an empty string ("").
301
- // ConstructNonNull(NULL, non_zero) is undefined behavior.
302
- void ConstructNonNull(const char* buffer, size_t a_length) {
303
- char* const str = new char[a_length + 1];
304
- memcpy(str, buffer, a_length);
305
- str[a_length] = '\0';
306
- c_str_ = str;
307
- length_ = a_length;
308
- }
309
-
310
- const char* c_str_;
311
- size_t length_;
312
- }; // class String
313
-
314
- // Streams a String to an ostream. Each '\0' character in the String
315
- // is replaced with "\\0".
316
- inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
317
- if (str.c_str() == NULL) {
318
- os << "(null)";
319
- } else {
320
- const char* const c_str = str.c_str();
321
- for (size_t i = 0; i != str.length(); i++) {
322
- if (c_str[i] == '\0') {
323
- os << "\\0";
324
- } else {
325
- os << c_str[i];
326
- }
327
- }
328
- }
329
- return os;
330
- }
331
-
332
- // Gets the content of the stringstream's buffer as a String. Each '\0'
333
- // character in the buffer is replaced with "\\0".
334
- GTEST_API_ String StringStreamToString(::std::stringstream* stream);
335
-
336
- // Converts a streamable value to a String. A NULL pointer is
337
- // converted to "(null)". When the input value is a ::string,
338
- // ::std::string, ::wstring, or ::std::wstring object, each NUL
339
- // character in it is replaced with "\\0".
340
-
341
- // Declared here but defined in gtest.h, so that it has access
342
- // to the definition of the Message class, required by the ARM
343
- // compiler.
344
- template <typename T>
345
- String StreamableToString(const T& streamable);
346
-
347
- } // namespace internal
348
- } // namespace testing
349
-
350
- #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
@@ -1,968 +0,0 @@
1
- // This file was GENERATED by a script. DO NOT EDIT BY HAND!!!
2
-
3
- // Copyright 2009 Google Inc.
4
- // All Rights Reserved.
5
- //
6
- // Redistribution and use in source and binary forms, with or without
7
- // modification, are permitted provided that the following conditions are
8
- // met:
9
- //
10
- // * Redistributions of source code must retain the above copyright
11
- // notice, this list of conditions and the following disclaimer.
12
- // * Redistributions in binary form must reproduce the above
13
- // copyright notice, this list of conditions and the following disclaimer
14
- // in the documentation and/or other materials provided with the
15
- // distribution.
16
- // * Neither the name of Google Inc. nor the names of its
17
- // contributors may be used to endorse or promote products derived from
18
- // this software without specific prior written permission.
19
- //
20
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- //
32
- // Author: wan@google.com (Zhanyong Wan)
33
-
34
- // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
35
-
36
- #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
37
- #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
38
-
39
- #include <utility> // For ::std::pair.
40
-
41
- // The compiler used in Symbian has a bug that prevents us from declaring the
42
- // tuple template as a friend (it complains that tuple is redefined). This
43
- // hack bypasses the bug by declaring the members that should otherwise be
44
- // private as public.
45
- // Sun Studio versions < 12 also have the above bug.
46
- #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
47
- # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
48
- #else
49
- # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
50
- template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
51
- private:
52
- #endif
53
-
54
- // GTEST_n_TUPLE_(T) is the type of an n-tuple.
55
- #define GTEST_0_TUPLE_(T) tuple<>
56
- #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \
57
- void, void, void>
58
- #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \
59
- void, void, void>
60
- #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \
61
- void, void, void>
62
- #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \
63
- void, void, void>
64
- #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \
65
- void, void, void>
66
- #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \
67
- void, void, void>
68
- #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
69
- void, void, void>
70
- #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
71
- T##7, void, void>
72
- #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
73
- T##7, T##8, void>
74
- #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \
75
- T##7, T##8, T##9>
76
-
77
- // GTEST_n_TYPENAMES_(T) declares a list of n typenames.
78
- #define GTEST_0_TYPENAMES_(T)
79
- #define GTEST_1_TYPENAMES_(T) typename T##0
80
- #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1
81
- #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2
82
- #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
83
- typename T##3
84
- #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
85
- typename T##3, typename T##4
86
- #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
87
- typename T##3, typename T##4, typename T##5
88
- #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
89
- typename T##3, typename T##4, typename T##5, typename T##6
90
- #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
91
- typename T##3, typename T##4, typename T##5, typename T##6, typename T##7
92
- #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
93
- typename T##3, typename T##4, typename T##5, typename T##6, \
94
- typename T##7, typename T##8
95
- #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \
96
- typename T##3, typename T##4, typename T##5, typename T##6, \
97
- typename T##7, typename T##8, typename T##9
98
-
99
- // In theory, defining stuff in the ::std namespace is undefined
100
- // behavior. We can do this as we are playing the role of a standard
101
- // library vendor.
102
- namespace std {
103
- namespace tr1 {
104
-
105
- template <typename T0 = void, typename T1 = void, typename T2 = void,
106
- typename T3 = void, typename T4 = void, typename T5 = void,
107
- typename T6 = void, typename T7 = void, typename T8 = void,
108
- typename T9 = void>
109
- class tuple;
110
-
111
- // Anything in namespace gtest_internal is Google Test's INTERNAL
112
- // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
113
- namespace gtest_internal {
114
-
115
- // ByRef<T>::type is T if T is a reference; otherwise it's const T&.
116
- template <typename T>
117
- struct ByRef { typedef const T& type; }; // NOLINT
118
- template <typename T>
119
- struct ByRef<T&> { typedef T& type; }; // NOLINT
120
-
121
- // A handy wrapper for ByRef.
122
- #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
123
-
124
- // AddRef<T>::type is T if T is a reference; otherwise it's T&. This
125
- // is the same as tr1::add_reference<T>::type.
126
- template <typename T>
127
- struct AddRef { typedef T& type; }; // NOLINT
128
- template <typename T>
129
- struct AddRef<T&> { typedef T& type; }; // NOLINT
130
-
131
- // A handy wrapper for AddRef.
132
- #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
133
-
134
- // A helper for implementing get<k>().
135
- template <int k> class Get;
136
-
137
- // A helper for implementing tuple_element<k, T>. kIndexValid is true
138
- // iff k < the number of fields in tuple type T.
139
- template <bool kIndexValid, int kIndex, class Tuple>
140
- struct TupleElement;
141
-
142
- template <GTEST_10_TYPENAMES_(T)>
143
- struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
144
-
145
- template <GTEST_10_TYPENAMES_(T)>
146
- struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
147
-
148
- template <GTEST_10_TYPENAMES_(T)>
149
- struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
150
-
151
- template <GTEST_10_TYPENAMES_(T)>
152
- struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
153
-
154
- template <GTEST_10_TYPENAMES_(T)>
155
- struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
156
-
157
- template <GTEST_10_TYPENAMES_(T)>
158
- struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
159
-
160
- template <GTEST_10_TYPENAMES_(T)>
161
- struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
162
-
163
- template <GTEST_10_TYPENAMES_(T)>
164
- struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
165
-
166
- template <GTEST_10_TYPENAMES_(T)>
167
- struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
168
-
169
- template <GTEST_10_TYPENAMES_(T)>
170
- struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
171
-
172
- } // namespace gtest_internal
173
-
174
- template <>
175
- class tuple<> {
176
- public:
177
- tuple() {}
178
- tuple(const tuple& /* t */) {}
179
- tuple& operator=(const tuple& /* t */) { return *this; }
180
- };
181
-
182
- template <GTEST_1_TYPENAMES_(T)>
183
- class GTEST_1_TUPLE_(T) {
184
- public:
185
- template <int k> friend class gtest_internal::Get;
186
-
187
- tuple() : f0_() {}
188
-
189
- explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
190
-
191
- tuple(const tuple& t) : f0_(t.f0_) {}
192
-
193
- template <GTEST_1_TYPENAMES_(U)>
194
- tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {}
195
-
196
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
197
-
198
- template <GTEST_1_TYPENAMES_(U)>
199
- tuple& operator=(const GTEST_1_TUPLE_(U)& t) {
200
- return CopyFrom(t);
201
- }
202
-
203
- GTEST_DECLARE_TUPLE_AS_FRIEND_
204
-
205
- template <GTEST_1_TYPENAMES_(U)>
206
- tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) {
207
- f0_ = t.f0_;
208
- return *this;
209
- }
210
-
211
- T0 f0_;
212
- };
213
-
214
- template <GTEST_2_TYPENAMES_(T)>
215
- class GTEST_2_TUPLE_(T) {
216
- public:
217
- template <int k> friend class gtest_internal::Get;
218
-
219
- tuple() : f0_(), f1_() {}
220
-
221
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
222
- f1_(f1) {}
223
-
224
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {}
225
-
226
- template <GTEST_2_TYPENAMES_(U)>
227
- tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {}
228
- template <typename U0, typename U1>
229
- tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
230
-
231
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
232
-
233
- template <GTEST_2_TYPENAMES_(U)>
234
- tuple& operator=(const GTEST_2_TUPLE_(U)& t) {
235
- return CopyFrom(t);
236
- }
237
- template <typename U0, typename U1>
238
- tuple& operator=(const ::std::pair<U0, U1>& p) {
239
- f0_ = p.first;
240
- f1_ = p.second;
241
- return *this;
242
- }
243
-
244
- GTEST_DECLARE_TUPLE_AS_FRIEND_
245
-
246
- template <GTEST_2_TYPENAMES_(U)>
247
- tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) {
248
- f0_ = t.f0_;
249
- f1_ = t.f1_;
250
- return *this;
251
- }
252
-
253
- T0 f0_;
254
- T1 f1_;
255
- };
256
-
257
- template <GTEST_3_TYPENAMES_(T)>
258
- class GTEST_3_TUPLE_(T) {
259
- public:
260
- template <int k> friend class gtest_internal::Get;
261
-
262
- tuple() : f0_(), f1_(), f2_() {}
263
-
264
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
265
- GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
266
-
267
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
268
-
269
- template <GTEST_3_TYPENAMES_(U)>
270
- tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {}
271
-
272
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
273
-
274
- template <GTEST_3_TYPENAMES_(U)>
275
- tuple& operator=(const GTEST_3_TUPLE_(U)& t) {
276
- return CopyFrom(t);
277
- }
278
-
279
- GTEST_DECLARE_TUPLE_AS_FRIEND_
280
-
281
- template <GTEST_3_TYPENAMES_(U)>
282
- tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) {
283
- f0_ = t.f0_;
284
- f1_ = t.f1_;
285
- f2_ = t.f2_;
286
- return *this;
287
- }
288
-
289
- T0 f0_;
290
- T1 f1_;
291
- T2 f2_;
292
- };
293
-
294
- template <GTEST_4_TYPENAMES_(T)>
295
- class GTEST_4_TUPLE_(T) {
296
- public:
297
- template <int k> friend class gtest_internal::Get;
298
-
299
- tuple() : f0_(), f1_(), f2_(), f3_() {}
300
-
301
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
302
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
303
- f3_(f3) {}
304
-
305
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {}
306
-
307
- template <GTEST_4_TYPENAMES_(U)>
308
- tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
309
- f3_(t.f3_) {}
310
-
311
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
312
-
313
- template <GTEST_4_TYPENAMES_(U)>
314
- tuple& operator=(const GTEST_4_TUPLE_(U)& t) {
315
- return CopyFrom(t);
316
- }
317
-
318
- GTEST_DECLARE_TUPLE_AS_FRIEND_
319
-
320
- template <GTEST_4_TYPENAMES_(U)>
321
- tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) {
322
- f0_ = t.f0_;
323
- f1_ = t.f1_;
324
- f2_ = t.f2_;
325
- f3_ = t.f3_;
326
- return *this;
327
- }
328
-
329
- T0 f0_;
330
- T1 f1_;
331
- T2 f2_;
332
- T3 f3_;
333
- };
334
-
335
- template <GTEST_5_TYPENAMES_(T)>
336
- class GTEST_5_TUPLE_(T) {
337
- public:
338
- template <int k> friend class gtest_internal::Get;
339
-
340
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
341
-
342
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
343
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
344
- GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {}
345
-
346
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
347
- f4_(t.f4_) {}
348
-
349
- template <GTEST_5_TYPENAMES_(U)>
350
- tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
351
- f3_(t.f3_), f4_(t.f4_) {}
352
-
353
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
354
-
355
- template <GTEST_5_TYPENAMES_(U)>
356
- tuple& operator=(const GTEST_5_TUPLE_(U)& t) {
357
- return CopyFrom(t);
358
- }
359
-
360
- GTEST_DECLARE_TUPLE_AS_FRIEND_
361
-
362
- template <GTEST_5_TYPENAMES_(U)>
363
- tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) {
364
- f0_ = t.f0_;
365
- f1_ = t.f1_;
366
- f2_ = t.f2_;
367
- f3_ = t.f3_;
368
- f4_ = t.f4_;
369
- return *this;
370
- }
371
-
372
- T0 f0_;
373
- T1 f1_;
374
- T2 f2_;
375
- T3 f3_;
376
- T4 f4_;
377
- };
378
-
379
- template <GTEST_6_TYPENAMES_(T)>
380
- class GTEST_6_TUPLE_(T) {
381
- public:
382
- template <int k> friend class gtest_internal::Get;
383
-
384
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
385
-
386
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
387
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
388
- GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
389
- f5_(f5) {}
390
-
391
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
392
- f4_(t.f4_), f5_(t.f5_) {}
393
-
394
- template <GTEST_6_TYPENAMES_(U)>
395
- tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
396
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {}
397
-
398
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
399
-
400
- template <GTEST_6_TYPENAMES_(U)>
401
- tuple& operator=(const GTEST_6_TUPLE_(U)& t) {
402
- return CopyFrom(t);
403
- }
404
-
405
- GTEST_DECLARE_TUPLE_AS_FRIEND_
406
-
407
- template <GTEST_6_TYPENAMES_(U)>
408
- tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) {
409
- f0_ = t.f0_;
410
- f1_ = t.f1_;
411
- f2_ = t.f2_;
412
- f3_ = t.f3_;
413
- f4_ = t.f4_;
414
- f5_ = t.f5_;
415
- return *this;
416
- }
417
-
418
- T0 f0_;
419
- T1 f1_;
420
- T2 f2_;
421
- T3 f3_;
422
- T4 f4_;
423
- T5 f5_;
424
- };
425
-
426
- template <GTEST_7_TYPENAMES_(T)>
427
- class GTEST_7_TUPLE_(T) {
428
- public:
429
- template <int k> friend class gtest_internal::Get;
430
-
431
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
432
-
433
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
434
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
435
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2),
436
- f3_(f3), f4_(f4), f5_(f5), f6_(f6) {}
437
-
438
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
439
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
440
-
441
- template <GTEST_7_TYPENAMES_(U)>
442
- tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
443
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {}
444
-
445
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
446
-
447
- template <GTEST_7_TYPENAMES_(U)>
448
- tuple& operator=(const GTEST_7_TUPLE_(U)& t) {
449
- return CopyFrom(t);
450
- }
451
-
452
- GTEST_DECLARE_TUPLE_AS_FRIEND_
453
-
454
- template <GTEST_7_TYPENAMES_(U)>
455
- tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) {
456
- f0_ = t.f0_;
457
- f1_ = t.f1_;
458
- f2_ = t.f2_;
459
- f3_ = t.f3_;
460
- f4_ = t.f4_;
461
- f5_ = t.f5_;
462
- f6_ = t.f6_;
463
- return *this;
464
- }
465
-
466
- T0 f0_;
467
- T1 f1_;
468
- T2 f2_;
469
- T3 f3_;
470
- T4 f4_;
471
- T5 f5_;
472
- T6 f6_;
473
- };
474
-
475
- template <GTEST_8_TYPENAMES_(T)>
476
- class GTEST_8_TUPLE_(T) {
477
- public:
478
- template <int k> friend class gtest_internal::Get;
479
-
480
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
481
-
482
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
483
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
484
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6,
485
- GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
486
- f5_(f5), f6_(f6), f7_(f7) {}
487
-
488
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
489
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
490
-
491
- template <GTEST_8_TYPENAMES_(U)>
492
- tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
493
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {}
494
-
495
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
496
-
497
- template <GTEST_8_TYPENAMES_(U)>
498
- tuple& operator=(const GTEST_8_TUPLE_(U)& t) {
499
- return CopyFrom(t);
500
- }
501
-
502
- GTEST_DECLARE_TUPLE_AS_FRIEND_
503
-
504
- template <GTEST_8_TYPENAMES_(U)>
505
- tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) {
506
- f0_ = t.f0_;
507
- f1_ = t.f1_;
508
- f2_ = t.f2_;
509
- f3_ = t.f3_;
510
- f4_ = t.f4_;
511
- f5_ = t.f5_;
512
- f6_ = t.f6_;
513
- f7_ = t.f7_;
514
- return *this;
515
- }
516
-
517
- T0 f0_;
518
- T1 f1_;
519
- T2 f2_;
520
- T3 f3_;
521
- T4 f4_;
522
- T5 f5_;
523
- T6 f6_;
524
- T7 f7_;
525
- };
526
-
527
- template <GTEST_9_TYPENAMES_(T)>
528
- class GTEST_9_TUPLE_(T) {
529
- public:
530
- template <int k> friend class gtest_internal::Get;
531
-
532
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
533
-
534
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
535
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
536
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
537
- GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4),
538
- f5_(f5), f6_(f6), f7_(f7), f8_(f8) {}
539
-
540
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
541
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
542
-
543
- template <GTEST_9_TYPENAMES_(U)>
544
- tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
545
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {}
546
-
547
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
548
-
549
- template <GTEST_9_TYPENAMES_(U)>
550
- tuple& operator=(const GTEST_9_TUPLE_(U)& t) {
551
- return CopyFrom(t);
552
- }
553
-
554
- GTEST_DECLARE_TUPLE_AS_FRIEND_
555
-
556
- template <GTEST_9_TYPENAMES_(U)>
557
- tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) {
558
- f0_ = t.f0_;
559
- f1_ = t.f1_;
560
- f2_ = t.f2_;
561
- f3_ = t.f3_;
562
- f4_ = t.f4_;
563
- f5_ = t.f5_;
564
- f6_ = t.f6_;
565
- f7_ = t.f7_;
566
- f8_ = t.f8_;
567
- return *this;
568
- }
569
-
570
- T0 f0_;
571
- T1 f1_;
572
- T2 f2_;
573
- T3 f3_;
574
- T4 f4_;
575
- T5 f5_;
576
- T6 f6_;
577
- T7 f7_;
578
- T8 f8_;
579
- };
580
-
581
- template <GTEST_10_TYPENAMES_(T)>
582
- class tuple {
583
- public:
584
- template <int k> friend class gtest_internal::Get;
585
-
586
- tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
587
- f9_() {}
588
-
589
- explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
590
- GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
591
- GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7,
592
- GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2),
593
- f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {}
594
-
595
- tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_),
596
- f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {}
597
-
598
- template <GTEST_10_TYPENAMES_(U)>
599
- tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_),
600
- f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_),
601
- f9_(t.f9_) {}
602
-
603
- tuple& operator=(const tuple& t) { return CopyFrom(t); }
604
-
605
- template <GTEST_10_TYPENAMES_(U)>
606
- tuple& operator=(const GTEST_10_TUPLE_(U)& t) {
607
- return CopyFrom(t);
608
- }
609
-
610
- GTEST_DECLARE_TUPLE_AS_FRIEND_
611
-
612
- template <GTEST_10_TYPENAMES_(U)>
613
- tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) {
614
- f0_ = t.f0_;
615
- f1_ = t.f1_;
616
- f2_ = t.f2_;
617
- f3_ = t.f3_;
618
- f4_ = t.f4_;
619
- f5_ = t.f5_;
620
- f6_ = t.f6_;
621
- f7_ = t.f7_;
622
- f8_ = t.f8_;
623
- f9_ = t.f9_;
624
- return *this;
625
- }
626
-
627
- T0 f0_;
628
- T1 f1_;
629
- T2 f2_;
630
- T3 f3_;
631
- T4 f4_;
632
- T5 f5_;
633
- T6 f6_;
634
- T7 f7_;
635
- T8 f8_;
636
- T9 f9_;
637
- };
638
-
639
- // 6.1.3.2 Tuple creation functions.
640
-
641
- // Known limitations: we don't support passing an
642
- // std::tr1::reference_wrapper<T> to make_tuple(). And we don't
643
- // implement tie().
644
-
645
- inline tuple<> make_tuple() { return tuple<>(); }
646
-
647
- template <GTEST_1_TYPENAMES_(T)>
648
- inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) {
649
- return GTEST_1_TUPLE_(T)(f0);
650
- }
651
-
652
- template <GTEST_2_TYPENAMES_(T)>
653
- inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) {
654
- return GTEST_2_TUPLE_(T)(f0, f1);
655
- }
656
-
657
- template <GTEST_3_TYPENAMES_(T)>
658
- inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) {
659
- return GTEST_3_TUPLE_(T)(f0, f1, f2);
660
- }
661
-
662
- template <GTEST_4_TYPENAMES_(T)>
663
- inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
664
- const T3& f3) {
665
- return GTEST_4_TUPLE_(T)(f0, f1, f2, f3);
666
- }
667
-
668
- template <GTEST_5_TYPENAMES_(T)>
669
- inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
670
- const T3& f3, const T4& f4) {
671
- return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4);
672
- }
673
-
674
- template <GTEST_6_TYPENAMES_(T)>
675
- inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
676
- const T3& f3, const T4& f4, const T5& f5) {
677
- return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5);
678
- }
679
-
680
- template <GTEST_7_TYPENAMES_(T)>
681
- inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
682
- const T3& f3, const T4& f4, const T5& f5, const T6& f6) {
683
- return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6);
684
- }
685
-
686
- template <GTEST_8_TYPENAMES_(T)>
687
- inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
688
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) {
689
- return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7);
690
- }
691
-
692
- template <GTEST_9_TYPENAMES_(T)>
693
- inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
694
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
695
- const T8& f8) {
696
- return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8);
697
- }
698
-
699
- template <GTEST_10_TYPENAMES_(T)>
700
- inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2,
701
- const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7,
702
- const T8& f8, const T9& f9) {
703
- return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
704
- }
705
-
706
- // 6.1.3.3 Tuple helper classes.
707
-
708
- template <typename Tuple> struct tuple_size;
709
-
710
- template <GTEST_0_TYPENAMES_(T)>
711
- struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
712
-
713
- template <GTEST_1_TYPENAMES_(T)>
714
- struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
715
-
716
- template <GTEST_2_TYPENAMES_(T)>
717
- struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
718
-
719
- template <GTEST_3_TYPENAMES_(T)>
720
- struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
721
-
722
- template <GTEST_4_TYPENAMES_(T)>
723
- struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
724
-
725
- template <GTEST_5_TYPENAMES_(T)>
726
- struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
727
-
728
- template <GTEST_6_TYPENAMES_(T)>
729
- struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
730
-
731
- template <GTEST_7_TYPENAMES_(T)>
732
- struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
733
-
734
- template <GTEST_8_TYPENAMES_(T)>
735
- struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
736
-
737
- template <GTEST_9_TYPENAMES_(T)>
738
- struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
739
-
740
- template <GTEST_10_TYPENAMES_(T)>
741
- struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
742
-
743
- template <int k, class Tuple>
744
- struct tuple_element {
745
- typedef typename gtest_internal::TupleElement<
746
- k < (tuple_size<Tuple>::value), k, Tuple>::type type;
747
- };
748
-
749
- #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
750
-
751
- // 6.1.3.4 Element access.
752
-
753
- namespace gtest_internal {
754
-
755
- template <>
756
- class Get<0> {
757
- public:
758
- template <class Tuple>
759
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
760
- Field(Tuple& t) { return t.f0_; } // NOLINT
761
-
762
- template <class Tuple>
763
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple))
764
- ConstField(const Tuple& t) { return t.f0_; }
765
- };
766
-
767
- template <>
768
- class Get<1> {
769
- public:
770
- template <class Tuple>
771
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
772
- Field(Tuple& t) { return t.f1_; } // NOLINT
773
-
774
- template <class Tuple>
775
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple))
776
- ConstField(const Tuple& t) { return t.f1_; }
777
- };
778
-
779
- template <>
780
- class Get<2> {
781
- public:
782
- template <class Tuple>
783
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
784
- Field(Tuple& t) { return t.f2_; } // NOLINT
785
-
786
- template <class Tuple>
787
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple))
788
- ConstField(const Tuple& t) { return t.f2_; }
789
- };
790
-
791
- template <>
792
- class Get<3> {
793
- public:
794
- template <class Tuple>
795
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
796
- Field(Tuple& t) { return t.f3_; } // NOLINT
797
-
798
- template <class Tuple>
799
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple))
800
- ConstField(const Tuple& t) { return t.f3_; }
801
- };
802
-
803
- template <>
804
- class Get<4> {
805
- public:
806
- template <class Tuple>
807
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
808
- Field(Tuple& t) { return t.f4_; } // NOLINT
809
-
810
- template <class Tuple>
811
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple))
812
- ConstField(const Tuple& t) { return t.f4_; }
813
- };
814
-
815
- template <>
816
- class Get<5> {
817
- public:
818
- template <class Tuple>
819
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
820
- Field(Tuple& t) { return t.f5_; } // NOLINT
821
-
822
- template <class Tuple>
823
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple))
824
- ConstField(const Tuple& t) { return t.f5_; }
825
- };
826
-
827
- template <>
828
- class Get<6> {
829
- public:
830
- template <class Tuple>
831
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
832
- Field(Tuple& t) { return t.f6_; } // NOLINT
833
-
834
- template <class Tuple>
835
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple))
836
- ConstField(const Tuple& t) { return t.f6_; }
837
- };
838
-
839
- template <>
840
- class Get<7> {
841
- public:
842
- template <class Tuple>
843
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
844
- Field(Tuple& t) { return t.f7_; } // NOLINT
845
-
846
- template <class Tuple>
847
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple))
848
- ConstField(const Tuple& t) { return t.f7_; }
849
- };
850
-
851
- template <>
852
- class Get<8> {
853
- public:
854
- template <class Tuple>
855
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
856
- Field(Tuple& t) { return t.f8_; } // NOLINT
857
-
858
- template <class Tuple>
859
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple))
860
- ConstField(const Tuple& t) { return t.f8_; }
861
- };
862
-
863
- template <>
864
- class Get<9> {
865
- public:
866
- template <class Tuple>
867
- static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
868
- Field(Tuple& t) { return t.f9_; } // NOLINT
869
-
870
- template <class Tuple>
871
- static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple))
872
- ConstField(const Tuple& t) { return t.f9_; }
873
- };
874
-
875
- } // namespace gtest_internal
876
-
877
- template <int k, GTEST_10_TYPENAMES_(T)>
878
- GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
879
- get(GTEST_10_TUPLE_(T)& t) {
880
- return gtest_internal::Get<k>::Field(t);
881
- }
882
-
883
- template <int k, GTEST_10_TYPENAMES_(T)>
884
- GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T)))
885
- get(const GTEST_10_TUPLE_(T)& t) {
886
- return gtest_internal::Get<k>::ConstField(t);
887
- }
888
-
889
- // 6.1.3.5 Relational operators
890
-
891
- // We only implement == and !=, as we don't have a need for the rest yet.
892
-
893
- namespace gtest_internal {
894
-
895
- // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
896
- // first k fields of t1 equals the first k fields of t2.
897
- // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
898
- // k1 != k2.
899
- template <int kSize1, int kSize2>
900
- struct SameSizeTuplePrefixComparator;
901
-
902
- template <>
903
- struct SameSizeTuplePrefixComparator<0, 0> {
904
- template <class Tuple1, class Tuple2>
905
- static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
906
- return true;
907
- }
908
- };
909
-
910
- template <int k>
911
- struct SameSizeTuplePrefixComparator<k, k> {
912
- template <class Tuple1, class Tuple2>
913
- static bool Eq(const Tuple1& t1, const Tuple2& t2) {
914
- return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
915
- ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
916
- }
917
- };
918
-
919
- } // namespace gtest_internal
920
-
921
- template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
922
- inline bool operator==(const GTEST_10_TUPLE_(T)& t,
923
- const GTEST_10_TUPLE_(U)& u) {
924
- return gtest_internal::SameSizeTuplePrefixComparator<
925
- tuple_size<GTEST_10_TUPLE_(T)>::value,
926
- tuple_size<GTEST_10_TUPLE_(U)>::value>::Eq(t, u);
927
- }
928
-
929
- template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)>
930
- inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
931
- const GTEST_10_TUPLE_(U)& u) { return !(t == u); }
932
-
933
- // 6.1.4 Pairs.
934
- // Unimplemented.
935
-
936
- } // namespace tr1
937
- } // namespace std
938
-
939
- #undef GTEST_0_TUPLE_
940
- #undef GTEST_1_TUPLE_
941
- #undef GTEST_2_TUPLE_
942
- #undef GTEST_3_TUPLE_
943
- #undef GTEST_4_TUPLE_
944
- #undef GTEST_5_TUPLE_
945
- #undef GTEST_6_TUPLE_
946
- #undef GTEST_7_TUPLE_
947
- #undef GTEST_8_TUPLE_
948
- #undef GTEST_9_TUPLE_
949
- #undef GTEST_10_TUPLE_
950
-
951
- #undef GTEST_0_TYPENAMES_
952
- #undef GTEST_1_TYPENAMES_
953
- #undef GTEST_2_TYPENAMES_
954
- #undef GTEST_3_TYPENAMES_
955
- #undef GTEST_4_TYPENAMES_
956
- #undef GTEST_5_TYPENAMES_
957
- #undef GTEST_6_TYPENAMES_
958
- #undef GTEST_7_TYPENAMES_
959
- #undef GTEST_8_TYPENAMES_
960
- #undef GTEST_9_TYPENAMES_
961
- #undef GTEST_10_TYPENAMES_
962
-
963
- #undef GTEST_DECLARE_TUPLE_AS_FRIEND_
964
- #undef GTEST_BY_REF_
965
- #undef GTEST_ADD_REF_
966
- #undef GTEST_TUPLE_ELEMENT_
967
-
968
- #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_