wrapper unnecessary! std::function<> can handle member function pointer directly. Yay!
parent
c4000901cb
commit
1cda54c636
|
@ -163,8 +163,8 @@ const FunctionMap functions = {
|
|||
FP( "OpenPGP_list_keyinfo", new Func<PEP_STATUS, In<PEP_SESSION,false>, In<const char*>, Out<stringpair_list_t*>> ( &OpenPGP_list_keyinfo) ),
|
||||
|
||||
FP( "Event Listener & Results", new Separator ),
|
||||
FP( "registerEventListener" , new Func<PEP_STATUS, In<Context*, false>, In<std::string>, In<unsigned>, In<std::string>> ( &JsonAdapter::registerEventListener2) ),
|
||||
FP( "unregisterEventListener", new Func<PEP_STATUS, In<Context*, false>, In<std::string>, In<unsigned>, In<std::string>> ( &JsonAdapter::unregisterEventListener2) ),
|
||||
FP( "registerEventListener" , new Func<void, In<JsonAdapter*, false>, In<std::string>, In<unsigned>, In<std::string>> ( &JsonAdapter::registerEventListener) ),
|
||||
FP( "unregisterEventListener", new Func<void, In<JsonAdapter*, false>, In<std::string>, In<unsigned>, In<std::string>> ( &JsonAdapter::unregisterEventListener) ),
|
||||
FP( "deliverHandshakeResult" , new Func<PEP_STATUS, In<PEP_SESSION,false>, In<pEp_identity*>, In<sync_handshake_result>> (&deliverHandshakeResult) ),
|
||||
|
||||
// my own example function that does something useful. :-)
|
||||
|
|
|
@ -680,32 +680,6 @@ void JsonAdapter::augment(json_spirit::Object& returnObject)
|
|||
}
|
||||
|
||||
|
||||
PEP_STATUS JsonAdapter::registerEventListener2(Context* ctx, std::string address, unsigned port, std::string securityContext)
|
||||
{
|
||||
JsonAdapter* ja = dynamic_cast<JsonAdapter*>(ctx);
|
||||
if(!ja)
|
||||
{
|
||||
return PEP_STATUS(-42);
|
||||
}
|
||||
|
||||
ja->registerEventListener(address, port, securityContext);
|
||||
return PEP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
PEP_STATUS JsonAdapter::unregisterEventListener2(Context* ctx, std::string address, unsigned port, std::string securityContext)
|
||||
{
|
||||
JsonAdapter* ja = dynamic_cast<JsonAdapter*>(ctx);
|
||||
if(!ja)
|
||||
{
|
||||
return PEP_STATUS(-42);
|
||||
}
|
||||
|
||||
ja->unregisterEventListener(address, port, securityContext);
|
||||
return PEP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
void JsonAdapter::registerEventListener(const std::string& address, unsigned port, const std::string& securityContext)
|
||||
{
|
||||
const auto key = std::make_pair(address, port);
|
||||
|
|
|
@ -22,10 +22,6 @@ public:
|
|||
JsonAdapter(const JsonAdapter&) = delete;
|
||||
void operator=(const JsonAdapter&) = delete;
|
||||
|
||||
// just static trampolines to call the member functions below
|
||||
static PEP_STATUS registerEventListener2(Context* ctx, std::string address, unsigned port, std::string securityContext);
|
||||
static PEP_STATUS unregisterEventListener2(Context* ctx, std::string address, unsigned port, std::string securityContext);
|
||||
|
||||
void registerEventListener(const std::string& address, unsigned port, const std::string& securityContext);
|
||||
void unregisterEventListener(const std::string& address, unsigned port, const std::string& securityContext);
|
||||
|
||||
|
|
Loading…
Reference in New Issue