cppjieba_rb 0.4.1 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +21 -0
- data/.github/workflows/linting.yml +30 -0
- data/.github/workflows/release.yml +42 -0
- data/.github/workflows/tests.yml +47 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +45 -0
- data/.ruby-version +1 -0
- data/.yamllint +35 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +11 -0
- data/README.md +5 -5
- data/Rakefile +16 -7
- data/cppjieba_rb.gemspec +46 -33
- data/ext/cppjieba/.github/workflows/cmake.yml +52 -0
- data/ext/cppjieba/.github/workflows/stale-issues.yml +24 -0
- data/ext/cppjieba/.gitmodules +3 -0
- data/ext/cppjieba/{ChangeLog.md → CHANGELOG.md} +50 -1
- data/ext/cppjieba/CMakeLists.txt +11 -14
- data/ext/cppjieba/LICENSE +20 -0
- data/ext/cppjieba/README.md +9 -18
- data/ext/cppjieba/deps/limonp/.github/workflows/cmake.yml +43 -0
- data/ext/cppjieba/deps/limonp/.gitignore +9 -0
- data/ext/cppjieba/deps/limonp/CHANGELOG.md +160 -0
- data/ext/cppjieba/deps/limonp/CMakeLists.txt +61 -0
- data/ext/cppjieba/deps/limonp/LICENSE +20 -0
- data/ext/cppjieba/deps/limonp/README.md +38 -0
- data/ext/cppjieba/deps/limonp/{LocalVector.hpp → include/limonp/LocalVector.hpp} +3 -3
- data/ext/cppjieba/deps/limonp/{Logging.hpp → include/limonp/Logging.hpp} +17 -3
- data/ext/cppjieba/deps/limonp/{StringUtil.hpp → include/limonp/StringUtil.hpp} +31 -10
- data/ext/cppjieba/deps/limonp/test/CMakeLists.txt +8 -0
- data/ext/cppjieba/deps/limonp/test/demo.cpp +40 -0
- data/ext/cppjieba/deps/limonp/test/testdata/1.conf +5 -0
- data/ext/cppjieba/deps/limonp/test/testdata/StdExtension.data +3 -0
- data/ext/cppjieba/deps/limonp/test/testdata/dict.gbk +50 -0
- data/ext/cppjieba/deps/limonp/test/testdata/dict.utf8 +50 -0
- data/ext/cppjieba/deps/limonp/test/testdata/io_testfile +2 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.0.1.utf8 +93 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.0.utf8 +93 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.1.utf8 +67 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.2.utf8 +64 -0
- data/ext/cppjieba/deps/limonp/test/unittest/CMakeLists.txt +30 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TArgvContext.cpp +16 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TCastFloat.cpp +19 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TClosure.cpp +85 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TColorPrint.cpp +20 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TConfig.cpp +17 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TLocalVector.cpp +41 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TLogging.cpp +12 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TStdExtension.cpp +95 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TStringUtil.cpp +183 -0
- data/ext/cppjieba/include/cppjieba/DictTrie.hpp +9 -0
- data/ext/cppjieba/include/cppjieba/Jieba.hpp +4 -0
- data/ext/cppjieba/include/cppjieba/Trie.hpp +27 -1
- data/ext/cppjieba/test/CMakeLists.txt +4 -3
- data/ext/cppjieba/test/unittest/CMakeLists.txt +16 -7
- data/ext/cppjieba_rb/extconf.rb +11 -6
- data/ext/cppjieba_rb/internal.cc +1 -1
- data/lib/cppjieba_rb/segment.rb +4 -1
- data/lib/cppjieba_rb/version.rb +3 -1
- data/lib/cppjieba_rb.rb +12 -5
- data/test/test_keyword.rb +8 -8
- data/test/test_segment.rb +14 -10
- data/test/test_stop_word_filter.rb +5 -3
- data/test/test_tagging.rb +5 -2
- metadata +63 -140
- data/.travis.yml +0 -30
- data/ext/cppjieba/.travis.yml +0 -21
- data/ext/cppjieba/README_EN.md +0 -115
- data/ext/cppjieba/appveyor.yml +0 -32
- data/ext/cppjieba/deps/CMakeLists.txt +0 -1
- data/ext/cppjieba/deps/gtest/CMakeLists.txt +0 -5
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-death-test.h +0 -283
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-message.h +0 -230
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h +0 -1421
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h.pump +0 -487
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-printers.h +0 -796
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-spi.h +0 -232
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-test-part.h +0 -176
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-typed-test.h +0 -259
- data/ext/cppjieba/deps/gtest/include/gtest/gtest.h +0 -2155
- data/ext/cppjieba/deps/gtest/include/gtest/gtest_pred_impl.h +0 -358
- data/ext/cppjieba/deps/gtest/include/gtest/gtest_prod.h +0 -58
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-death-test-internal.h +0 -308
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-filepath.h +0 -210
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-internal.h +0 -1226
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-linked_ptr.h +0 -233
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h +0 -4822
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -301
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util.h +0 -619
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-port.h +0 -1788
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-string.h +0 -350
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h +0 -968
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h.pump +0 -336
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h +0 -3330
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h.pump +0 -296
- data/ext/cppjieba/deps/gtest/src/.deps/gtest-all.Plo +0 -681
- data/ext/cppjieba/deps/gtest/src/.deps/gtest_main.Plo +0 -509
- data/ext/cppjieba/deps/gtest/src/.dirstamp +0 -0
- data/ext/cppjieba/deps/gtest/src/gtest-all.cc +0 -48
- data/ext/cppjieba/deps/gtest/src/gtest-death-test.cc +0 -1234
- data/ext/cppjieba/deps/gtest/src/gtest-filepath.cc +0 -380
- data/ext/cppjieba/deps/gtest/src/gtest-internal-inl.h +0 -1038
- data/ext/cppjieba/deps/gtest/src/gtest-port.cc +0 -746
- data/ext/cppjieba/deps/gtest/src/gtest-printers.cc +0 -356
- data/ext/cppjieba/deps/gtest/src/gtest-test-part.cc +0 -110
- data/ext/cppjieba/deps/gtest/src/gtest-typed-test.cc +0 -110
- data/ext/cppjieba/deps/gtest/src/gtest.cc +0 -4898
- data/ext/cppjieba/deps/limonp/BlockingQueue.hpp +0 -49
- data/ext/cppjieba/deps/limonp/BoundedBlockingQueue.hpp +0 -67
- data/ext/cppjieba/deps/limonp/BoundedQueue.hpp +0 -65
- data/ext/cppjieba/deps/limonp/FileLock.hpp +0 -74
- data/ext/cppjieba/deps/limonp/Md5.hpp +0 -411
- data/ext/cppjieba/deps/limonp/MutexLock.hpp +0 -51
- data/ext/cppjieba/deps/limonp/Thread.hpp +0 -44
- data/ext/cppjieba/deps/limonp/ThreadPool.hpp +0 -86
- data/ext/cppjieba/test/demo.cpp +0 -80
- /data/ext/cppjieba/deps/{gtest/src/.deps/.dirstamp → limonp/.gitmodules} +0 -0
- /data/ext/cppjieba/deps/limonp/{ArgvContext.hpp → include/limonp/ArgvContext.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Closure.hpp → include/limonp/Closure.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Colors.hpp → include/limonp/Colors.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Condition.hpp → include/limonp/Condition.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Config.hpp → include/limonp/Config.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{ForcePublic.hpp → include/limonp/ForcePublic.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{NonCopyable.hpp → include/limonp/NonCopyable.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{StdExtension.hpp → include/limonp/StdExtension.hpp} +0 -0
- /data/ext/cppjieba/deps/{gtest/src/gtest_main.cc → limonp/test/unittest/gtest_main.cpp} +0 -0
@@ -1,336 +0,0 @@
|
|
1
|
-
$$ -*- mode: c++; -*-
|
2
|
-
$var n = 10 $$ Maximum number of tuple fields we want to support.
|
3
|
-
$$ This meta comment fixes auto-indentation in Emacs. }}
|
4
|
-
// Copyright 2009 Google Inc.
|
5
|
-
// All Rights Reserved.
|
6
|
-
//
|
7
|
-
// Redistribution and use in source and binary forms, with or without
|
8
|
-
// modification, are permitted provided that the following conditions are
|
9
|
-
// met:
|
10
|
-
//
|
11
|
-
// * Redistributions of source code must retain the above copyright
|
12
|
-
// notice, this list of conditions and the following disclaimer.
|
13
|
-
// * Redistributions in binary form must reproduce the above
|
14
|
-
// copyright notice, this list of conditions and the following disclaimer
|
15
|
-
// in the documentation and/or other materials provided with the
|
16
|
-
// distribution.
|
17
|
-
// * Neither the name of Google Inc. nor the names of its
|
18
|
-
// contributors may be used to endorse or promote products derived from
|
19
|
-
// this software without specific prior written permission.
|
20
|
-
//
|
21
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
27
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
28
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
29
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
30
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
31
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
-
//
|
33
|
-
// Author: wan@google.com (Zhanyong Wan)
|
34
|
-
|
35
|
-
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
|
36
|
-
|
37
|
-
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
|
38
|
-
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
|
39
|
-
|
40
|
-
#include <utility> // For ::std::pair.
|
41
|
-
|
42
|
-
// The compiler used in Symbian has a bug that prevents us from declaring the
|
43
|
-
// tuple template as a friend (it complains that tuple is redefined). This
|
44
|
-
// hack bypasses the bug by declaring the members that should otherwise be
|
45
|
-
// private as public.
|
46
|
-
// Sun Studio versions < 12 also have the above bug.
|
47
|
-
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
48
|
-
# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
|
49
|
-
#else
|
50
|
-
# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
|
51
|
-
template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
|
52
|
-
private:
|
53
|
-
#endif
|
54
|
-
|
55
|
-
|
56
|
-
$range i 0..n-1
|
57
|
-
$range j 0..n
|
58
|
-
$range k 1..n
|
59
|
-
// GTEST_n_TUPLE_(T) is the type of an n-tuple.
|
60
|
-
#define GTEST_0_TUPLE_(T) tuple<>
|
61
|
-
|
62
|
-
$for k [[
|
63
|
-
$range m 0..k-1
|
64
|
-
$range m2 k..n-1
|
65
|
-
#define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>
|
66
|
-
|
67
|
-
]]
|
68
|
-
|
69
|
-
// GTEST_n_TYPENAMES_(T) declares a list of n typenames.
|
70
|
-
|
71
|
-
$for j [[
|
72
|
-
$range m 0..j-1
|
73
|
-
#define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]
|
74
|
-
|
75
|
-
|
76
|
-
]]
|
77
|
-
|
78
|
-
// In theory, defining stuff in the ::std namespace is undefined
|
79
|
-
// behavior. We can do this as we are playing the role of a standard
|
80
|
-
// library vendor.
|
81
|
-
namespace std {
|
82
|
-
namespace tr1 {
|
83
|
-
|
84
|
-
template <$for i, [[typename T$i = void]]>
|
85
|
-
class tuple;
|
86
|
-
|
87
|
-
// Anything in namespace gtest_internal is Google Test's INTERNAL
|
88
|
-
// IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
|
89
|
-
namespace gtest_internal {
|
90
|
-
|
91
|
-
// ByRef<T>::type is T if T is a reference; otherwise it's const T&.
|
92
|
-
template <typename T>
|
93
|
-
struct ByRef { typedef const T& type; }; // NOLINT
|
94
|
-
template <typename T>
|
95
|
-
struct ByRef<T&> { typedef T& type; }; // NOLINT
|
96
|
-
|
97
|
-
// A handy wrapper for ByRef.
|
98
|
-
#define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type
|
99
|
-
|
100
|
-
// AddRef<T>::type is T if T is a reference; otherwise it's T&. This
|
101
|
-
// is the same as tr1::add_reference<T>::type.
|
102
|
-
template <typename T>
|
103
|
-
struct AddRef { typedef T& type; }; // NOLINT
|
104
|
-
template <typename T>
|
105
|
-
struct AddRef<T&> { typedef T& type; }; // NOLINT
|
106
|
-
|
107
|
-
// A handy wrapper for AddRef.
|
108
|
-
#define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type
|
109
|
-
|
110
|
-
// A helper for implementing get<k>().
|
111
|
-
template <int k> class Get;
|
112
|
-
|
113
|
-
// A helper for implementing tuple_element<k, T>. kIndexValid is true
|
114
|
-
// iff k < the number of fields in tuple type T.
|
115
|
-
template <bool kIndexValid, int kIndex, class Tuple>
|
116
|
-
struct TupleElement;
|
117
|
-
|
118
|
-
|
119
|
-
$for i [[
|
120
|
-
template <GTEST_$(n)_TYPENAMES_(T)>
|
121
|
-
struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> [[]]
|
122
|
-
{ typedef T$i type; };
|
123
|
-
|
124
|
-
|
125
|
-
]]
|
126
|
-
} // namespace gtest_internal
|
127
|
-
|
128
|
-
template <>
|
129
|
-
class tuple<> {
|
130
|
-
public:
|
131
|
-
tuple() {}
|
132
|
-
tuple(const tuple& /* t */) {}
|
133
|
-
tuple& operator=(const tuple& /* t */) { return *this; }
|
134
|
-
};
|
135
|
-
|
136
|
-
|
137
|
-
$for k [[
|
138
|
-
$range m 0..k-1
|
139
|
-
template <GTEST_$(k)_TYPENAMES_(T)>
|
140
|
-
class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {
|
141
|
-
public:
|
142
|
-
template <int k> friend class gtest_internal::Get;
|
143
|
-
|
144
|
-
tuple() : $for m, [[f$(m)_()]] {}
|
145
|
-
|
146
|
-
explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]
|
147
|
-
$for m, [[f$(m)_(f$m)]] {}
|
148
|
-
|
149
|
-
tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
|
150
|
-
|
151
|
-
template <GTEST_$(k)_TYPENAMES_(U)>
|
152
|
-
tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {}
|
153
|
-
|
154
|
-
$if k == 2 [[
|
155
|
-
template <typename U0, typename U1>
|
156
|
-
tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {}
|
157
|
-
|
158
|
-
]]
|
159
|
-
|
160
|
-
tuple& operator=(const tuple& t) { return CopyFrom(t); }
|
161
|
-
|
162
|
-
template <GTEST_$(k)_TYPENAMES_(U)>
|
163
|
-
tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) {
|
164
|
-
return CopyFrom(t);
|
165
|
-
}
|
166
|
-
|
167
|
-
$if k == 2 [[
|
168
|
-
template <typename U0, typename U1>
|
169
|
-
tuple& operator=(const ::std::pair<U0, U1>& p) {
|
170
|
-
f0_ = p.first;
|
171
|
-
f1_ = p.second;
|
172
|
-
return *this;
|
173
|
-
}
|
174
|
-
|
175
|
-
]]
|
176
|
-
|
177
|
-
GTEST_DECLARE_TUPLE_AS_FRIEND_
|
178
|
-
|
179
|
-
template <GTEST_$(k)_TYPENAMES_(U)>
|
180
|
-
tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) {
|
181
|
-
|
182
|
-
$for m [[
|
183
|
-
f$(m)_ = t.f$(m)_;
|
184
|
-
|
185
|
-
]]
|
186
|
-
return *this;
|
187
|
-
}
|
188
|
-
|
189
|
-
|
190
|
-
$for m [[
|
191
|
-
T$m f$(m)_;
|
192
|
-
|
193
|
-
]]
|
194
|
-
};
|
195
|
-
|
196
|
-
|
197
|
-
]]
|
198
|
-
// 6.1.3.2 Tuple creation functions.
|
199
|
-
|
200
|
-
// Known limitations: we don't support passing an
|
201
|
-
// std::tr1::reference_wrapper<T> to make_tuple(). And we don't
|
202
|
-
// implement tie().
|
203
|
-
|
204
|
-
inline tuple<> make_tuple() { return tuple<>(); }
|
205
|
-
|
206
|
-
$for k [[
|
207
|
-
$range m 0..k-1
|
208
|
-
|
209
|
-
template <GTEST_$(k)_TYPENAMES_(T)>
|
210
|
-
inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) {
|
211
|
-
return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]);
|
212
|
-
}
|
213
|
-
|
214
|
-
]]
|
215
|
-
|
216
|
-
// 6.1.3.3 Tuple helper classes.
|
217
|
-
|
218
|
-
template <typename Tuple> struct tuple_size;
|
219
|
-
|
220
|
-
|
221
|
-
$for j [[
|
222
|
-
template <GTEST_$(j)_TYPENAMES_(T)>
|
223
|
-
struct tuple_size<GTEST_$(j)_TUPLE_(T)> { static const int value = $j; };
|
224
|
-
|
225
|
-
|
226
|
-
]]
|
227
|
-
template <int k, class Tuple>
|
228
|
-
struct tuple_element {
|
229
|
-
typedef typename gtest_internal::TupleElement<
|
230
|
-
k < (tuple_size<Tuple>::value), k, Tuple>::type type;
|
231
|
-
};
|
232
|
-
|
233
|
-
#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
|
234
|
-
|
235
|
-
// 6.1.3.4 Element access.
|
236
|
-
|
237
|
-
namespace gtest_internal {
|
238
|
-
|
239
|
-
|
240
|
-
$for i [[
|
241
|
-
template <>
|
242
|
-
class Get<$i> {
|
243
|
-
public:
|
244
|
-
template <class Tuple>
|
245
|
-
static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
|
246
|
-
Field(Tuple& t) { return t.f$(i)_; } // NOLINT
|
247
|
-
|
248
|
-
template <class Tuple>
|
249
|
-
static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple))
|
250
|
-
ConstField(const Tuple& t) { return t.f$(i)_; }
|
251
|
-
};
|
252
|
-
|
253
|
-
|
254
|
-
]]
|
255
|
-
} // namespace gtest_internal
|
256
|
-
|
257
|
-
template <int k, GTEST_$(n)_TYPENAMES_(T)>
|
258
|
-
GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
|
259
|
-
get(GTEST_$(n)_TUPLE_(T)& t) {
|
260
|
-
return gtest_internal::Get<k>::Field(t);
|
261
|
-
}
|
262
|
-
|
263
|
-
template <int k, GTEST_$(n)_TYPENAMES_(T)>
|
264
|
-
GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T)))
|
265
|
-
get(const GTEST_$(n)_TUPLE_(T)& t) {
|
266
|
-
return gtest_internal::Get<k>::ConstField(t);
|
267
|
-
}
|
268
|
-
|
269
|
-
// 6.1.3.5 Relational operators
|
270
|
-
|
271
|
-
// We only implement == and !=, as we don't have a need for the rest yet.
|
272
|
-
|
273
|
-
namespace gtest_internal {
|
274
|
-
|
275
|
-
// SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the
|
276
|
-
// first k fields of t1 equals the first k fields of t2.
|
277
|
-
// SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if
|
278
|
-
// k1 != k2.
|
279
|
-
template <int kSize1, int kSize2>
|
280
|
-
struct SameSizeTuplePrefixComparator;
|
281
|
-
|
282
|
-
template <>
|
283
|
-
struct SameSizeTuplePrefixComparator<0, 0> {
|
284
|
-
template <class Tuple1, class Tuple2>
|
285
|
-
static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) {
|
286
|
-
return true;
|
287
|
-
}
|
288
|
-
};
|
289
|
-
|
290
|
-
template <int k>
|
291
|
-
struct SameSizeTuplePrefixComparator<k, k> {
|
292
|
-
template <class Tuple1, class Tuple2>
|
293
|
-
static bool Eq(const Tuple1& t1, const Tuple2& t2) {
|
294
|
-
return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) &&
|
295
|
-
::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2);
|
296
|
-
}
|
297
|
-
};
|
298
|
-
|
299
|
-
} // namespace gtest_internal
|
300
|
-
|
301
|
-
template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
|
302
|
-
inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t,
|
303
|
-
const GTEST_$(n)_TUPLE_(U)& u) {
|
304
|
-
return gtest_internal::SameSizeTuplePrefixComparator<
|
305
|
-
tuple_size<GTEST_$(n)_TUPLE_(T)>::value,
|
306
|
-
tuple_size<GTEST_$(n)_TUPLE_(U)>::value>::Eq(t, u);
|
307
|
-
}
|
308
|
-
|
309
|
-
template <GTEST_$(n)_TYPENAMES_(T), GTEST_$(n)_TYPENAMES_(U)>
|
310
|
-
inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t,
|
311
|
-
const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); }
|
312
|
-
|
313
|
-
// 6.1.4 Pairs.
|
314
|
-
// Unimplemented.
|
315
|
-
|
316
|
-
} // namespace tr1
|
317
|
-
} // namespace std
|
318
|
-
|
319
|
-
|
320
|
-
$for j [[
|
321
|
-
#undef GTEST_$(j)_TUPLE_
|
322
|
-
|
323
|
-
]]
|
324
|
-
|
325
|
-
|
326
|
-
$for j [[
|
327
|
-
#undef GTEST_$(j)_TYPENAMES_
|
328
|
-
|
329
|
-
]]
|
330
|
-
|
331
|
-
#undef GTEST_DECLARE_TUPLE_AS_FRIEND_
|
332
|
-
#undef GTEST_BY_REF_
|
333
|
-
#undef GTEST_ADD_REF_
|
334
|
-
#undef GTEST_TUPLE_ELEMENT_
|
335
|
-
|
336
|
-
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
|