summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-matchers.h
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-03-22 19:35:37 (GMT)
committerGennadiy Civil <misterg@google.com>2018-03-22 19:35:37 (GMT)
commitb7c568326c969c59a5f90e4731dc5b91f260c6f0 (patch)
tree318623a0ae1ab868a757ac7ee9eb2e444ce8e798 /googlemock/include/gmock/gmock-matchers.h
parent4e89c76db83684d4c5b86eb9186af3e33f5f4df0 (diff)
downloadgoogletest-b7c568326c969c59a5f90e4731dc5b91f260c6f0.zip
googletest-b7c568326c969c59a5f90e4731dc5b91f260c6f0.tar.gz
googletest-b7c568326c969c59a5f90e4731dc5b91f260c6f0.tar.bz2
merging, gmock -1
Diffstat (limited to 'googlemock/include/gmock/gmock-matchers.h')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h69
1 files changed, 45 insertions, 24 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 9522c85..044a323 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -323,7 +323,13 @@ class Matcher : public internal::MatcherBase<T> {
explicit Matcher() {} // NOLINT
// Constructs a matcher from its implementation.
- explicit Matcher(const MatcherInterface<T>* impl)
+ explicit Matcher(const MatcherInterface<GTEST_REFERENCE_TO_CONST_(T)>* impl)
+ : internal::MatcherBase<T>(impl) {}
+
+ template <typename U>
+ explicit Matcher(const MatcherInterface<U>* impl,
+ typename internal::EnableIf<!internal::IsSame<
+ U, GTEST_REFERENCE_TO_CONST_(U)>::value>::type* = NULL)
: internal::MatcherBase<T>(impl) {}
// Implicit constructor here allows people to write
@@ -332,64 +338,79 @@ class Matcher : public internal::MatcherBase<T> {
};
// The following two specializations allow the user to write str
-// instead of Eq(str) and "foo" instead of Eq("foo") when a string
+// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
// matcher is expected.
template <>
-class GTEST_API_ Matcher<const internal::string&>
- : public internal::MatcherBase<const internal::string&> {
+class GTEST_API_ Matcher<const std::string&>
+ : public internal::MatcherBase<const std::string&> {
public:
Matcher() {}
- explicit Matcher(const MatcherInterface<const internal::string&>* impl)
- : internal::MatcherBase<const internal::string&>(impl) {}
+ explicit Matcher(const MatcherInterface<const std::string&>* impl)
+ : internal::MatcherBase<const std::string&>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
- // str is a string object.
- Matcher(const internal::string& s); // NOLINT
+ // str is a std::string object.
+ Matcher(const std::string& s); // NOLINT
+
+#if GTEST_HAS_GLOBAL_STRING
+ // Allows the user to write str instead of Eq(str) sometimes, where
+ // str is a ::string object.
+ Matcher(const ::string& s); // NOLINT
+#endif // GTEST_HAS_GLOBAL_STRING
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
};
template <>
-class GTEST_API_ Matcher<internal::string>
- : public internal::MatcherBase<internal::string> {
+class GTEST_API_ Matcher<std::string>
+ : public internal::MatcherBase<std::string> {
public:
Matcher() {}
- explicit Matcher(const MatcherInterface<internal::string>* impl)
- : internal::MatcherBase<internal::string>(impl) {}
+ explicit Matcher(const MatcherInterface<std::string>* impl)
+ : internal::MatcherBase<std::string>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a string object.
- Matcher(const internal::string& s); // NOLINT
+ Matcher(const std::string& s); // NOLINT
+
+#if GTEST_HAS_GLOBAL_STRING
+ // Allows the user to write str instead of Eq(str) sometimes, where
+ // str is a ::string object.
+ Matcher(const ::string& s); // NOLINT
+#endif // GTEST_HAS_GLOBAL_STRING
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
};
-#if GTEST_HAS_STRING_PIECE_
+#if GTEST_HAS_GLOBAL_STRING
// The following two specializations allow the user to write str
-// instead of Eq(str) and "foo" instead of Eq("foo") when a StringPiece
+// instead of Eq(str) and "foo" instead of Eq("foo") when a ::string
// matcher is expected.
template <>
-class GTEST_API_ Matcher<const StringPiece&>
- : public internal::MatcherBase<const StringPiece&> {
+class GTEST_API_ Matcher<const ::string&>
+ : public internal::MatcherBase<const ::string&> {
public:
Matcher() {}
- explicit Matcher(const MatcherInterface<const StringPiece&>* impl)
- : internal::MatcherBase<const StringPiece&>(impl) {}
+ explicit Matcher(const MatcherInterface<const ::string&>* impl)
+ : internal::MatcherBase<const ::string&>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
- // str is a string object.
- Matcher(const internal::string& s); // NOLINT
+ // str is a std::string object.
+ Matcher(const std::string& s); // NOLINT
+
+ // Allows the user to write str instead of Eq(str) sometimes, where
+ // str is a ::string object.
+ Matcher(const ::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
+};
- // Allows the user to pass StringPieces directly.
- Matcher(StringPiece s); // NOLINT
};
template <>
@@ -1340,7 +1361,7 @@ class MatchesRegexMatcher {
// Matches anything that can convert to std::string.
//
// This is a template, not just a plain function with const std::string&,
- // because StringPiece has some interfering non-explicit constructors.
+ // because absl::string_view has some interfering non-explicit constructors.
template <class MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {