//-------------------------------------------------------------------------- bool PyW_PyListListToIntVecVecVec(PyObject *py_list, int_3dvec_t &result) { class cvt_t { private: int_3dvec_t &v; public: cvt_t(int_3dvec_t &v): v(v) { } static int cb( PyObject *py_item, Py_ssize_t index, void *ud) { cvt_t *_this = (cvt_t *)ud; // Declare an empty 2D list int_2dvec_t lst; // Push it immediately to the vector (to avoid double copies) _this->v.push_back(lst); // Now convert the inner list directly into the vector PyW_PyListListToIntVecVec(py_item, _this->v.back()); return CIP_OK; } }; cvt_t cvt(result); return pyvar_walk_list(py_list, cvt_t::cb, &cvt) != CIP_FAILED; }
// Walk the list and extract all callables bool init(PyObject *py_list) { Py_ssize_t count = pyvar_walk_list( py_list, s_py_list_walk_cb, this); return count > 0; }
//------------------------------------------------------------------------- Py_ssize_t pyvar_walk_list( PyObject *py_list, int (idaapi *cb)(const ref_t &py_item, Py_ssize_t index, void *ud), void *ud) { borref_t r(py_list); return pyvar_walk_list(r, cb, ud); }
//--------------------------------------------------------------------------- bool PyW_PyListToIntVec(PyObject *py_list, intvec_t &intvec) { intvec.clear(); return pyvar_walk_list(py_list, pylist_to_intvec_cb, &intvec) != CIP_FAILED; }
//--------------------------------------------------------------------------- bool PyW_PyListToStrVec(PyObject *py_list, qstrvec_t &strvec) { strvec.clear(); return pyvar_walk_list(py_list, pylist_to_strvec_cb, &strvec) != CIP_FAILED; }