diff PyTypeConversions.cpp @ 73:76355b91cd92 vampyhost

Add vector<string> -> Python converter
author Chris Cannam
date Mon, 24 Nov 2014 11:02:20 +0000
parents 40a01bb24209
children e7d03f88ef43
line wrap: on
line diff
--- a/PyTypeConversions.cpp	Mon Nov 24 09:50:49 2014 +0000
+++ b/PyTypeConversions.cpp	Mon Nov 24 11:02:20 2014 +0000
@@ -741,6 +741,16 @@
 }
 #endif
 
+PyObject *
+PyTypeConversions::PyValue_From_StringVector(const std::vector<std::string> &v) const
+{
+	PyObject *pyList = PyList_New(v.size());
+	for (size_t i = 0; i < v.size(); ++i) {
+		PyObject *pyStr = PyString_FromString(v[i].c_str());
+		PyList_SET_ITEM(pyList, i, pyStr);
+	}
+	return pyList;
+}
 
 
 /*			   			  	Error handling		   			  		*/