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; }
std::vector<std::string> Table::columns() const{ Ilwis::ITable tbl = this->ptr()->as<Ilwis::Table>(); std::vector<std::string> vector; for(int i = 0; i < tbl->columnCount(); i++){ Ilwis::ColumnDefinition coldef = tbl->columndefinition(i); vector.push_back( coldef.name().toStdString() ); //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 vector; }