| 1 | #include "default.hxx" |
| 2 | #include "default_common.hxx" |
| 3 | |
| 4 | //! test pass by copy |
| 5 | LIBT2N_EXPORT std::string testfunc(std::string str) |
| 6 | { |
| 7 | std::string ret; |
| 8 | if (str=="throw") |
| 9 | throw libt2n::t2n_runtime_error("throw me around"); |
| 10 | if (str=="big") |
| 11 | ret.insert(0,100*1024,'x'); |
| 12 | else |
| 13 | ret=str+", testfunc() was here"; |
| 14 | return ret; |
| 15 | } |
| 16 | |
| 17 | //! test pass by const reference |
| 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 | //! test builtin type |
| 31 | LIBT2N_EXPORT int t2(int i) |
| 32 | { |
| 33 | return i; |
| 34 | } |