transparent exception test
[libt2n] / example-codegen / server.hxx
1 #include <string>
2 #include "codegen_common.hxx"
3
4 LIBT2N_SET_DEFAULTGROUP(example);
5
6 LIBT2N_EXPORT std::string testfunc(std::string str) 
7 {
8     std::string ret;
9     if (str=="throw")
10         throw libt2n::t2n_runtime_error("throw me around");
11     if (str=="big")
12         ret.insert(0,100*1024,'x');
13     else
14         ret=str+", testfunc() was here";
15     return ret;
16 }
17
18 LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) 
19 {
20     std::string ret;
21     if (str=="throw")
22         throw libt2n::t2n_runtime_error("throw me around");
23     if (str=="big")
24         ret.insert(0,100*1024,'x');
25     else
26         ret=str+", testfunc() was here";
27     return ret;
28 }
29
30 LIBT2N_EXPORT int t2(int i) 
31 {
32     return i;
33 }
34
35 using namespace std;
36
37 LIBT2N_EXPORT bool t3(int i, float f, const string &s, const pair<int, float> &p)
38 {
39     return (i==p.first) && (f==p.second) && (s=="hello");
40 }