mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[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:
@@ -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)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user