projects using libt2n-codegen must include the makefile snippet themselves.
[libt2n] / example-codegen / default.cpp
CommitLineData
1e683bb5 1#include "default_common.hxx"
a96ab628
JT
2
3//! test pass by copy
4LIBT2N_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
17LIBT2N_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
30LIBT2N_EXPORT int t2(int i)
31{
32 return i;
33}