Lines Matching defs:std

70 //     bool MatchAndExplain(const T&, std::ostream*);
71 // (MatchResultListener* can also be used instead of std::ostream*)
72 // void DescribeTo(std::ostream*);
73 // void DescribeNegationTo(std::ostream*);
83 explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
95 ::std::ostream* stream() { return stream_; }
104 ::std::ostream* const stream_;
123 virtual void DescribeTo(::std::ostream* os) const = 0;
131 virtual void DescribeNegationTo(::std::ostream* os) const {
176 // virtual void DescribeTo(::std::ostream* os) const = 0;
177 // virtual void DescribeNegationTo(::std::ostream* os) const;
197 explicit StreamMatchResultListener(::std::ostream* os)
207 std::atomic<int> ref{1};
208 void Ref() { ref.fetch_add(1, std::memory_order_relaxed); }
209 bool Unref() { return ref.fetch_sub(1, std::memory_order_acq_rel) == 1; }
215 explicit SharedPayload(T&& v) : value(std::move(v)) {}
244 void DescribeTo(::std::ostream* os) const final {
250 void DescribeNegationTo(::std::ostream* os) const final {
256 void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
279 template <typename M, typename = typename std::remove_reference<
282 Init(std::forward<M>(m));
319 void (*describe)(const MatcherBase&, std::ostream*, bool negation);
347 static void DescribeImpl(const MatcherBase& m, std::ostream* os,
364 // We use std::get on a tuple as a workaround of not having `if constexpr`.
365 return std::get<(
366 std::is_convertible<decltype(&P::Get(m)),
369 : 0)>(std::make_tuple(&m, &P::Get(m)));
398 std::is_trivially_copy_constructible<M>::value &&
399 std::is_trivially_destructible<M>::value;
425 m.buffer_.shared = new Shared(std::forward<Arg>(arg));
433 using Shared = SharedPayload<std::unique_ptr<M>>;
438 m.buffer_.shared = new Shared(std::unique_ptr<M>(impl));
446 using MM = typename std::decay<M>::type;
449 Policy::Init(*this, std::forward<M>(m));
460 // implementation of Matcher<T> is just a std::shared_ptr to const
477 typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
481 template <typename M, typename = typename std::remove_reference<
483 Matcher(M&& m) : internal::MatcherBase<T>(std::forward<M>(m)) {} // NOLINT
491 // instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
494 class GTEST_API_ Matcher<const std::string&>
495 : public internal::MatcherBase<const std::string&> {
499 explicit Matcher(const MatcherInterface<const std::string&>* impl)
500 : internal::MatcherBase<const std::string&>(impl) {}
502 template <typename M, typename = typename std::remove_reference<
505 : internal::MatcherBase<const std::string&>(std::forward<M>(m)) {}
508 // str is a std::string object.
509 Matcher(const std::string& s); // NOLINT
516 class GTEST_API_ Matcher<std::string>
517 : public internal::MatcherBase<std::string> {
521 explicit Matcher(const MatcherInterface<const std::string&>* impl)
522 : internal::MatcherBase<std::string>(impl) {}
523 explicit Matcher(const MatcherInterface<std::string>* impl)
524 : internal::MatcherBase<std::string>(impl) {}
526 template <typename M, typename = typename std::remove_reference<
529 : internal::MatcherBase<std::string>(std::forward<M>(m)) {}
533 Matcher(const std::string& s); // NOLINT
552 template <typename M, typename = typename std::remove_reference<
555 : internal::MatcherBase<const internal::StringView&>(std::forward<M>(m)) {
559 // str is a std::string object.
560 Matcher(const std::string& s); // NOLINT
565 // Allows the user to pass absl::string_views or std::string_views directly.
580 template <typename M, typename = typename std::remove_reference<
583 : internal::MatcherBase<internal::StringView>(std::forward<M>(m)) {}
586 // str is a std::string object.
587 Matcher(const std::string& s); // NOLINT
592 // Allows the user to pass absl::string_views or std::string_views directly.
599 std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
640 void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os); }
642 void DescribeNegationTo(::std::ostream* os) const override {
699 bool MatchAndExplain(const Lhs& lhs, std::ostream*) const {
702 void DescribeTo(std::ostream* os) const {
706 void DescribeNegationTo(std::ostream* os) const {
717 static const T& Unwrap(std::reference_wrapper<T> v) {
725 class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>> {
728 : ComparisonBase<EqMatcher<Rhs>, Rhs, std::equal_to<>>(rhs) {}
734 : public ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>> {
737 : ComparisonBase<NeMatcher<Rhs>, Rhs, std::not_equal_to<>>(rhs) {}
742 class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>> {
745 : ComparisonBase<LtMatcher<Rhs>, Rhs, std::less<>>(rhs) {}
750 class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>> {
753 : ComparisonBase<GtMatcher<Rhs>, Rhs, std::greater<>>(rhs) {}
759 : public ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>> {
762 : ComparisonBase<LeMatcher<Rhs>, Rhs, std::less_equal<>>(rhs) {}
768 : public ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>> {
771 : ComparisonBase<GeMatcher<Rhs>, Rhs, std::greater_equal<>>(rhs) {}
776 template <typename T, typename = typename std::enable_if<
777 std::is_constructible<std::string, T>::value>::type>
791 return MatchAndExplain(std::string(s), listener);
802 return s != nullptr && MatchAndExplain(std::string(s), listener);
805 // Matches anything that can convert to std::string.
807 // This is a template, not just a plain function with const std::string&,
812 const std::string s2(s);
817 void DescribeTo(::std::ostream* os) const {
819 UniversalPrinter<std::string>::Print(regex_->pattern(), os);
822 void DescribeNegationTo(::std::ostream* os) const {
825 UniversalPrinter<std::string>::Print(regex_->pattern(), os);
829 const std::shared_ptr<const RE> regex_;
840 template <typename T = std::string>
843 return MatchesRegex(new internal::RE(std::string(regex)));
852 template <typename T = std::string>
855 return ContainsRegex(new internal::RE(std::string(regex)));