add overload for PIHTTPServer::register* for pointer to a member function
This commit is contained in:
@@ -13,7 +13,16 @@ public:
|
|||||||
using RequestFunction = std::function<PIHTTP::MessageMutable(const PIHTTP::MessageConst &)>;
|
using RequestFunction = std::function<PIHTTP::MessageMutable(const PIHTTP::MessageConst &)>;
|
||||||
|
|
||||||
void registerPath(const PIString & path, PIHTTP::Method method, RequestFunction functor);
|
void registerPath(const PIString & path, PIHTTP::Method method, RequestFunction functor);
|
||||||
|
template<typename T>
|
||||||
|
void
|
||||||
|
registerPath(const PIString & path, PIHTTP::Method method, T * o, PIHTTP::MessageMutable (T::*function)(const PIHTTP::MessageConst &)) {
|
||||||
|
registerPath(path, method, [o, function](const PIHTTP::MessageConst & m) { return (o->*function)(m); });
|
||||||
|
}
|
||||||
void registerUnhandled(RequestFunction functor);
|
void registerUnhandled(RequestFunction functor);
|
||||||
|
template<typename T>
|
||||||
|
void registerUnhandled(T * o, PIHTTP::MessageMutable (T::*function)(const PIHTTP::MessageConst &)) {
|
||||||
|
registerUnhandled([o, function](const PIHTTP::MessageConst & m) { return (o->*function)(m); });
|
||||||
|
}
|
||||||
void unregisterPath(const PIString & path, PIHTTP::Method method);
|
void unregisterPath(const PIString & path, PIHTTP::Method method);
|
||||||
void unregisterPath(const PIString & path);
|
void unregisterPath(const PIString & path);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user