PyObject* Table::columns() const{ Ilwis::ITable tbl = this->ptr()->as<Ilwis::Table>(); PyObject* list = newPyTuple(tbl->columnCount()); for(int i = 0; i < tbl->columnCount(); i++){ Ilwis::ColumnDefinition coldef = tbl->columndefinition(i); if (!setTupleItem(list, i, PyUnicodeFromString(coldef.name().toStdString().data()))) throw Ilwis::ErrorObject(QString("internal conversion error while trying to add '%1' to list of columns").arg(tbl->columndefinition(i).name())); } return list; }
PyObject* Catalog::items(){ if (this->__bool__()){ std::vector<Ilwis::Resource> itms = this->_catalog->items(); PyObject* ret = newPyTuple(itms.size()); int i = 0; for(auto it = itms.begin(); it < itms.end(); it++ ){ if (!setTupleItem(ret, i, PyUnicodeFromString(it->name().toStdString().data()))){ throw InvalidObject("invalid recource in catalog items"); } i++; } return ret; }else{ return newPyTuple(0); } }