Director: added disown. It now mutates the reference held by the object.

mlheading and mliheading: Added C_director_core, which holds the state needed
by the director to disown.
std_string and std_vector: Added specific support for the common case of
a zero-terminated char **.
typemaps.i: Withdraw default argout for SWIGTYPE &


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4481 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Art Yerkes 2003-03-08 20:14:31 +00:00
commit ade9d25284
7 changed files with 131 additions and 4 deletions

View file

@ -17,8 +17,11 @@
%{
#include <string>
#include <vector>
%}
%include std_vector.i
namespace std {
template <class charT> class basic_string {
public:
@ -113,3 +116,32 @@ namespace std {
}
}
%template (StringVector) std::vector<string >;
char **c_charptr_array( const std::vector <string > &str_v );
%{
SWIGEXT char **c_charptr_array( const std::vector <string > &str_v ) {
char **out = new char *[str_v.size() + 1];
out[str_v.size()] = 0;
for( int i = 0; i < str_v.size(); i++ ) {
out[i] = (char *)str_v[i].c_str();
}
return out;
}
%}
%insert(ml) %{
(* Some STL convenience items *)
let string_array_to_vector sa =
let nv = _new_StringVector C_void in
array_to_vector nv (fun x -> C_string x) sa ; nv
let c_string_array ar =
_c_charptr_array (string_array_to_vector ar)
%}
%insert(mli) %{
val c_string_array: string array -> c_obj
%}