Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

string.sip

Go to the documentation of this file.
00001 // -*- mode:c++ -*-
00002 // This is the SIP interface definition for std::string
00003 //
00004 // Copyright (C)  2002  The Board of Trustees of  
00005 // The Leland Stanford Junior University.  All Rights Reserved.
00006 //
00007 // This file is part of sihippo
00008 //
00009 // $Id: string.sip,v 1.5 2005/05/09 23:42:29 panetta Exp $
00010 //
00011 // Author: Paul_Kunz@slac.stanford.edu
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          // Allow a Python string whenever a string is expected.
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 };

Generated on Wed Sep 7 14:51:29 2005 for SiHippo by  doxygen 1.4.3