more complex test
[libt2n] / example-codegen / server.hxx
index 027e313..b20708b 100644 (file)
@@ -1,13 +1,23 @@
 #include <string>
 #include "codegen_common.hxx"
 
-using namespace std;
-
 LIBT2N_SET_DEFAULTGROUP(example);
 
 LIBT2N_EXPORT std::string testfunc(std::string str) 
 {
-    string ret;
+    std::string ret;
+    if (str=="throw")
+        throw libt2n::t2n_runtime_error("throw me around");
+    if (str=="big")
+        ret.insert(0,100*1024,'x');
+    else
+        ret=str+", testfunc() was here";
+    return ret;
+}
+
+LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) 
+{
+    std::string ret;
     if (str=="throw")
         throw libt2n::t2n_runtime_error("throw me around");
     if (str=="big")
@@ -16,3 +26,15 @@ LIBT2N_EXPORT std::string testfunc(std::string str)
         ret=str+", testfunc() was here";
     return ret;
 }
+
+LIBT2N_EXPORT int t2(int i) 
+{
+    return i;
+}
+
+using namespace std;
+
+LIBT2N_EXPORT bool t3(int i, float f, const string &s, const pair<int, float> &p)
+{
+    return (i==p.first) && (f==p.second) && (s=="hello");
+}