diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-01-20 22:34:31 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-07-13 12:49:09 -0400 |
commit | 2c894ecb25de044f5cb9c408c5264e5234b73983 (patch) | |
tree | 89c6d956f0ff42c6fefa8d0763296cea06c87d53 /indra/llcommon/llcallbacklist.cpp | |
parent | b36deb79c2e99bfa600b5895c277ffb78c61957f (diff) |
DRTVWR-558: Extend LLEventDispatcher::add() overloads.
Add LL::always_return<T>(), which takes a callable and variadic arguments. It
calls the callable with those arguments and, if the returned type is
convertible to T, converts it and returns it. Otherwise it returns T().
always_return() is generalized from, and supersedes,
LLEventDispatcher::ReturnLLSD.
Add LL::function_arity<CALLABLE>, which extends
boost::function_types::function_arity by reporting results for both
std::function<CALLABLE> and boost::function<CALLABLE>. Use for
LL::apply(function, LLSD array) as well as for LLEventDispatcher.
Make LLEventDispatcher::add() overloads uniformly distinguish between a
callable (whether non-static member function or otherwise) that accepts a
single LLSD parameter, versus any other signature. Accepting exactly one LLSD
parameter signals that the callable will accept the composite arguments LLSD
blob, instead of asking LLEventDispatcher to unpack the arguments blob into
individual arguments.
Support add(subclass method) overloads for arbitrary-parameters methods as
well as for (const LLSD&) methods. Update tests accordingly: we need no longer
pass the boilerplate lambda instance getter that binds and returns 'this'.
Extract to the two LLEventDispatcher::make_invoker() overloads the LL::apply()
logic formerly found in ReturnLLSD.
Change lleventdispatcher_test.cpp tests from boost::bind(), which accepts
variadic arguments (even though it only passes a fixed set to the target
callable), to fixed-signature lambdas. This is because the revamped add()
overloads care about signature.
Add a test for a non-static method that accepts (const LLSD&), in other words
the composite arguments LLSD blob, and likewise returns LLSD.
(cherry picked from commit 95b787f7d7226ee9de79dfc9816f33c8bf199aad)
Diffstat (limited to 'indra/llcommon/llcallbacklist.cpp')
0 files changed, 0 insertions, 0 deletions