460b1302beababca7c97ab3e75b09ea4372c72a9
[libt2n] / example-codegen / default.cpp
1 #include "default_common.hxx"
2
3 //! test pass by copy
4 LIBT2N_EXPORT std::string testfunc(std::string str) 
5 {
6     std::string ret;
7     if (str=="throw")
8         throw libt2n::t2n_runtime_error("throw me around");
9     if (str=="big")
10         ret.insert(0,100*1024,'x');
11     else
12         ret=str+", testfunc() was here";
13     return ret;
14 }
15
16 //! test pass by const reference
17 LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) 
18 {
19     std::string ret;
20     if (str=="throw")
21         throw libt2n::t2n_runtime_error("throw me around");
22     if (str=="big")
23         ret.insert(0,100*1024,'x');
24     else
25         ret=str+", testfunc() was here";
26     return ret;
27 }
28
29 //! test builtin type
30 LIBT2N_EXPORT int t2(int i) 
31 {
32     return i;
33 }