KstRVector *GetOrCreateVector(QString field, KstDataSourcePtr file, struct InType &in) { int i_v = 0, n_v; KstRVector *V; KstRVectorList vectorList = kstObjectSubList<KstVector,KstRVector>(KST::vectorList); n_v = vectorList.count(); for (i_v=0; i_v<n_v; i_v++) { V = *vectorList.at(i_v); if (V->getField() == field) { if (V->filename() == file->fileName()) { return (V); } } } V = new KstRVector(file, field, QString("V") + QString::number(1 + i_v++) + "-" + field, in.f, in.n, in.skip, in.doskip, in.doave); if (!V->isValid()) { kdError() << I18N_NOOP("Error: Invalid field: ") << V->getField() << endl << I18N_NOOP("File: ") << V->filename() << endl; exit(0); // fixme: this can cause crashes } return V; }
static KstRVector *GetOrCreateVector(const QString& field, KstDataSourcePtr file, InType &in) { int i_v = 0, n_v; KstRVector *V; KstRVectorList vectorList = kstObjectSubList<KstVector,KstRVector>(KST::vectorList); n_v = vectorList.count(); for (i_v=0; i_v<n_v; i_v++) { V = *vectorList.at(i_v); if (V->field() == field && V->filename() == file->fileName()) { return V; } } V = new KstRVector(file, field, KstObjectTag(KST::suggestVectorName(field), file->tag(), false), in.f, in.n, in.skip, in.doskip, in.doave); if (!V->isValid()) { if (file->fileType() == "stdin") { startupErrors.append(i18n("Failed to create vector '%1' from file '%2'. Trying again later.").arg(field).arg(file->fileName())); } else { startupErrors.append(i18n("Failed to create vector '%1' from file '%2'.").arg(field).arg(file->fileName())); V = 0L; } } else { } return V; }