1 /* -----------------------------------------------------------------------------
2 * See the LICENSE file for information on copyright, usage and redistribution
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
7 * SWIG typemaps for std::string types
8 * ----------------------------------------------------------------------------- */
10 // ------------------------------------------------------------------------
11 // std::string is typemapped by value
12 // This can prevent exporting methods which return a string
13 // in order for the user to modify it.
14 // However, I think I'll wait until someone asks for it...
15 // ------------------------------------------------------------------------
17 %include <exception.i>
29 /* Overloading check */
31 %typemap(typecheck) string = char *;
32 %typemap(typecheck) const string & = char *;
35 if (SCHEME_STRINGP($input))
36 $1.assign(SCHEME_STR_VAL($input));
38 SWIG_exception(SWIG_TypeError, "string expected");
41 %typemap(in) const string & (std::string temp) {
42 if (SCHEME_STRINGP($input)) {
43 temp.assign(SCHEME_STR_VAL($input));
46 SWIG_exception(SWIG_TypeError, "string expected");
50 %typemap(out) string {
51 $result = scheme_make_string($1.c_str());
54 %typemap(out) const string & {
55 $result = scheme_make_string($1->c_str());