diff options
Diffstat (limited to 'Examples/ocaml/strings_test/example.h')
| -rw-r--r-- | Examples/ocaml/strings_test/example.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Examples/ocaml/strings_test/example.h b/Examples/ocaml/strings_test/example.h new file mode 100644 index 0000000..3417981 --- /dev/null +++ b/Examples/ocaml/strings_test/example.h @@ -0,0 +1,37 @@ +/* -*- mode: c++ -*- */ +/* File : example.h -- Tests all string typemaps */ + +void takes_std_string( std::string in ) { + cout << "takes_std_string( \"" << in << "\" );" << endl; +} + +std::string gives_std_string() { + time_t t; + + return std::string( asctime( localtime( &t ) ) ); +} + +void takes_char_ptr( char *p ) { + cout << "takes_char_ptr( \"" << p << "\" );" << endl; +} + +char *gives_char_ptr() { + return "foo"; +} + +void takes_and_gives_std_string( std::string &inout ) { + inout.insert( inout.begin(), '[' ); + inout.insert( inout.end(), ']' ); +} + +void takes_and_gives_char_ptr( char *&ptr ) { + char *pout = strchr( ptr, '.' ); + if( pout ) ptr = pout + 1; + else ptr = "foo"; +} + +/* + * Local-Variables: + * c-indentation-style: "stroustrup" + * End: + */ |
