X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=example-codegen%2Fserver.hxx;h=b15ccee6b18ad5baaf64d79e69d9c547e14213ba;hp=b20708b76cb22bc36d781fbe8b9404974721f99b;hb=e5bc4700c8dd5a178d4c40c163a4107901698b6f;hpb=71ae912ce0ade8f13cbffe0f105dad453f5e579f diff --git a/example-codegen/server.hxx b/example-codegen/server.hxx index b20708b..b15ccee 100644 --- a/example-codegen/server.hxx +++ b/example-codegen/server.hxx @@ -1,8 +1,18 @@ #include +// serialization of string +#include +// serialization of pair +#include + +// std::vector +#include +#include + #include "codegen_common.hxx" -LIBT2N_SET_DEFAULTGROUP(example); +LIBT2N_SET_DEFAULTGROUP(default); +//! test pass by copy LIBT2N_EXPORT std::string testfunc(std::string str) { std::string ret; @@ -15,6 +25,7 @@ LIBT2N_EXPORT std::string testfunc(std::string str) return ret; } +//! test pass by const reference LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) { std::string ret; @@ -27,6 +38,7 @@ LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) return ret; } +//! test builtin type LIBT2N_EXPORT int t2(int i) { return i; @@ -34,7 +46,20 @@ LIBT2N_EXPORT int t2(int i) using namespace std; -LIBT2N_EXPORT bool t3(int i, float f, const string &s, const pair &p) +//! test pair, multiple arguments and namespace +LIBT2N_EXPORT_GROUP(other) bool t3(int i, float f, const string &s, const pair &p) { return (i==p.first) && (f==p.second) && (s=="hello"); } + +//! test function overload +LIBT2N_EXPORT_GROUP(other) int t3(int i) +{ + return i; +} + +//! test std::vector +LIBT2N_EXPORT_GROUP(other) bool t3(const std::vector &i) +{ + return (i.size()==1) && (i[0]==10); +}