[ntcore] Pass pub/sub options as a unified PubSubOptions struct (#4794)

In Java, PubSubOption is still used for passing options, but this
simplifies C++ use substantially, as it allows aggregate construction.
This commit is contained in:
Peter Johnson
2022-12-12 19:28:15 -08:00
committed by GitHub
parent f66a667321
commit a865f48e96
53 changed files with 695 additions and 623 deletions

View File

@@ -13,21 +13,22 @@
namespace nt {
class PubSubOptionsMatcher
: public ::testing::MatcherInterface<const PubSubOptions&> {
: public ::testing::MatcherInterface<const PubSubOptionsImpl&> {
public:
explicit PubSubOptionsMatcher(PubSubOptions good) : good{std::move(good)} {}
explicit PubSubOptionsMatcher(PubSubOptionsImpl good)
: good{std::move(good)} {}
bool MatchAndExplain(const PubSubOptions& val,
bool MatchAndExplain(const PubSubOptionsImpl& val,
::testing::MatchResultListener* listener) const override;
void DescribeTo(::std::ostream* os) const override;
void DescribeNegationTo(::std::ostream* os) const override;
private:
PubSubOptions good;
PubSubOptionsImpl good;
};
inline ::testing::Matcher<const PubSubOptions&> PubSubOptionsEq(
PubSubOptions good) {
inline ::testing::Matcher<const PubSubOptionsImpl&> PubSubOptionsEq(
PubSubOptionsImpl good) {
return ::testing::MakeMatcher(new PubSubOptionsMatcher(std::move(good)));
}