00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 %MappedType std::string
00015 {
00016 %TypeHeaderCode
00017 #include <string>
00018 using std::string;
00019 %End
00020
00021 %ConvertFromTypeCode
00022 const char *s = sipCpp->c_str();
00023 return PyString_FromString(s);
00024 %End
00025
00026 %ConvertToTypeCode
00027
00028 if (sipIsErr == NULL)
00029 return PyString_Check(sipPy);
00030 if (sipPy == Py_None) {
00031 *sipCppPtr = NULL;
00032 return 0;
00033 }
00034 if (PyString_Check(sipPy)) {
00035 *sipCppPtr = new string(PyString_AS_STRING(sipPy));
00036 return 1;
00037 }
00038 *sipCppPtr = (string *)sipForceConvertTo_std_string(sipPy,sipIsErr);
00039 return 0;
00040 %End
00041
00042 };