Strings test, tests in, out, inout string and char * types.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4687 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b4831c6e0b
commit
3acd792de3
4 changed files with 95 additions and 0 deletions
37
Examples/ocaml/strings_test/example.h
Normal file
37
Examples/ocaml/strings_test/example.h
Normal file
|
|
@ -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:
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue