From: Jens Thiele Date: Tue, 21 Nov 2006 14:35:54 +0000 (+0000) Subject: copy includes from input file to common_hpp file X-Git-Tag: v0.2~102 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=e5bc4700c8dd5a178d4c40c163a4107901698b6f copy includes from input file to common_hpp file --- diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index a2ddc51..f1ce586 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -15,8 +15,8 @@ noinst_PROGRAMS = client server codegen.stamp: server.hxx $(top_builddir)/codegen/codegen cp $(top_srcdir)/codegen/codegen-stubhead.hxx codegen_common.hxx # todo use tmp file for server.xml - gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) server.hxx -fxml=server.xml - $(top_builddir)/codegen/codegen server.xml codegen_ + gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $< -fxml=server.xml + $(top_builddir)/codegen/codegen $< server.xml codegen_ touch codegen.stamp codegen_common.hxx codegen_common.cpp codegen_client.hxx codegen_client.cpp codegen_server.cpp: codegen.stamp diff --git a/example-codegen/client.cpp b/example-codegen/client.cpp index 260a60c..266bef0 100644 --- a/example-codegen/client.cpp +++ b/example-codegen/client.cpp @@ -29,6 +29,7 @@ int main(int argc, char** argv) && ( cc.testfunc_ref("hello") == "hello, testfunc() was here" ) && ( cc.t2(10) == 10 ) && ( cc_other.t3(10, 20, "hello", std::pair(10,20)) ) - && ( cc_other.t3(10) == 10 ) ) + && ( cc_other.t3(10) == 10 ) + && ( cc_other.t3(std::vector(1,10)) ) ) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/example-codegen/server.hxx b/example-codegen/server.hxx index c69a9d5..b15ccee 100644 --- a/example-codegen/server.hxx +++ b/example-codegen/server.hxx @@ -1,8 +1,18 @@ #include +// serialization of string +#include +// serialization of pair +#include + +// std::vector +#include +#include + #include "codegen_common.hxx" LIBT2N_SET_DEFAULTGROUP(default); +//! test pass by copy LIBT2N_EXPORT std::string testfunc(std::string str) { std::string ret; @@ -15,6 +25,7 @@ LIBT2N_EXPORT std::string testfunc(std::string str) return ret; } +//! test pass by const reference LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) { std::string ret; @@ -27,6 +38,7 @@ LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) return ret; } +//! test builtin type LIBT2N_EXPORT int t2(int i) { return i; @@ -34,12 +46,20 @@ LIBT2N_EXPORT int t2(int i) using namespace std; +//! test pair, multiple arguments and namespace LIBT2N_EXPORT_GROUP(other) bool t3(int i, float f, const string &s, const pair &p) { return (i==p.first) && (f==p.second) && (s=="hello"); } +//! test function overload LIBT2N_EXPORT_GROUP(other) int t3(int i) { return i; } + +//! test std::vector +LIBT2N_EXPORT_GROUP(other) bool t3(const std::vector &i) +{ + return (i.size()==1) && (i[0]==10); +}