diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2019-01-02 17:38:00 +0100 |
---|---|---|
committer | Jose Bollo <jose.bollo@iot.bzh> | 2019-03-11 13:36:28 +0100 |
commit | 3abc75dfa35fa36c0f5f55cd4aed4d443620b3a9 (patch) | |
tree | 62886316daf9c0124ef629493c872ad97aff9977 /bindings/tutorial/tuto-3.cpp | |
parent | e9a9f95aab36dd73037024e5450d2ecd6da959af (diff) |
c++: Add verb initialisation for C++
This new constexpr initialisation method accepts
a callback receiving a afb::req instead of a
afb_req_t.
Change-Id: I752e670b5545a9d7956987984e725b468196a6e9
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'bindings/tutorial/tuto-3.cpp')
-rw-r--r-- | bindings/tutorial/tuto-3.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bindings/tutorial/tuto-3.cpp b/bindings/tutorial/tuto-3.cpp index 66f8e83a..8ad69ef3 100644 --- a/bindings/tutorial/tuto-3.cpp +++ b/bindings/tutorial/tuto-3.cpp @@ -6,11 +6,10 @@ afb::event event_login, event_logout; -void login(afb_req_t r) +void login(afb::req req) { json_object *args, *user, *passwd; char *usr; - afb::req req(r); args = req.json(); if (!json_object_object_get_ex(args, "user", &user) @@ -33,11 +32,10 @@ void login(afb_req_t r) } } -void action(afb_req_t r) +void action(afb::req req) { json_object *args, *val; char *usr; - afb::req req(r); args = req.json(); // usr = (char*)req.context_get(); @@ -57,10 +55,9 @@ usr = nullptr; req.success(json_object_get(args)); } -void logout(afb_req_t r) +void logout(afb::req req) { char *usr; - afb::req req(r); // usr = (char*)req.context_get(); usr = nullptr; |